js-ast-parser
Version:
把javascript代码字符串解析为AST对象
17 lines (16 loc) • 571 B
text/typescript
import { NodeCode } from "../../constants";
import { AstNode } from "../AstNode";
import { Statement } from "./Statement";
export class UnExpectStatement extends Statement {
type = 'UnExpectStatement';
code = NodeCode.UnexpectStatement;
constructor(public value?: any, public msg?: string, loc?: any) {
super();
if (loc) {
Object.assign(this.loc, loc);
} else if (value && value instanceof AstNode) {
this.loc.start = value.loc.start;
this.loc.end = value.loc.end;
}
}
}