mirror of
https://github.com/morluto/rea.git
synced 2026-11-16 11:43:20 +00:00
refactor(javascript): classify implicit execution in one owner (#10605)
* refactor(javascript): classify implicit execution in one owner Add javascriptSemanticExecutionPoints, a total classification of every runtime Babel node type into the ways its evaluation can run code without call syntax. The member-mutation escape walk, the accessor operand collector and the catch-source reachability check consult it instead of their own syntax lists. Kinds those collectors have never applied are now named in exhaustive switches rather than absent. A guard test fails when the installed @babel/types defines a node type the table does not classify, and unknown node types classify as unsupported syntax rather than inert. * test(hopper): retry cleanup after confirmed application exit * fix(javascript): classify enumeration and catch binding effects * fix(javascript): retain catch uncertainty for identifier reads
This commit is contained in:
1 parent
4502bd44bb
commit
a874fcc4e3
6 files changed
+947
-240
No files matched your search
@@ -14,6 +14,7 @@ import { compareUnicodeCodePoints } from "../unicodeCodePointOrder.js";
|
||||
|
||||
import { semanticCopiedReferencePath } from "./javascriptSemanticCopiedReferencePaths.js";
|
||||
import { semanticMethodDefinitionExpression } from "./javascriptSemanticEvaluationOrder.js";
|
||||
import { javaScriptExecutions } from "./javascriptSemanticExecutionPoints.js";
|
||||
import { childNodes } from "./javascriptSemanticTraversal.js";
|
||||
import type {
|
||||
IterationSourceValue,
|
||||
@@ -294,21 +295,13 @@ const guardedBodyMayCall = (body: t.BlockStatement): boolean => {
|
||||
for (const child of children)
|
||||
pending.push({ node: child, parent: node, finish: false });
|
||||
} else {
|
||||
// Without scope proof an identifier may resolve through a global accessor,
|
||||
// including when its enclosing operator itself performs no coercion.
|
||||
const direct =
|
||||
t.isCallExpression(node) ||
|
||||
t.isOptionalCallExpression(node) ||
|
||||
t.isNewExpression(node) ||
|
||||
t.isTaggedTemplateExpression(node) ||
|
||||
t.isMemberExpression(node) ||
|
||||
t.isOptionalMemberExpression(node) ||
|
||||
t.isBinaryExpression(node) ||
|
||||
t.isUnaryExpression(node) ||
|
||||
t.isUpdateExpression(node) ||
|
||||
t.isSpreadElement(node) ||
|
||||
t.isForOfStatement(node) ||
|
||||
t.isAwaitExpression(node) ||
|
||||
((t.isVariableDeclarator(node) || t.isAssignmentExpression(node)) &&
|
||||
semanticSourceFacts(node, parent).propertyReads.length > 0);
|
||||
javaScriptExecutions(node, parent).length > 0 ||
|
||||
(t.isIdentifier(node) &&
|
||||
parent !== null &&
|
||||
t.isReferenced(node, parent));
|
||||
guardedExecutions.set(
|
||||
node,
|
||||
direct ||
|
||||
|
||||
Reference in new issue
Block a user