Created
March 14, 2017 10:00
-
-
Save RReverser/e3ebe7c2fc419e64c6b5d5ddc3b95387 to your computer and use it in GitHub Desktop.
Acorn: top-level parsing experiment
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
// See https://jsperf.com/acorn-top-level-parsing-experiment/1 for example | |
acorn.plugins.top_level = function (instance) { | |
// Could skip other things as well, but this | |
// is where the most time can be saved | |
instance.parseBlock = function () { | |
var node = this.startNode(); | |
var length = this.context.length; | |
do { | |
this.next(); | |
} while (this.context.length >= length); | |
this.next(); // this.expect(tt.braceR); | |
node.body = []; | |
return this.finishNode(node, "BlockStatement"); | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment