This repository has been archived by the owner on Sep 10, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix for loop scope with fork a new scope to resolve it
- Loading branch information
Showing
4 changed files
with
128 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,89 +1,89 @@ | ||
import * as types from "babel-types"; | ||
import * as t from "babel-types"; | ||
import { Path } from "./path"; | ||
|
||
export type ScopeType = "function" | "loop" | "switch" | "block" | "class"; | ||
|
||
export type Kind = "const" | "var" | "let"; | ||
|
||
export interface INodeTypeMap { | ||
File: types.File; | ||
Program: types.Program; | ||
Identifier: types.Identifier; | ||
NullLiteral: types.NullLiteral; | ||
StringLiteral: types.StringLiteral; | ||
NumericLiteral: types.NumericLiteral; | ||
BooleanLiteral: types.BooleanLiteral; | ||
RegExpLiteral: types.RegExpLiteral; | ||
FunctionDeclaration: types.FunctionDeclaration; | ||
FunctionExpression: types.FunctionExpression; | ||
ArrowFunctionExpression: types.ArrowFunctionExpression; | ||
SwitchCase: types.SwitchCase; | ||
CatchClause: types.CatchClause; | ||
VariableDeclarator: types.VariableDeclarator; | ||
ExpressionStatement: types.ExpressionStatement; | ||
BlockStatement: types.BlockStatement; | ||
EmptyStatement: types.EmptyStatement; | ||
DebuggerStatement: types.DebuggerStatement; | ||
WithStatement: types.WithStatement; | ||
ReturnStatement: types.ReturnStatement; | ||
LabeledStatement: types.LabeledStatement; | ||
BreakStatement: types.BreakStatement; | ||
ContinueStatement: types.ContinueStatement; | ||
IfStatement: types.IfStatement; | ||
SwitchStatement: types.SwitchStatement; | ||
ThrowStatement: types.ThrowStatement; | ||
TryStatement: types.TryStatement; | ||
WhileStatement: types.WhileStatement; | ||
DoWhileStatement: types.DoWhileStatement; | ||
ForStatement: types.ForStatement; | ||
ForInStatement: types.ForInStatement; | ||
ForOfStatement: types.ForOfStatement; | ||
VariableDeclaration: types.VariableDeclaration; | ||
ClassDeclaration: types.ClassDeclaration; | ||
ThisExpression: types.ThisExpression; | ||
ArrayExpression: types.ArrayExpression; | ||
ObjectExpression: types.ObjectExpression; | ||
ObjectProperty: types.ObjectProperty; | ||
ObjectMethod: types.ObjectMethod; | ||
YieldExpression: types.YieldExpression; | ||
UnaryExpression: types.UnaryExpression; | ||
UpdateExpression: types.UpdateExpression; | ||
BinaryExpression: types.BinaryExpression; | ||
AssignmentExpression: types.AssignmentExpression; | ||
LogicalExpression: types.LogicalExpression; | ||
MemberExpression: types.MemberExpression; | ||
ConditionalExpression: types.ConditionalExpression; | ||
CallExpression: types.CallExpression; | ||
NewExpression: types.NewExpression; | ||
SequenceExpression: types.SequenceExpression; | ||
TemplateLiteral: types.TemplateLiteral; | ||
TaggedTemplateExpression: types.TaggedTemplateExpression; | ||
ClassExpression: types.ClassExpression; | ||
ClassMethod: types.ClassMethod; | ||
MetaProperty: types.MetaProperty; | ||
AwaitExpression: types.AwaitExpression; | ||
Super: types.Super; | ||
TemplateElement: types.TemplateElement; | ||
SpreadElement: types.SpreadElement; | ||
// ObjectPattern: types.ObjectPattern; | ||
// ArrayPattern: types.ArrayPattern; | ||
RestElement: types.RestElement; | ||
AssignmentPattern: types.AssignmentPattern; | ||
ClassBody: types.ClassBody; | ||
ImportDeclaration: types.ImportDeclaration; | ||
ExportNamedDeclaration: types.ExportNamedDeclaration; | ||
ExportDefaultDeclaration: types.ExportDefaultDeclaration; | ||
// ExportAllDeclaration: types.ExportAllDeclaration; | ||
ImportSpecifier: types.ImportSpecifier; | ||
ImportDefaultSpecifier: types.ImportDefaultSpecifier; | ||
// ImportNamespaceSpecifier: types.ImportNamespaceSpecifier; | ||
ExportSpecifier: types.ExportSpecifier; | ||
SpreadProperty: types.SpreadProperty; | ||
DoExpression: types.DoExpression; | ||
File: t.File; | ||
Program: t.Program; | ||
Identifier: t.Identifier; | ||
NullLiteral: t.NullLiteral; | ||
StringLiteral: t.StringLiteral; | ||
NumericLiteral: t.NumericLiteral; | ||
BooleanLiteral: t.BooleanLiteral; | ||
RegExpLiteral: t.RegExpLiteral; | ||
FunctionDeclaration: t.FunctionDeclaration; | ||
FunctionExpression: t.FunctionExpression; | ||
ArrowFunctionExpression: t.ArrowFunctionExpression; | ||
SwitchCase: t.SwitchCase; | ||
CatchClause: t.CatchClause; | ||
VariableDeclarator: t.VariableDeclarator; | ||
ExpressionStatement: t.ExpressionStatement; | ||
BlockStatement: t.BlockStatement; | ||
EmptyStatement: t.EmptyStatement; | ||
DebuggerStatement: t.DebuggerStatement; | ||
WithStatement: t.WithStatement; | ||
ReturnStatement: t.ReturnStatement; | ||
LabeledStatement: t.LabeledStatement; | ||
BreakStatement: t.BreakStatement; | ||
ContinueStatement: t.ContinueStatement; | ||
IfStatement: t.IfStatement; | ||
SwitchStatement: t.SwitchStatement; | ||
ThrowStatement: t.ThrowStatement; | ||
TryStatement: t.TryStatement; | ||
WhileStatement: t.WhileStatement; | ||
DoWhileStatement: t.DoWhileStatement; | ||
ForStatement: t.ForStatement; | ||
ForInStatement: t.ForInStatement; | ||
ForOfStatement: t.ForOfStatement; | ||
VariableDeclaration: t.VariableDeclaration; | ||
ClassDeclaration: t.ClassDeclaration; | ||
ThisExpression: t.ThisExpression; | ||
ArrayExpression: t.ArrayExpression; | ||
ObjectExpression: t.ObjectExpression; | ||
ObjectProperty: t.ObjectProperty; | ||
ObjectMethod: t.ObjectMethod; | ||
YieldExpression: t.YieldExpression; | ||
UnaryExpression: t.UnaryExpression; | ||
UpdateExpression: t.UpdateExpression; | ||
BinaryExpression: t.BinaryExpression; | ||
AssignmentExpression: t.AssignmentExpression; | ||
LogicalExpression: t.LogicalExpression; | ||
MemberExpression: t.MemberExpression; | ||
ConditionalExpression: t.ConditionalExpression; | ||
CallExpression: t.CallExpression; | ||
NewExpression: t.NewExpression; | ||
SequenceExpression: t.SequenceExpression; | ||
TemplateLiteral: t.TemplateLiteral; | ||
TaggedTemplateExpression: t.TaggedTemplateExpression; | ||
ClassExpression: t.ClassExpression; | ||
ClassMethod: t.ClassMethod; | ||
MetaProperty: t.MetaProperty; | ||
AwaitExpression: t.AwaitExpression; | ||
Super: t.Super; | ||
TemplateElement: t.TemplateElement; | ||
SpreadElement: t.SpreadElement; | ||
// ObjectPattern: t.ObjectPattern; | ||
// ArrayPattern: t.ArrayPattern; | ||
RestElement: t.RestElement; | ||
AssignmentPattern: t.AssignmentPattern; | ||
ClassBody: t.ClassBody; | ||
ImportDeclaration: t.ImportDeclaration; | ||
ExportNamedDeclaration: t.ExportNamedDeclaration; | ||
ExportDefaultDeclaration: t.ExportDefaultDeclaration; | ||
// ExportAllDeclaration: t.ExportAllDeclaration; | ||
ImportSpecifier: t.ImportSpecifier; | ||
ImportDefaultSpecifier: t.ImportDefaultSpecifier; | ||
// ImportNamespaceSpecifier: t.ImportNamespaceSpecifier; | ||
ExportSpecifier: t.ExportSpecifier; | ||
SpreadProperty: t.SpreadProperty; | ||
DoExpression: t.DoExpression; | ||
} | ||
|
||
export type EvaluateMap = { | ||
[key in keyof INodeTypeMap]: (path: Path<INodeTypeMap[key]>) => any | ||
}; | ||
|
||
export type EvaluateFunc = (path: Path<types.Node>) => any; | ||
export type EvaluateFunc = (path: Path<t.Node>) => any; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters