Commit Graph

4748 Commits

Author SHA1 Message Date
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
Geoffrey Booth
13857a5d71 Merge branch 'master' into ast
# Conflicts:
#	Cakefile
#	package-lock.json
#	package.json
2018-09-16 14:00:45 -07:00
Julian Rosse
6225627579 Fix #4609: support new.target (#5106)
* support new.target

* check token type
2018-09-16 13:52:47 -07:00
Geoffrey Booth
c4245e50c2 Babel 7 (#5105)
* Port to Babel 7

Use the Babel 7 @babel/core transpiler, falling back to the older babel-core version if possible.

* Use Babel 7 and preset-env 7 to build the browser compiler and test Babel transpilation

* Update docs for Babel 7
2018-09-09 13:41:49 -07:00
Julian Rosse
6ce1d36acd use exclusive ranges 2018-09-09 00:31:59 -07:00
Julian Rosse
b2669abecc include range in location data 2018-09-09 00:31:59 -07:00
Geoffrey Booth
db86dc4d8b AST tests (#5097)
* fix momentum scrolling on iOS (#5083)

* Revert "fix momentum scrolling on iOS (#5083)" (#5084)

This reverts commit 812571843c.

* AST tests (WIP)

* added tests

* cleanup

new helpers for cleaner code

* more tests

tests are mostly complete now.
also included one for our helper function.

* string quotes

* Update dependencies; disable some babel-minify transforms to work around https://github.com/babel/minify/issues/893 (#5095)

* more tests + refactor

* Remove unused helper function; improve logging output

* Add tests for ImportNamespaceSpecifier, Expansion; cleanup

* CI: Test first before building, so that the tests run on the committed, built files in /lib; the build parts of CI are only a test that the build process succeeds, so we shouldn't be testing the output of the CI build steps
2018-08-18 15:45:31 -07:00
Geoffrey Booth
98b2a69416 Update dependencies; disable some babel-minify transforms to work around https://github.com/babel/minify/issues/893 (#5095) 2018-08-14 08:47:38 -07:00
Julian Rosse
16b4448fe8 Chained do IIFE: use grammar, not rewriter (#5070)
* grammar rules for DO/DO_IIFE

* remove rewriter pass
2018-07-11 22:37:05 -07:00
Julian Rosse
af82c1f41f Preserve aliased operators (#5059)
* pass quote through grammar

* pass through initialChunk/finalChunk

* passing tests

* always unwrap string object

* fixes from code review

* preserve passthrough literals

* cleaner approach

* preserve aliased operators

* normalize

* include guard against preserve-string-literal

* store boolean originalValue

* preserve not in

* invert in

* defer inverting in

* preserve or=

* only wrap when data

* use addTokenData(), unwrap in grammar

* shift more string formatting into nodes

* RegexWithInterpolations wrap Call

* preserve heregexen

* alias guard for imports

* preserve invert operator

* revert Cakefile

* fixes from code review

* isInOperator()
2018-06-19 16:31:46 -07:00
Julian Rosse
3e089ca59d Preserve empty interpolations (#5079)
* pass quote through grammar

* pass through initialChunk/finalChunk

* passing tests

* always unwrap string object

* fixes from code review

* preserve passthrough literals

* cleaner approach

* only wrap when data

* shift more string formatting into nodes

* RegexWithInterpolations wrap Call

* preserve heregexen

* fixes per code review

* fix merge

* fix from code review

* fixes from code review

* passing tests

* fixes from code review

* just define in nodes

* fix from code review

* add comment for toPrimitiveString()

* fix from code review
2018-06-17 15:36:26 -07:00
Geoffrey Booth
7f8b36a8bd Revert "fix momentum scrolling on iOS (#5083)" (#5084)
This reverts commit 812571843c.
2018-06-16 15:35:34 -07:00
Paul Nta
812571843c fix momentum scrolling on iOS (#5083) 2018-06-16 15:32:16 -07:00
Geoffrey Booth
8a25195442 AST flag/API option; generic AST output for all nodes (#5044)
* Add `nodes` option to Node API, that returns POJO representation of AST; starting point for toPlainObject method on node classes to return the serializable plain JavaScript object representation of each node

* Make --nodes also return JSON (pretty-printed, though not colorized)

* Alphabetize CLI flags

* Use new `ast` flag to request AST, restoring prior `nodes` flag; rename toPlainObject to toJSON
2018-06-11 19:50:40 -07:00
Julian Rosse
70f6cb70e2 Allow yield indented object (#5072)
* allow yield indented object

* allow await indented object

* fixes from code review
2018-06-10 21:45:45 -07:00
Geoffrey Booth
be702d67f3 2.3.1 (#5069)
* Update links to use https://coffeescript.org

* 2.3.1 changelog

* Bump version to 2.3.1; update output

* Forgot one

* Another one

* Lock Babel versions for Node 6 build to succeed, until Babel 7 is out
2.3.1
2018-05-21 22:14:34 -07:00
Geoffrey Booth
68302e6da7 Docs headings and changelog refactor (#5067)
* Changelog sub-sections should use h3, not h2; no need for hack anchor tag anymore

* Internationalize dates to user’s locale

* Consistent names

* Split up the changelog into separate files per version; make HTML markup consistent with the other sections in the docs

* Fix sidebar links for introduction and overview
2018-05-20 09:39:53 -07:00
zdenko
0e7677ad62 Fix #5046: Adjacent JSX (#5049)
* Fix #5046: Adjacent JSX

* check CSX only when wrapped in parentheses

* Fix indentation

* Add test for unlikely, but valid, JSX syntax
2018-05-20 09:39:09 -07:00
Geoffrey Booth
7cf739e2b6 Lexer, helpers and comments cleanup (#5063)
* Move the building of the comments hash into its own function, to make clearer that it only happens once

* Abstract token comments dictionary

* Format comments

* Allow attaching a “data” property to tokens, to allow extra info to pass through the parser into the node classes

* Add data to StringLiteral tokens such that we should be able to deindent them in the nodes class

* Update output

* Another comment fix

* Add data to every token, with common properties

* Be more defensive, even though we apparently don't need to be

* Improve comments

* Remove the token data property, leaving all unrelated improvements

* Code review improvements; update output
2018-05-13 16:58:44 -07:00
Julian Rosse
41185ca7ac Normalize :: syntax (#5048)
* normalize :: syntax

* fixes from code review
2018-05-13 12:41:43 -07:00
Julian Rosse
7dbdca8c54 Allow implicit call with class with no body (#5053)
* allow implicit call with class with no body

* more tests
2018-05-13 12:20:09 -07:00
Julian Rosse
8e66ae404e fix JSX expression indentation bug (#5056)
* fix JSX expression indentation bug

* fixes from code review

* tweak test
2018-05-12 18:01:27 -07:00