jashkenas--coffeescript/test
Gregory Huczynski 78e1f43b24 CS1 tagged template literals (and CS2 interpolated strings as template literals) (#4352)
* Add initial support for template literals with no
interpolation

* Change ‘unexpected string’ error message tests to
use number not identifier prefix.

Identifer prefixes are now valid as tagged
template literals

* Test tagged template literals for non-interpolated
strings and tag function.

* Tagged template literals work for pure Strings.

Pull tagged template definition up to Invocation
level in grammar, enabling chained invocation calls.

We can view a tagged template is a special form
of function call.

* Readying for StringWithInterpolations work.

* Tweaks.

* Fix style

* Pass StringWithInterpolations parameter straight
into Call constructor.

StringWithInterpolations will be output as
template literal, so already in correct form for
outputting tagged template literal.

* Strip down compileNode for StringWithInterpolations

* Done StringLiteral case for interpolated Strings

* Remove need for TemplateLiteral

* Simplify code.

* Small code tidy

* Interpolated strings now outputting as template literals.

Still needs comprehensive testing.

* Move error message tests into error_messages.coffee; remove test that is testing for a Node runtime error

* Split up tests that were testing multiple things per test, so that each test tests only one thing

* Edge cases: tagged template literals containing interpolated strings or even internal tagged template literals

* Make more concise, more idiomatic style

* Pull back extreme indentation

* Restore and fix commented-out tests

* Edge case: tagged template literal with empty string

* Only use new ES2015 interpolated string syntax if we’re inside a tagged template literal; this keeps this PR safe to merge into CoffeeScript 1.x. Remove the code from this commit to make all interpolated strings use ES2015 syntax, for CoffeeScript 2.

* Compiler now _doesn’t_ use template literals.

* Expand tagged template literal tests

* Move ‘Unexpected string’ error message tests into
tagged template literal section.

‘Unexpected string’ is not reported in these test
scenarios anymore. Instead, we error that the
prefixing literal is not a function.

* Don’t unwrap StringWithInterpolations.

Saw bug with program consisting of “#{2}” not
compiling with template literals. Root cause was
that Block.compileNode was unwrapping interpolated
string and so didn’t use compileNode logic at
StringWithInterpolations level.

* No need to bracket interpolated strings any more.

When interpolated string looks like `hello ${2}`,
no extract brackets are needed, as the `s mark the
beginning and end.

* Show html templating with tagged template literals

* Multiline should match multiline

* Comment out unnecessary `unwrap`, which is only needed for CoffeeScript 2 all-ES2015 syntax output
2016-11-18 10:25:03 -08:00
..
importing renaming import test files to avoid risking the disfavor of .gitignore 2013-06-02 10:57:18 +04:00
arrays.coffee Add a `for .. from ..` loop for generators, see #4306, #3832 (#4355) 2016-11-07 23:40:01 -08:00
assignment.coffee Implement ES2015-like destructuring defaults 2015-08-27 22:16:13 +02:00
booleans.coffee renaming wordy test titles. 2011-04-23 13:35:15 -04:00
classes.coffee Fix `isLiteralArguments` 2016-09-26 15:33:44 +02:00
cluster.coffee Fixes #2737, fix fork() for both .js and .coffee, revised. 2013-03-18 11:46:54 +08:00
comments.coffee allow multiline comment inside of an object definition [Fixes #3761] 2015-02-10 23:35:39 -05:00
compilation.coffee Add a `for .. from ..` loop for generators, see #4306, #3832 (#4355) 2016-11-07 23:40:01 -08:00
comprehensions.coffee Fix #3778: Make for loops more consistent 2015-02-03 19:05:07 +01:00
control_flow.coffee Improve naming of generated 'i-variables' 2016-06-10 08:58:18 +02:00
error_messages.coffee CS1 tagged template literals (and CS2 interpolated strings as template literals) (#4352) 2016-11-18 10:25:03 -08:00
eval.coffee Fix issue #3498 2015-01-05 15:40:04 -05:00
exception_handling.coffee #2900 -- parameter-less catch clause. 2013-04-12 17:50:45 +02:00
formatting.coffee Fixes chaining after inline implicit objects 2014-01-26 22:11:10 +00:00
function_invocation.coffee Fix #3935: Implicit calls + obj key interpolation 2015-05-01 12:02:03 +02:00
functions.coffee Refactor `Literal` into several subtypes 2016-03-05 17:08:11 +01:00
generators.coffee Add a `for .. from ..` loop for generators, see #4306, #3832 (#4355) 2016-11-07 23:40:01 -08:00
helpers.coffee Replace `last array` helper with `[..., last] = array` 2015-02-07 21:50:41 +01:00
importing.coffee renaming import test files to avoid risking the disfavor of .gitignore 2013-06-02 10:57:18 +04:00
interpolation.coffee Fix #3795: Never generate invalid strings and regexes 2015-02-05 17:23:03 +01:00
javascript_literals.coffee finished reorganizing test suite 2011-01-03 04:17:00 -05:00
literate.litcoffee Fixes tabbed code test in literate 2013-05-15 10:30:20 +01:00
location.coffee Include generated } tokens when fixing closing token positions 2016-10-30 21:39:54 -07:00
modules.coffee Resolve conflicts with `2` branch 2016-10-26 09:05:35 -07:00
numbers.coffee Treat Infinity and NaN as reserved words 2016-03-06 11:41:48 +01:00
objects.coffee Fix shorthands after interpolated key in objects 2016-09-29 19:02:00 +02:00
operators.coffee Treat Infinity and NaN as reserved words 2016-03-06 11:41:48 +01:00
option_parser.coffee OptionParser and related tests needed a cleanup 2012-01-25 19:47:03 -05:00
parser.coffee Define proper operator precedence for bitwise/logical operators 2016-10-09 14:45:25 -07:00
ranges.coffee Add a `for .. from ..` loop for generators, see #4306, #3832 (#4355) 2016-11-07 23:40:01 -08:00
regexps.coffee Fix #3795: Never generate invalid strings and regexes 2015-02-05 17:23:03 +01:00
repl.coffee strip \r (if present) before final \n 2016-10-02 15:17:54 -04:00
scope.coffee Add a `for .. from ..` loop for generators, see #4306, #3832 (#4355) 2016-11-07 23:40:01 -08:00
slicing_and_splicing.coffee Fix #2953. Method calls on splice endpoints 2013-04-23 05:42:37 +02:00
soaks.coffee added descriptions to tests which only had Issue numbers 2015-02-23 16:39:05 -07:00
sourcemap.coffee Fix failing source map tests 2016-06-02 09:04:58 +02:00
strict.coffee Fix compiler crash with renamed destrucured params with defaults 2015-09-27 15:54:44 +02:00
strings.coffee Fix indentation-stripping in `"""` strings 2016-09-26 17:14:31 +02:00
tagged_template_literals.coffee CS1 tagged template literals (and CS2 interpolated strings as template literals) (#4352) 2016-11-18 10:25:03 -08:00
test.html Support import and export of ES2015 modules (#4300) 2016-09-14 20:46:05 +02:00