4869 Commits

Author SHA1 Message Date
Julian Rosse
42402da526 Code AST (#5155)
* adding tests

* updated grammar

* tests

* fixes from code review
2019-02-07 11:13:46 -08:00
Julian Rosse
42622b15a9 Switch AST (#5154)
* updated grammar

* ast

* fix merge

* tests

* location data tests

* fix from code review

* SwitchCase

* fix from code review
2019-02-02 13:28:06 -08:00
Julian Rosse
1879af6585 fixes (#5152)
Thank you for fixing this! This all looks great.
2019-01-22 11:32:51 -08:00
Julian Rosse
a7b1fa51e7 Try AST (#5140)
* root ast

* updated grammar

* preserve CoffeeScript.nodes() API

* root ast methods

* try ast

* updated grammar

* updated grammar

* updated grammar

* updated grammar

* finally location data

* remove unused

* updates from code review
2019-01-18 11:57:04 -08:00
Julian Rosse
38c8b2f35f Root AST (#5137)
* root ast

* updated grammar

* preserve CoffeeScript.nodes() API

* root ast methods

* updates from code review

* Style

* Fix a few missing returns

* Expand sourceType explanation

* Simplify

* Refactor Block.astProperties: use expression.astLocationData() to get location data, rather than extracting it from the whole AST object; move all the logic into one function, rather than spreading it out across several functions on the Block class that all appear to be internal

* testing root location data

* Fix location end data for root/File » Program AST node
2019-01-16 13:10:08 -08:00
Julian Rosse
4392d26985 JSX fragment/attribute AST (#5138)
* fragment ast

* attributes ast

* working on attribute classes

* passing tests
2018-11-30 11:30:50 -08:00
Adrian
2f82b75862 implement coffeescript.registerCompiled method (#5130)
* implement coffeescript._addSoucrse method

This method enables an external module to implement caching of
compilation results. When the compiled js source is loaded from cache,
the original coffee code should be added with this method in order to
enable the Error.prepareStackTrace below to correctly adjust the stack
trace for the corresponding file (the source map will be generated on
demand).

* replace _addSource with registerCompiled

* extract the logic from _compileFile into _compileRawFileContent

_compileFile takes care of logging the file and calls _compileRawFileContent

this way an external caching implementation which computes cache key
based on raw content of the sources file, can reuse the logic of
_compileFile and avoid having calling `fs.readFileSync` for the file
more twice in case of cache miss

* remove 'output' argument from registerCompiled
2018-11-28 09:09:06 -08:00
Julian Rosse
459814f58d JSX element AST (#5136)
* existence/throw/expansion ast

* updated grammar

* passing tests

* passing ast tests

* location data tests

* updates from code review

* add comment comments

* CSXElement

* jisonLocationDataToAstLocationData

* remove comment

* Style tweaks
2018-11-27 21:46:09 -08:00
Julian Rosse
088659f893 Existence/Throw/Expansion AST (#5135)
* existence/throw/expansion ast

* Style
2018-11-17 18:02:48 -08:00
Julian Rosse
0e37130f2e Assign AST (#5126)
* updated grammar

* tests

* ObjectProperty

* LHS shorthand with default needs @value

* remove unused Assign @shorthand

* assign ast

* test operator

* Format comment
2018-10-30 15:46:11 -07:00
Julian Rosse
fb539579c3 Object AST (#5124)
* updated grammar

* tests

* ObjectProperty

* LHS shorthand with default needs @value

* remove unused Assign @shorthand

* Format comments, cleanup style
2018-10-29 23:29:28 -07:00
Julian Rosse
7c54532010 Import/export AST (#5123)
* updated grammar

* tests

* Try to be a little clearer that we're assembling objects that we're returning

* explanatory comment
2018-10-22 09:53:11 -07:00
Julian Rosse
5d57ea785c array ast (#5120) 2018-10-15 21:17:45 -07:00
Julian Rosse
94e29c9a95 Range/Slice AST (#5119)
* op ast

* test expected errors

* use new ast methods

* remove unused abstraction

* logical ?

* fix rebase

* follow convention

* fixes from code review

* test helper naming

* always convert new to Call

* new cases

* don't mutate locationData

* updated grammar

* tests

* Rebuild

* always expose generated

* todo for OptionalMemberExpression

* range/slice ast

* Style tweaks
2018-10-15 10:00:14 -07:00
Julian Rosse
fe7377aed5 Call AST (#5117)
* op ast

* test expected errors

* use new ast methods

* remove unused abstraction

* logical ?

* fix rebase

* follow convention

* fixes from code review

* test helper naming

* always convert new to Call

* new cases

* don't mutate locationData

* updated grammar

* tests

* Rebuild

* always expose generated

* todo for OptionalMemberExpression
2018-10-14 19:07:12 -07:00
Julian Rosse
e934a42e75 Op AST (#5109)
* op ast

* test expected errors

* use new ast methods

* remove unused abstraction

* logical ?

* fix rebase

* follow convention

* fixes from code review

* test helper naming

* always convert new to Call

* new cases

* don't mutate locationData
2018-10-08 10:20:27 -07:00
Geoffrey Booth
294bb4754e Fix #5112: A string of ', ' in an array should not be detected as an elision (#5113) 2018-10-05 06:45:54 -07:00
Geoffrey Booth
5eab5f1d22 Merge pull request #5107 from helixbass/value-ast
Value AST
2018-10-01 09:16:38 -07:00
Julian Rosse
8b775c95ad Merge pull request #16 from GeoffreyBooth/value-ast-ast-methods
AST methods
2018-10-01 11:04:32 -04:00
Geoffrey Booth
251700549a Create helper to get the object for a Value AST node, including proper non-AST location data 2018-09-30 23:48:31 -07:00
Geoffrey Booth
3fbf76e135 Fix Parens 2018-09-30 23:16:00 -07:00
Geoffrey Booth
ca04dd6e47 Add helper for merging regular, non-AST location data 2018-09-30 22:55:55 -07:00
Geoffrey Booth
a82f869453 Add more comments, make consistent naming around Value overrides 2018-09-30 22:55:31 -07:00
Julian Rosse
f932206213 super() when properties 2018-09-26 10:49:28 -04:00
Geoffrey Booth
849dd53287 Formatting 2018-09-25 21:37:35 -07:00
Geoffrey Booth
e03a87da04 Improve comments 2018-09-25 21:22:52 -07:00
Geoffrey Booth
29aa9b36fe Refactor AST methods 2018-09-25 21:13:21 -07:00
Julian Rosse
c6472fa617 Merge pull request #15 from GeoffreyBooth/value-ast-revisions-helpers
AST helpers revisions
2018-09-25 22:04:54 -04:00
Julian Rosse
1bbbca6496 comment 2018-09-25 22:03:40 -04:00
Geoffrey Booth
6b1e9bb82b Refactor to use new mergeAstLocationData 2018-09-24 23:43:24 -07:00
Geoffrey Booth
eb22196850 Globalize helpers 2018-09-24 23:32:21 -07:00
Geoffrey Booth
3b1c49240b Fix inspect helper 2018-09-24 23:32:20 -07:00
Geoffrey Booth
ea33c28f1b Refactor our helper for merging AST location data to take two locationData objects and return a new, merged one 2018-09-24 22:00:10 -07:00
Geoffrey Booth
7b251f493d Make error message for location AST paths connect the path to the property we're comparing 2018-09-24 22:00:05 -07:00
Geoffrey Booth
0be8c5d161 Make AST test output browser-safe; improve output for failing tests; have output follow style of eqJS 2018-09-24 21:59:59 -07:00
Geoffrey Booth
617a2d5b65 Don't change style of functions defined with sequential arguments vs options argument; keep the focus of this PR on the AST work, not on unnecessary style changes 2018-09-24 21:59:53 -07:00
Geoffrey Booth
e1625a0d31 We don't need to abstract a new helpers file for just three lines of code, there's more code required to pull this in where it's needed than to just duplicate the two lines of code we need in both places where these 'shared' helpers are currently used 2018-09-24 21:59:44 -07:00
Geoffrey Booth
4c6cc8d060 Merge branch 'ast' of github.com:jashkenas/coffeescript into value-ast
# Conflicts:
#	lib/coffeescript/parser.js
2018-09-20 00:20:30 -07:00
Geoffrey Booth
e6153d9841 Merge branch 'master' of github.com:jashkenas/coffeescript into ast
# Conflicts:
#	lib/coffeescript/parser.js
2018-09-20 00:17:53 -07:00
Geoffrey Booth
6e86b67818 Release 2.3.2 (#5110)
* Bump version to 2.3.2

* 2.3.2 changelog

* Update output for 2.3.2
2.3.2
2018-09-19 23:53:49 -07:00
Geoffrey Booth
b4dceaea67 Fix #5086: Don't generate unnecessary interpolations in JSX tags when the tags contain only here (/* ... */) comments (#5108) 2018-09-18 08:02:41 -07:00
Julian Rosse
d83b95bd39 updated Cakefile 2018-09-17 15:04:04 -04:00
Julian Rosse
4ba1be131c test nested location data 2018-09-17 15:04:04 -04:00
Julian Rosse
8dabec0f9b use Object.assign 2018-09-17 15:04:04 -04:00
Julian Rosse
e679cbccf7 default to forceUpdateLocation 2018-09-17 15:04:04 -04:00
Julian Rosse
b18e91f936 use new ast methods 2018-09-17 15:04:04 -04:00
Julian Rosse
c31a30d3fa test parens 2018-09-17 15:04:04 -04:00
Julian Rosse
99b2578aa7 force update location data in grammar 2018-09-17 15:04:04 -04:00
Julian Rosse
ddfde6810c updated access grammar 2018-09-17 15:04:04 -04:00
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