Commit Graph

1 Commits

Author SHA1 Message Date
Julian Rosse 71350d67c4 AST generation hooks (#5099)
* include range in location data

* use exclusive ranges

* ast generation hooks

* fix getAstChildren()

* babylon -

* isArray -> Array.isArray

* pass options to toJSON()

* default astType on Base

* using exclusive range

* extract location data tests

* babylon -> ast

* remove do ->

* _toAst -> getAstContent

* Pass through parsed number value from lexer to node; don't process more than is necessary (a number literal can never be negative, because the negative sign is an Op token and node)

* normalize NumberLiteral values

* use parsedValue in getNumberValue()

* recursive getNumberValue()

* parseNumber()

* The core JavaScript Number constructor does a better job at parsing strings into numbers than our helper does

* Use Object.assign rather than merge or extend

* Update link

* Cleanup style

* Refactor to make AST generation more object-oriented: have each of the AST properties be generated on the node itself, rather than in loops in the base class

* Untangle test helpers: give the AST location tests their own specific helper function, and move the general AST helper functions into the main AST tests file

* Not passing o

* Add node type check to AST location data tests
2018-09-17 10:40:37 -07:00