js-ast-parser
Version:
把javascript代码字符串解析为AST对象
17 lines (16 loc) • 500 B
text/typescript
import { NodeCode } from "../../constants";
import { AstNode } from "../AstNode";
import { Expression } from "./Expression";
export class UnaryExpression extends Expression {
type = 'UnaryExpression';
code = NodeCode.UnaryExpression;
operator: string;
argument: AstNode;
prefix: boolean;
suffix: boolean;
constructor(currentToken: any) {
super();
this.loc.start = currentToken.loc.start;
this.operator = currentToken.value;
}
}