Auto-close INDENT to support syntax like this:
el.click((event) ->
@@ -1326,11 +1377,11 @@ Token Manipulators
-
+
Helpers
@@ -1339,11 +1390,11 @@
Helpers
-
+
@@ -1351,11 +1402,11 @@ Helpers
-
+
Returns the line and column number from an offset into the current chunk.
offset
is a number of characters into @chunk.
@@ -1385,11 +1436,11 @@
Helpers
-
+
Same as “token”, exception this just returns the token without adding it
to the results.
@@ -1404,11 +1455,11 @@
Helpers
-
+
Use length - 1 for the final offset - we’re supplying the last_line and the last_column,
so if last_column == first_column, then we’re looking at a character of length 1.
@@ -1426,11 +1477,11 @@
Helpers
-
+
Add a token to the results.
offset
is the offset into the current @chunk where the token starts.
@@ -1449,11 +1500,11 @@
Helpers
-
+
Peek at the last tag in the token stream.
@@ -1466,11 +1517,11 @@
Helpers
-
+
Peek at the last value in the token stream.
@@ -1483,11 +1534,11 @@
Helpers
-
+
Are we in the midst of an unfinished expression?
@@ -1496,7 +1547,8 @@
Helpers
unfinished: ->
LINE_CONTINUER.test(@chunk) or
@tag() in ['\\', '.', '?.', '?::', 'UNARY', 'MATH', 'UNARY_MATH', '+', '-',
- '**', 'SHIFT', 'RELATION', 'COMPARE', 'LOGIC', 'THROW', 'EXTENDS']
+ '**', 'SHIFT', 'RELATION', 'COMPARE', '&', '^', '|', '&&', '||',
+ 'BIN?', 'THROW', 'EXTENDS']
formatString: (str) ->
str.replace STRING_OMIT, '$1'
@@ -1507,11 +1559,11 @@ Helpers
-
+
Validates escapes in strings and regexes.
@@ -1535,11 +1587,11 @@
Helpers
-
+
Constructs a string or regex by escaping certain characters.
@@ -1559,11 +1611,11 @@
Helpers
-
+
Ignore escaped backslashes.
@@ -1582,11 +1634,11 @@
Helpers
-
+
Throws an error at either a given offset from the current chunk or at the
location of a token (token[2]
).
@@ -1605,11 +1657,11 @@
Helpers
-
+
Helper functions
@@ -1618,11 +1670,11 @@
Helper functions
-
+
@@ -1643,11 +1695,11 @@ Helper functions
-
+
Constants
@@ -1656,11 +1708,11 @@
Constants
-
+
@@ -1668,11 +1720,11 @@ Constants
-
+
Keywords that CoffeeScript shares in common with JavaScript.
@@ -1690,11 +1742,11 @@
Constants
-
+
CoffeeScript-only keywords.
@@ -1722,11 +1774,11 @@
Constants
-
+
The list of keywords that are reserved by JavaScript, but not used, or are
used by CoffeeScript internally. We throw an error when these are encountered,
@@ -1745,11 +1797,11 @@
Constants
-
+
The superset of both JavaScript keywords and reserved words, none of which may
be used as identifiers or properties.
@@ -1761,11 +1813,11 @@
Constants
-
+
The character code of the nasty Microsoft madness otherwise known as the BOM.
@@ -1776,11 +1828,11 @@
Constants
-
+
Token matching regexes.
@@ -1817,16 +1869,17 @@
Constants
MULTI_DENT =
/^(?:\n[^\n\S]*)+/
-JSTOKEN =
/^`[^\\`]*(?:\\.[^\\`]*)*`/
+JSTOKEN = ///^ `(?!``) ((?: [^`\\] | \\[\s\S] )*) ` ///
+HERE_JSTOKEN = ///^ ``` ((?: [^`\\] | \\[\s\S] | `(?!``) )*) ``` ///
-
+
String-matching-regexes.
@@ -1849,11 +1902,11 @@
Constants
-
+
Regex-matching-regexes.
@@ -1887,11 +1940,11 @@
Constants
-
+
Other regexes.
@@ -1918,11 +1971,11 @@
Constants
-
+
Compound assignment tokens.
@@ -1936,11 +1989,11 @@
Constants
-
+
Unary tokens.
@@ -1953,26 +2006,11 @@
Constants
-
-
-
-
-
Logical tokens.
-
-
-
- LOGIC = ['&&', '||', '&', '|', '^']
-
-
-
-
-
+
Bit-shifting tokens.
@@ -1983,11 +2021,11 @@
Constants
-
+
Comparison tokens.
@@ -1998,11 +2036,11 @@
Constants
-
+
Mathematical tokens.
@@ -2013,11 +2051,11 @@
Constants
-
+
Relational tokens that are negatable with not
prefix.
@@ -2028,11 +2066,11 @@
Constants
-
+
Boolean tokens.
@@ -2043,11 +2081,11 @@
Constants
-
+
Tokens which could legitimately be invoked or indexed. An opening
parentheses or bracket following these tokens will be recorded as the start
@@ -2064,11 +2102,11 @@
Constants
-
+
Tokens which a regular expression will never immediately follow (except spaced
CALLABLEs in some cases), but which a division operator can.
@@ -2081,11 +2119,11 @@
Constants
-
+
Tokens that, when immediately preceding a WHEN
, indicate that the WHEN
occurs at the start of a line. We disambiguate these from trailing whens to
@@ -2098,11 +2136,11 @@
Constants
-
+
Additional indent in front of these is ignored.
diff --git a/docs/v1/annotated-source/nodes.html b/docs/v1/annotated-source/nodes.html
index 5c815d09bd..8d1c78bcc9 100644
--- a/docs/v1/annotated-source/nodes.html
+++ b/docs/v1/annotated-source/nodes.html
@@ -1688,10 +1688,18 @@
RegexWithInterpolations
-
Extends
+
TaggedTemplateCall
+
+exports.TaggedTemplateCall = class TaggedTemplateCall extends Call
+ constructor: (variable, arg, soak) ->
+ arg = new StringWithInterpolations Block.wrap([ new Value arg ]) if arg instanceof StringLiteral
+ super variable, [ arg ], soak
+
+ compileNode: (o) ->
+
@@ -1701,9 +1709,38 @@
Extends
+
Tell StringWithInterpolations
whether to compile as ES2015 or not; will be removed in CoffeeScript 2.
+
+
+
+ o.inTaggedTemplateCall = yes
+ @variable.compileToFragments(o, LEVEL_ACCESS).concat @args[0].compileToFragments(o, LEVEL_LIST)
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1715,11 +1752,11 @@ Extends
-
+
Hooks one constructor into another’s prototype chain.
@@ -1731,11 +1768,11 @@
Extends
-
+
Access
@@ -1744,11 +1781,11 @@
Access
-
+
A .
access into a property of a value, or the ::
shorthand for
an access into the object’s prototype.
@@ -1777,11 +1814,11 @@
Access
-
+
Index
@@ -1790,11 +1827,11 @@
Index
-
+
A [ ... ]
indexed access into an array or object.
@@ -1814,11 +1851,11 @@
Index
-
+
Range
@@ -1827,11 +1864,11 @@
Range
-
+
A range literal. Ranges can be used to extract portions (slices) of arrays,
to specify a range for comprehensions, or as a value, to be expanded into the
@@ -1850,11 +1887,11 @@
Range
-
+
Compiles the range’s source variables – where it starts and where it ends.
But only if they need to be cached to avoid double evaluation.
@@ -1874,11 +1911,11 @@
Range
-
+
When compiled normally, the range returns the contents of the for loop
needed to iterate over the values in the range. Used by comprehensions.
@@ -1892,11 +1929,11 @@
Range
-
+
Set up endpoints.
@@ -1914,11 +1951,11 @@
Range
-
+
Generate the condition.
@@ -1927,8 +1964,8 @@
Range
condPart = if @stepNum?
if @stepNum > 0 then "#{lt} #{@toVar}" else "#{gt} #{@toVar}"
else if known
- [from, to] = [@fromNum, @toNum]
- if from <= to then "#{lt} #{to}" else "#{gt} #{to}"
+ [from, to] = [@fromNum, @toNum]
+ if from <= to then "#{lt} #{to}" else "#{gt} #{to}"
else
cond = if @stepVar then "#{@stepVar} > 0" else "#{@fromVar} <= #{@toVar}"
"#{cond} ? #{lt} #{@toVar} : #{gt} #{@toVar}"
@@ -1936,11 +1973,11 @@
Range
-
+
Generate the step.
@@ -1950,9 +1987,9 @@
Range
"#{idx} += #{@stepVar}"
else if known
if namedIndex
-
if from <= to
then "++#{idx}" else "--#{idx}"
+
if from <= to
then "++#{idx}" else "--#{idx}"
else
-
if from <= to
then "#{idx}++" else "#{idx}--"
+
if from <= to
then "#{idx}++" else "#{idx}--"
else
if namedIndex
"#{cond} ? ++#{idx} : --#{idx}"
@@ -1965,11 +2002,11 @@
Range
-
+
The final loop body.
@@ -1980,11 +2017,11 @@
Range
-
+
When used as a value, expand the range into the equivalent array.
@@ -2015,11 +2052,11 @@
Range
-
+
Slice
@@ -2028,11 +2065,11 @@
Slice
-
+
An array slice literal. Unlike JavaScript’s Array#slice
, the second parameter
specifies the index of the end of the slice, just as the first parameter
@@ -2050,11 +2087,11 @@
Slice
-
+
We have to be careful when trying to slice through the end of the array,
9e9
is used because not all implementations respect undefined
or 1/0
.
@@ -2063,17 +2100,17 @@
Slice
compileNode: (o) ->
- {to, from} = @range
- fromCompiled = from and from.compileToFragments(o, LEVEL_PAREN) or [@makeCode '0']
+ {to, from} = @range
+ fromCompiled = from and from.compileToFragments(o, LEVEL_PAREN) or [@makeCode '0']
-
+
TODO: jwalton - move this into the ‘if’?
@@ -2095,11 +2132,11 @@
Slice
-
+
Obj
@@ -2108,11 +2145,11 @@
Obj
-
+
An object literal, nothing fancy.
@@ -2185,11 +2222,11 @@
Obj
-
+
Arr
@@ -2198,11 +2235,11 @@
Arr
-
+
An array literal.
@@ -2241,11 +2278,11 @@
Arr
-
+
Class
@@ -2254,11 +2291,11 @@
Class
-
+
The CoffeeScript class definition.
Initialize a Class with its name, an optional superclass, and a
@@ -2278,11 +2315,11 @@
Class
-
+
Figure out the appropriate name for the constructor function of this class.
@@ -2306,11 +2343,11 @@
Class
-
+
For all this
-references and bound functions in the class definition,
this
is the Class being constructed.
@@ -2328,11 +2365,11 @@
Class
-
+
Ensure that all functions bound to the instance are proxied in the
constructor.
@@ -2348,11 +2385,11 @@
Class
-
+
Merge the properties from a top-level object as prototypal properties
on the class.
@@ -2391,11 +2428,11 @@
Class
-
+
Walk the body of the class, looking for prototype properties to be converted
and tagging static assignments.
@@ -2419,11 +2456,11 @@
Class
-
+
use strict
(and other directives) must be the first expression statement(s)
of a function body. This method ensures the prologue is correctly positioned
@@ -2441,11 +2478,11 @@
Class
-
+
Make sure that a constructor is defined for the class, and properly
configured.
@@ -2468,11 +2505,11 @@
Class
-
+
Instead of generating the JavaScript string directly, we build up the
equivalent syntax tree and compile that, in pieces. You can see the
@@ -2515,11 +2552,11 @@
Class
-
+
Import and Export
@@ -2591,11 +2628,27 @@
Import and Export
-
+
+
Prevent exporting an anonymous class; all exported members must be named
+
+
+
+ if @clause instanceof Class and not @clause.variable
+ @clause.error 'anonymous classes cannot be exported'
+
+
+
+
+
+
+
+
When the ES2015 class
keyword is supported, don’t add a var
here
@@ -2649,11 +2702,11 @@
Import and Export
-
+
The name of the variable entering the local scope
@@ -2679,11 +2732,11 @@
Import and Export
-
+
Per the spec, symbols can’t be imported multiple times
(e.g. import { foo, foo } from 'lib'
is invalid)
@@ -2707,11 +2760,11 @@
Import and Export
-
+
Assign
@@ -2720,11 +2773,11 @@
Assign
-
+
The Assign is used to assign a local variable to value, or to set the
property of an object – including within object literals.
@@ -2754,11 +2807,11 @@
Assign
-
+
Compile an assignment, delegating to compilePatternMatch
or
compileSplice
if appropriate. Keep track of the name of the base object
@@ -2788,8 +2841,22 @@
Assign
varBase = @variable.unwrapAll()
unless varBase.isAssignable()
@variable.error
"'#{@variable.compile o}' can't be assigned"
-
unless varBase.hasProperties?()
-
if @moduleDeclaration
+
unless varBase.hasProperties?()
+
+
+
+
+
+
+
+
+
moduleDeclaration
can be 'import'
or 'export'
+
+
+
+ if @moduleDeclaration
@checkAssignability o, varBase
o.scope.add varBase.value, @moduleDeclaration
else if @param
@@ -2814,11 +2881,11 @@ Assign
-
+
Brief implementation of recursive pattern matching, when assigning array or
object literals to a value. Peeks at their properties to assign inner names.
@@ -2841,11 +2908,11 @@
Assign
-
+
Pick the property straight off the value when there’s just one to pick
(no need to cache the value into a variable).
@@ -2858,11 +2925,11 @@
Assign
-
+
A regular object pattern-match.
@@ -2881,11 +2948,11 @@
Assign
-
+
A shorthand {a, b, @c} = val
pattern-match.
@@ -2900,11 +2967,11 @@
Assign
-
+
A regular array pattern-match.
@@ -2926,11 +2993,11 @@
Assign
-
+
Make vvar into a simple variable if it isn’t already.
@@ -2972,11 +3039,11 @@
Assign
-
+
A regular object pattern-match.
@@ -2995,11 +3062,11 @@
Assign
-
+
A shorthand {a, b, @c} = val
pattern-match.
@@ -3014,11 +3081,11 @@
Assign
-
+
A regular array pattern-match.
@@ -3040,11 +3107,11 @@
Assign
-
+
When compiling a conditional assignment, take care to ensure that the
operands are only evaluated once, even though we have to reference them
@@ -3058,11 +3125,11 @@
Assign
-
+
Disallow conditional assignment of undefined variables.
@@ -3081,11 +3148,11 @@
Assign
-
+
Convert special math assignment operators like a **= b
to the equivalent
extended form a = a ** b
and then compiles that.
@@ -3099,11 +3166,11 @@
Assign
-
+
Compile the assignment from an array splice literal, using JavaScript’s
Array#splice
method.
@@ -3111,14 +3178,14 @@
Assign
compileSplice: (o) ->
- {range: {from, to, exclusive}} = @variable.properties.pop()
+ {range: {from, to, exclusive}} = @variable.properties.pop()
name = @variable.compile o
- if from
- [fromDecl, fromRef] = @cacheToCodeFragments from.cache o, LEVEL_OP
+ if from
+ [fromDecl, fromRef] = @cacheToCodeFragments from.cache o, LEVEL_OP
else
fromDecl = fromRef = '0'
if to
- if from?.isNumber() and to.isNumber()
+ if from?.isNumber() and to.isNumber()
to = to.compile(o) - fromRef
to += 1 unless exclusive
else
@@ -3133,11 +3200,11 @@ Assign
-
+
Code
@@ -3146,11 +3213,11 @@
Code
-
+
A function definition. This is the only node that creates a new Scope.
When for the purposes of walking the contents of a function body, the Code
@@ -3177,11 +3244,11 @@
Code
-
+
Compilation creates a new scope unless explicitly asked to share with the
outer scope. Handles splat parameters in the parameter list by peeking at
@@ -3199,11 +3266,11 @@
Code
-
+
Handle bound functions early.
@@ -3275,11 +3342,11 @@
Code
-
+
Short-circuit traverseChildren
method to prevent it from crossing scope boundaries
unless crossScope
is true
.
@@ -3292,11 +3359,11 @@
Code
-
+
Param
@@ -3305,11 +3372,11 @@
Param
-
+