Make tokens optional (#563)

Adding tokens to the ast is significant slower and most tools
don't ever use them anyway
This commit is contained in:
Daniel Tschinder
2017-06-27 20:26:24 -07:00
committed by Henry Zhu
parent 3d03414c05
commit fecdb6feeb
12 changed files with 786 additions and 7 deletions

View File

@@ -28,9 +28,10 @@ export default class StatementParser extends ExpressionParser {
this.parseBlockBody(program, true, true, tt.eof);
file.program = this.finishNode(program, "Program");
file.program = this.finishNode(program, "Program");
file.comments = this.state.comments;
file.tokens = this.state.tokens;
if (this.options.tokens) file.tokens = this.state.tokens;
return this.finishNode(file, "File");
}