Commit Graph

4734 Commits

Author SHA1 Message Date
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
Jeremy Ashkenas
7beb631694 Create CNAME 2018-05-03 15:51:03 -07:00
Jeremy Ashkenas
c2792e4840 Delete CNAME 2018-05-03 15:50:54 -07:00
Geoffrey Booth
d82272b6c2 Fix #1832: Browser compiler should run code using globally-scoped eval (#5047)
* Explicitly turn off minify mangling, because it was previously implicitly disabled by the existence of the `eval` call we’re about to remove

* Update babel-core

* Run browser-compiled scripts using window.eval rather than just eval, to use a clean scope (many times faster)

* Update output

* Fix browser-based test broken by #5028

* Update output
2018-05-01 08:11:40 -07:00
Geoffrey Booth
fe7554828a Fix #5034: Adjacent JSX elements must be wrapped in an enclosing tag (#5046) 2018-05-01 08:09:07 -07:00
Geoffrey Booth
708e57586c Fix README ASCII art 2018-04-28 19:03:21 -07:00
Geoffrey Booth
8061ecf0e2 2.3.0 (#5043)
* Move analytics initialization into docs.coffee

* Bump Bootstrap and CodeMirror versions

* Update output

* Merge CodeMirror styles

* Update CodeMirror styles

* Better flexbox layout for docs, including flex auto-sized sidebar and main column

* Minor styling fixes for Edge

* Fix scrollspy for new layout

* Update output

* Clicking on the CoffeeScript logo in the navbar should scroll to top; fix main column width on mobile

* Update output

* 2.3.0 changelog

* Update operators section for **

* Update docs for ES2018 object rest/spread

* Remove references to Node's experimental modules support

* Move the README coffee cup to the right side, so our name isn't cut off on the NPM page; update README and CONTRIBUTING text

* Update dependencies

* Add compatibility note for async generators

* Bump version to 2.3.0 and update output

* Have CI test in Node 10 instead of 9

* Somehow this gets generated slightly differently in Node 10

* Fix #4042: Update broken link
2.3.0
2018-04-28 18:57:15 -07:00
Geoffrey Booth
6df8f5ff17 Remove references to Node's experimental modules support 2018-04-27 10:27:20 -07:00
Geoffrey Booth
776e7e5328 Docs improvements (#5042)
* Move analytics initialization into docs.coffee

* Bump Bootstrap and CodeMirror versions

* Update output

* Merge CodeMirror styles

* Update CodeMirror styles

* Better flexbox layout for docs, including flex auto-sized sidebar and main column

* Minor styling fixes for Edge

* Fix scrollspy for new layout

* Update output

* Clicking on the CoffeeScript logo in the navbar should scroll to top; fix main column width on mobile

* Update output
2018-04-27 10:07:01 -07:00
zdenko
871079b25c Fix #4876: remove polyfill for object rest/spread (#4884)
* object rest/spread

* merge branch 'master' into 'object_rest_spread'

* explore

* Revert "merge branch 'master' into 'object_rest_spread'"

This reverts commit eeeffef55d.

* Revert "explore"

This reverts commit d21cd72aa3.

* split tests

* improvements

* unassignable rest property

* cleanup

* formatting, cleanup

* handle non-final object-destructured splat

* merge with @helixbass's branch
2018-04-23 09:50:42 -07:00
Ruben Bridgewater
be2b24310f Fix: a test relied on faulty behavior (#5028)
`assert.throws` did not test for the error message so far. This
changes it to actually test for the error message.
2018-04-10 09:21:40 -07:00
zdenko
1f9cd4eaf7 Fix #4875: Asynchronous iterators (#4893)
* async iterators

* tests; refactor 'For' grammar rules

* async iterator tests

* formatting
2018-04-08 13:42:54 -07:00
Geoffrey Booth
47c491ffa1 Regular expressions s (dotAll) flag (#4880)
* Support ES2018 regex dotall flag

* Test in Node 9

* Alphabetize regex flags

* Split regex dotall test into its own file, use new feature detection method of loading it

* Update docs to explain compatibility for ES2018 and newer Node features

* Remove unnecessary paragraph
2018-03-30 15:25:41 -07:00
Geoffrey Booth
195a46ab77 Fix #4877: Exponentiation operators (#4881)
* Passthrough exponentiation operator; remove tests that are invalid JavaScript

* Treat **= as a passthrough assignment

* Get tests passing in Node 6

* Improve scoping

* Move exponentiation tests into their own file, now that it's filtered out by Cakefile

* Restore original test
2018-03-30 00:47:40 -07:00
Geoffrey Booth
e5aa758dda 2.2.4 (#5025)
* Update changelog for 2.2.4

* Bump version to 2.2.4; update output
2.2.4
2018-03-29 20:00:45 -07:00