Commit Graph

27 Commits

Author SHA1 Message Date
Jeremy Ashkenas 3fd004b852 Fixes #3816 -- prettier internal variable names. 2015-01-29 16:24:30 -05:00
Jeremy Ashkenas e0ec8a51e4 CoffeeScript 1.9.0 2015-01-29 12:20:46 -05:00
Simon Lydell 8ab15d7372 Fix #1500, #1574, #3318: Name generated vars uniquely
Any variables generated by CoffeeScript are now made sure to be named to
something not present in the source code being compiled. This way you can no
longer interfere with them, either on purpose or by mistake. (#1500, #1574)

For example, `({a}, _arg) ->` now compiles correctly. (#1574)

As opposed to the somewhat complex implementations discussed in #1500, this
commit takes a very simple approach by saving all used variables names using a
single pass over the token stream. Any generated variables are then made sure
not to exist in that list.

`(@a) -> a` used to be equivalent to `(@a) -> @a`, but now throws a runtime
`ReferenceError` instead (unless `a` exists in an upper scope of course). (#3318)

`(@a) ->` used to compile to `(function(a) { this.a = a; })`. Now it compiles to
`(function(_at_a) { this.a = _at_a; })`. (But you cannot access `_at_a` either,
of course.)

Because of the above, `(@a, a) ->` is now valid; `@a` and `a` are not duplicate
parameters.

Duplicate this-parameters with a reserved word, such as `(@case, @case) ->`,
used to compile but now throws, just like regular duplicate parameters.
2015-01-10 23:25:01 +01:00
Jeremy Ashkenas 81047d45ee CoffeeScript 1.8.0 2014-08-26 12:24:29 -04:00
Michael Ficarra 4ab8503e5a CoffeeScript 1.7.1 2014-01-29 23:19:36 -06:00
xixixao 10293df1f9 Recompile source with 1.7.0 version 2014-01-28 03:34:00 +00:00
Jeremy Ashkenas 84b8b5ccee CoffeeScript 1.6.3 2013-06-02 09:37:45 +04:00
Jeremy Ashkenas 78d10f30a0 removing sourceColumn reset 2013-03-18 21:50:40 +08:00
Jeremy Ashkenas 194baa0bd7 better docs for source maps 2013-03-18 19:46:19 +08:00
Jeremy Ashkenas c8b8beb500 slimming SourceMap slightly further 2013-03-18 19:36:34 +08:00
Jeremy Ashkenas 6786bab2ba Big refactor of SourceMap class. Literate CoffeeScript. Purdy. 2013-03-18 19:23:05 +08:00
Jeremy Ashkenas 566a7dabb2 Fixing erroneous whitespace fix in generated JS 2013-03-18 17:47:55 +08:00
Jeremy Ashkenas a3e8de338a CoffeeScript 1.6.2 2013-03-18 13:06:33 +08:00
Hao-kang Den c24e957f17 use btoa as base64 encoder, inspired by @ashtuchkin 2013-03-18 09:31:12 +08:00
Jason Walton f85d19b459 Rework API for sourcemap filenames and paths. 2013-03-07 21:26:09 -05:00
Jason Walton d6e1a979e4 Fix sourceRoot and relative path for .coffee files in generated source maps. 2013-03-06 11:05:57 -05:00
Jeremy Ashkenas eef83a9fcb CoffeeScript 1.6.1 2013-03-05 11:07:16 +13:00
Jeremy Ashkenas 9f614fedec CoffeeScript 1.6.0 2013-03-05 08:19:08 +13:00
Jason Walton ea86e3e7b1 Optionally allow replacement of existing mappings in SourceMap#addMapping(). 2013-03-01 10:18:37 -05:00
Jason Walton 844549954a Minor API clean up, and make it so sourcemaps are pretty-printed to the .map file. 2013-03-01 10:12:10 -05:00
Jason Walton 0e718f0968 Merge branch 'sourcemaps' of https://github.com/surjikal/coffee-script into sourcemaps 2013-03-01 08:47:42 -05:00
Jason Walton 0d6d479d77 Merge branch 'master' into sourcemaps
Conflicts:
	lib/coffee-script/coffee-script.js
	lib/coffee-script/nodes.js
	src/nodes.coffee
2013-03-01 08:47:16 -05:00
Nicolas Porter 88e02322e5 Fixed key name in source map, added coffee file to map sources
These are the modifications I had to do in order to get source maps working
in 27.0.1425.2 (Official Build 185250) canary. I haven't tested other
browsers.

I first looked at the V3 spec and a few examples, and I saw that the
`source` key of the source map should be called `sources`.

After doing the `source` to `sources` change, the coffee source and for
some odd reason the javascript file would not show up in the browser
dev tools (it was being fetched but not evaluated).

To fix this, I had to add the coffee source to the `sources` list in the
source map file.
2013-03-01 05:58:26 -05:00
Jason Walton 7073d18f23 Add source map support 2013-02-28 15:51:29 -05:00
Jason Walton 923739ebb4 Remove files committed by accident. 2013-01-14 17:10:49 -05:00
Jason Walton a1ba0a89f8 Merge remote-tracking branch 'origin/master'
Conflicts:
	lib/coffee-script/coffee-script.js
	lib/coffee-script/lexer.js
	lib/coffee-script/parser.js
	src/lexer.coffee
2013-01-14 14:26:06 -05:00
Jason Walton df6c497ab0 Clean up TODOs 2012-11-19 17:37:46 -05:00