js-ast-parser
Version:
把javascript代码字符串解析为AST对象
25 lines (23 loc) • 962 B
text/typescript
import { NodeCode } from "../../constants";
import { AstNode } from "../AstNode";
import { IdentifierLiteralExpression } from "../expression/IdentifierLiteralExpression";
import { StringLiteralExpression } from "../expression/StringLiteralExpression";
import { Statement } from "./Statement";
import { VariableDeclarationStatement } from "./VariableDeclarationStatement";
export type ExportSpecifier = {
exported: IdentifierLiteralExpression,
local: IdentifierLiteralExpression
}
export class ExportDeclarationStatement extends Statement {
type = 'ExportDeclarationStatement';
code = NodeCode.ExportDeclarationStatement;
declaration: VariableDeclarationStatement;
exported: AstNode;
local: IdentifierLiteralExpression;
specifiers: Array<ExportSpecifier> = [];
from: StringLiteralExpression;
constructor(currentToken: any) {
super()
this.loc.start = currentToken.loc.start;
}
}