Commit Graph

26 Commits

Author SHA1 Message Date
zdenko 555c22af58 fix #4580 (#4793) 2017-11-20 09:15:19 -08:00
Julian Rosse 0619a7a76c Fix #4579: postfix for in object literals (#4581)
* postfix for on first line of implicit object

* issue numbers

* handle until and while similarly
2017-06-20 21:50:50 -07:00
Julian Rosse 5e90b224c2 Fix #4564: indent closes implicit object (#4570)
* indent closes implicit object [Fixes #4564]

* add test for just implicit object

* remove stray lib file
2017-06-15 09:07:36 -07:00
Julian Rosse 63b109a4f5 Fix #4544: postfix conditional on first line of implicit object (#4554)
* support postfix conditional on first line of implicit object

* cleanup cleanup

* also fixes #2051, added test
2017-05-29 17:29:45 -07:00
Geoffrey Booth 2f9ab1d328 [CS2] `return` and `export default` can now accept implicit objects (#4532)
* Start with the test I want to pass: return an implicit (braces-less) object

* Update Rewriter class to follow pattern of nodes.coffee; move debugging snippet to where it’ll work in CS2

* Allow export default implicit object

* `return` assumes a continuation onto the next line *if* the next line is indented

* Fix comment; improve test
2017-05-01 19:26:24 -07:00
Simon Lydell 46841d916d Fix shorthands after interpolated key in objects
Fixes #4324.
2016-09-29 19:02:00 +02:00
Simon Lydell 76c076db55 Fix #3597: Allow interpolations in object keys
The following is now allowed:

    o =
      a: 1
      b: 2
      "#{'c'}": 3
      "#{'d'}": 4
      e: 5
      "#{'f'}": 6
      g: 7

It compiles to:

    o = (
      obj = {
        a: 1,
        b: 2
      },
      obj["" + 'c'] = 3,
      obj["" + 'd'] = 4,
      obj.e = 5,
      obj["" + 'f'] = 6,
      obj.g = 7,
      obj
    );

- Closes #3039. Empty interpolations in object keys are now _supposed_ to be
  allowed.
- Closes #1131. No need to improve error messages for attempted key
  interpolation anymore.
- Implementing this required fixing the following bug: `("" + a): 1` used to
  error out on the colon, saying "unexpected colon". But really, it is the
  attempted object key that is unexpected. Now the error is on the opening
  parenthesis instead.
- However, the above fix broke some error message tests for regexes. The easiest
  way to fix this was to make a seemingly unrelated change: The error messages
  for unexpected identifiers, numbers, strings and regexes now say for example
  'unexpected string' instead of 'unexpected """some #{really long} string"""'.
  In other words, the tag _name_ is used instead of the tag _value_.
  This was way easier to implement, and is more helpful to the user. Using the
  tag value is good for operators, reserved words and the like, but not for
  tokens which can contain any text. For example, 'unexpected identifier' is
  better than 'unexpected expected' (if a variable called 'expected' was used
  erraneously).
- While writing tests for the above point I found a few minor bugs with string
  locations which have been fixed.
2015-02-09 17:32:37 +01:00
xixixao c2727d964c Fix for declarations in object literals 2014-01-26 04:41:30 +00:00
xixixao 8b976acac1 Fixes #1871, close implicit objects in implicit returns 2014-01-23 23:12:12 +00:00
Michael Ficarra 21db08a23d add missing implicit object literal test
ref michaelficarra/CoffeeScriptRedux#266 and 670a1f5f78 (diff-2)
2014-01-12 11:16:27 -06:00
Troels Nielsen 37a6ea63b1 #2757, Allow non-significant commas at end of nested implicit objects 2013-03-04 12:55:15 +01:00
Troels Nielsen 1666716c31 Improve the handling of implicit object and implicit call combinations
by handling them together.
2013-02-27 08:15:38 +01:00
Jeremy Ashkenas 6bcc798a76 Fixes #2207 -- unambiguous immediate implicit closes don't close implicit objects 2012-04-25 14:14:00 -04:00
Michael Ficarra 28a1101b91 merging/improving @rolftimmermans fix/tests for #2007 2012-02-13 19:47:21 -05:00
Michael Ficarra 8248601b72 Merge branch 'object_literals_in_compr' of https://github.com/rolftimmermans/coffee-script into rolftimmermans-object_literals_in_compr
Conflicts:
	test/objects.coffee
2012-02-13 19:41:47 -05:00
clutchski 0ca255b7b8 Whitespace clean-up. 2012-02-03 19:31:26 -05:00
Rolf Timmermans 64b0e50609 Fix error that prevented object literals from being properly returned from comprehensions. 2012-01-09 09:08:58 +01:00
Jeremy Ashkenas 62a331a3dc Fixes #1961, Fixes #1974, compound assignments to an implicit object. 2011-12-26 09:45:48 -08:00
Michael Ficarra 46b34d4b43 whitespace cleanup 2011-12-24 07:04:34 -05:00
Jeremy Ashkenas 510fb59e29 Fixes #1871, allows single-line implicit ends to close implicit objects. 2011-12-15 15:43:38 -05:00
Jeremy Ashkenas af0ee70ea3 Fixes #1903 2011-12-15 12:29:03 -05:00
Gerald Lewis f3253f4f5c tests for #1513 2011-08-15 11:06:53 -04:00
satyr 9b9612e09c fixed #1322; block comments no longer get out of implicitly called implicit objects 2011-07-27 18:49:48 +09:00
Michael Ficarra f433fa4187 improved test for #1436 2011-07-06 22:15:35 -04:00
Jann Horn caa3d1ab5d added a test for #1436, `for` etc. should work as normal property names 2011-07-06 22:15:34 -04:00
Jeremy Ashkenas 19849e66d4 renaming wordy test titles. 2011-04-23 13:35:15 -04:00