(operations: Array<number>)
| 220 | } |
| 221 | |
| 222 | export function printOperationsArray(operations: Array<number>) { |
| 223 | // The first two values are always rendererID and rootID |
| 224 | const rendererID = operations[0]; |
| 225 | const rootID = operations[1]; |
| 226 | |
| 227 | const logs = [`operations for renderer:${rendererID} and root:${rootID}`]; |
| 228 | |
| 229 | let i = 2; |
| 230 | |
| 231 | // Reassemble the string table. |
| 232 | const stringTable: Array<null | string> = [ |
| 233 | null, // ID = 0 corresponds to the null string. |
| 234 | ]; |
| 235 | const stringTableSize = operations[i++]; |
| 236 | const stringTableEnd = i + stringTableSize; |
| 237 | while (i < stringTableEnd) { |
| 238 | const nextLength = operations[i++]; |
| 239 | const nextString = utfDecodeStringWithRanges( |
| 240 | operations, |
| 241 | i, |
| 242 | i + nextLength - 1, |
| 243 | ); |
| 244 | stringTable.push(nextString); |
| 245 | i += nextLength; |
| 246 | } |
| 247 | |
| 248 | while (i < operations.length) { |
| 249 | const operation = operations[i]; |
| 250 | |
| 251 | switch (operation) { |
| 252 | case TREE_OPERATION_ADD: { |
| 253 | const id = ((operations[i + 1]: any): number); |
| 254 | const type = ((operations[i + 2]: any): ElementType); |
| 255 | |
| 256 | i += 3; |
| 257 | |
| 258 | if (type === ElementTypeRoot) { |
| 259 | logs.push(`Add new root node ${id}`); |
| 260 | |
| 261 | i++; // isStrictModeCompliant |
| 262 | i++; // supportsProfiling |
| 263 | i++; // supportsStrictMode |
| 264 | i++; // hasOwnerMetadata |
| 265 | i++; // supportsTogglingSuspense |
| 266 | } else { |
| 267 | const parentID = ((operations[i]: any): number); |
| 268 | i++; |
| 269 | |
| 270 | i++; // ownerID |
| 271 | |
| 272 | const displayNameStringID = operations[i]; |
| 273 | const displayName = stringTable[displayNameStringID]; |
| 274 | i++; |
| 275 | |
| 276 | i++; // key |
| 277 | i++; // name |
| 278 | |
| 279 | logs.push( |
no test coverage detected