(path)
| 363 | |
| 364 | babelTraverse(source.ast, { |
| 365 | Expression(path) { |
| 366 | if (!path.parentPath.isExpressionStatement()) { |
| 367 | return; |
| 368 | } |
| 369 | |
| 370 | if (path.node.__skipped || |
| 371 | (path.node.__idDependencies && |
| 372 | path.node.__idDependencies.length > MAX_DEPENDENCIES)) { |
| 373 | return; |
| 374 | } |
| 375 | |
| 376 | if (path.isIdentifier() || path.isMemberExpression() || |
| 377 | path.isConditionalExpression() || |
| 378 | path.isBinaryExpression() || path.isDoExpression() || |
| 379 | path.isLiteral() || |
| 380 | path.isObjectExpression() || path.isArrayExpression()) { |
| 381 | // Skip: |
| 382 | // - Identifiers. |
| 383 | // - Member expressions (too many and too context dependent). |
| 384 | // - Conditional expressions (too many and too context dependent). |
| 385 | // - Binary expressions (too many). |
| 386 | // - Literals (too many). |
| 387 | // - Object/array expressions (too many). |
| 388 | return; |
| 389 | } |
| 390 | |
| 391 | if (path.isAssignmentExpression()) { |
| 392 | if (!babelTypes.isMemberExpression(path.node.left)) { |
| 393 | // Skip assignments that aren't to properties. |
| 394 | return; |
| 395 | } |
| 396 | |
| 397 | if (babelTypes.isIdentifier(path.node.left.object)) { |
| 398 | if (babelTypes.isNumericLiteral(path.node.left.property)) { |
| 399 | // Skip VAR[\d+] = ...; |
| 400 | // There are too many and they generally aren't very useful. |
| 401 | return; |
| 402 | } |
| 403 | |
| 404 | if (babelTypes.isStringLiteral(path.node.left.property) && |
| 405 | !propertyNames.has(path.node.left.property.value)) { |
| 406 | // Skip custom properties. e.g. |
| 407 | // VAR["abc"] = ...; |
| 408 | // There are too many and they generally aren't very useful. |
| 409 | return; |
| 410 | } |
| 411 | } |
| 412 | } |
| 413 | |
| 414 | if (path.isCallExpression() && |
| 415 | babelTypes.isIdentifier(path.node.callee) && |
| 416 | !globalIdentifiers.has(path.node.callee.name)) { |
| 417 | // Skip VAR(...) calls since there's too much context we're missing. |
| 418 | return; |
| 419 | } |
| 420 | |
| 421 | if (path.isUnaryExpression() && path.node.operator == '-') { |
| 422 | // Skip -... since there are too many. |
nothing calls this directly
no test coverage detected