mirror of
https://github.com/morluto/rea.git
synced 2026-10-29 19:05:45 +00:00
fix(javascript): preserve semantic uncertainty and lexical ownership
This commit is contained in:
1 parent
9fe54c4073
commit
896696b2e7
16 files changed
+525
-20
No files matched your search
@@ -860,13 +860,18 @@ const hasConditionalInitializer = (ancestors: readonly t.Node[]): boolean => {
|
||||
const node = ancestors[index];
|
||||
if (t.isFunction(node) || t.isProgram(node) || t.isStaticBlock(node))
|
||||
return false;
|
||||
if (
|
||||
t.isIfStatement(node) ||
|
||||
t.isLoop(node) ||
|
||||
t.isSwitchCase(node) ||
|
||||
t.isTryStatement(node)
|
||||
)
|
||||
if (t.isIfStatement(node) || t.isSwitchCase(node) || t.isTryStatement(node))
|
||||
return true;
|
||||
if (t.isLoop(node)) {
|
||||
const bodyOrTest = ancestors[index + 1];
|
||||
if (
|
||||
(t.isForStatement(node) && bodyOrTest === node.init) ||
|
||||
(t.isDoWhileStatement(node) &&
|
||||
(bodyOrTest === node.body || bodyOrTest === node.test))
|
||||
)
|
||||
continue;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user