mirror of
https://github.com/morluto/rea.git
synced 2026-11-07 07:16:13 +00:00
fix(javascript): yield during receiver and reference classification (#1557)
This commit is contained in:
1 parent
de619bd334
commit
8c47a9ce4b
5 files changed
+109
-39
No files matched your search
@@ -15,7 +15,10 @@ import {
|
||||
} from "./javascriptSemanticState.js";
|
||||
import { semanticRequireOrigin } from "./javascriptSemanticRequireOrigin.js";
|
||||
import { compareUnicodeCodePoints } from "../unicodeCodePointOrder.js";
|
||||
import { traverseJavaScriptAst } from "./javascriptSemanticTraversal.js";
|
||||
import {
|
||||
completeSemanticSteps,
|
||||
traverseJavaScriptAstSteps,
|
||||
} from "./javascriptSemanticTraversal.js";
|
||||
import {
|
||||
evaluateSemanticBinding,
|
||||
evaluateSemanticProvenance,
|
||||
@@ -104,11 +107,19 @@ export const collectSemanticReferences = (
|
||||
program: t.Program,
|
||||
state: JavaScriptSemanticAnalysisState,
|
||||
name?: string,
|
||||
): JavaScriptSemanticReference[] => {
|
||||
): JavaScriptSemanticReference[] =>
|
||||
completeSemanticSteps(collectSemanticReferencesSteps(program, state, name));
|
||||
|
||||
/** Collect lexical references in steps while preserving resolution and visit order. */
|
||||
export function* collectSemanticReferencesSteps(
|
||||
program: t.Program,
|
||||
state: JavaScriptSemanticAnalysisState,
|
||||
name?: string,
|
||||
): Generator<void, JavaScriptSemanticReference[]> {
|
||||
const output: JavaScriptSemanticReference[] = [];
|
||||
const seen = new Set<string>();
|
||||
const patterns: t.Node[] = [];
|
||||
traverseJavaScriptAst(program, {
|
||||
yield* traverseJavaScriptAstSteps(program, {
|
||||
enter: (node, parent, readAncestors) => {
|
||||
if (isPatternNode(node)) patterns.push(node);
|
||||
if (
|
||||
@@ -154,7 +165,7 @@ export const collectSemanticReferences = (
|
||||
},
|
||||
});
|
||||
return output;
|
||||
};
|
||||
}
|
||||
|
||||
/** Freeze collected scopes into deterministic IR order. */
|
||||
export const immutableSemanticScopes = (
|
||||
|
||||
Reference in new issue
Block a user