diff --git a/docs/v2/annotated-source/nodes.html b/docs/v2/annotated-source/nodes.html index cf60b5e1..ee70c642 100644 --- a/docs/v2/annotated-source/nodes.html +++ b/docs/v2/annotated-source/nodes.html @@ -1928,7 +1928,11 @@ or vanilla.

exports.Value = class Value extends Base
   constructor: (base, props, tag, isDefaultValue = no) ->
     super()
-    return base if not props and base instanceof Value
+ return base if not props and base instanceof Value + @base = base + @properties = props or [] + @[tag] = yes if tag + @isDefaultValue = isDefaultValue @@ -1939,28 +1943,6 @@ or vanilla.

-

When Parens block includes a StatementLiteral (e.g. (b; break) for a in arr), -it won’t compile since Parens ((b; break)) is compiled as Value and -pure statement (break) can’t be used in an expression. -For this reasons, we return Block instead of Parens.

- - - -
    return base.unwrap() if base instanceof Parens and base.contains (n) -> n instanceof StatementLiteral
-    @base           = base
-    @properties     = props or []
-    @[tag]          = yes if tag
-    @isDefaultValue = isDefaultValue
- - - - -
  • -
    - -
    - -

    If this is a @foo = assignment, if there are comments on @ move them to be on foo.

    @@ -1974,11 +1956,11 @@ to be on foo.

  • -
  • +
  • - +

    Add a property (or properties ) Access to the list.

    @@ -1998,11 +1980,11 @@ to be on foo.

  • -
  • +
  • - +

    Some boolean checks for the benefit of other nodes.

    @@ -2050,11 +2032,11 @@ to be on foo.

  • -
  • +
  • - +

    The value can be unwrapped as its inner node, if there are no attached properties.

    @@ -2067,11 +2049,11 @@ properties.

  • -
  • +
  • - +

    A reference has base part (this value) and name part. We cache them separately for compiling complex expressions. @@ -2097,11 +2079,11 @@ We cache them separately for compiling complex expressions.

  • -
  • +
  • - +

    We compile a value to JavaScript by compiling and joining each property. Things get much more interesting if the chain of properties has soak @@ -2118,11 +2100,11 @@ evaluate anything twice when building the soak chain.

  • -
  • +
  • - +

    Cached fragments enable correct order of the compilation, and reuse of variables in the scope. @@ -2146,11 +2128,11 @@ Example:

  • -
  • +
  • - +

    Unfold a soak into an If: a?.b -> a.b if a?

    @@ -2184,11 +2166,11 @@ Example:
  • -
  • +
  • - +

    HereComment

    @@ -2197,11 +2179,11 @@ Example:
  • -
  • +
  • - +

    Comment delimited by ### (becoming /* */).

    @@ -2219,11 +2201,11 @@ Example:
  • -
  • +
  • - +

    Unindent multiline comments. They will be reindented later.

    @@ -2246,11 +2228,11 @@ Example:
  • -
  • +
  • - +

    Don’t rely on fragment.type, which can break when the compiler is minified.

    @@ -2262,11 +2244,11 @@ Example:
  • -
  • +
  • - +

    LineComment

    @@ -2275,11 +2257,11 @@ Example:
  • -
  • +
  • - +

    Comment running from # to the end of a line (becoming //).

    @@ -2298,11 +2280,11 @@ Example:
  • -
  • +
  • - +

    Don’t rely on fragment.type, which can break when the compiler is minified.

    @@ -2314,11 +2296,11 @@ Example:
  • -
  • +
  • - +

    Call

    @@ -2327,11 +2309,11 @@ Example:
  • -
  • +
  • - +

    Node for a function invocation.

    @@ -2350,11 +2332,11 @@ Example:
  • -
  • +
  • - +

    @variable never gets output as a result of this node getting created as part of RegexWithInterpolations, so for that case move any comments to @@ -2371,11 +2353,11 @@ the grammar.

  • -
  • +
  • - +

    When setting the location, we sometimes need to update the start location to account for a newly-discovered new operator to the left of us. This @@ -2398,11 +2380,11 @@ expands the range on the left, but not the right.

  • -
  • +
  • - +

    Tag this invocation as creating a new instance.

    @@ -2420,11 +2402,11 @@ expands the range on the left, but not the right.

  • -
  • +
  • - +

    Soaked chained invocations unfold into if/else ternary structures.

    @@ -2465,11 +2447,11 @@ expands the range on the left, but not the right.

  • -
  • +
  • - +

    Compile a vanilla function call.

    @@ -2483,11 +2465,11 @@ expands the range on the left, but not the right.

  • -
  • +
  • - +

    If variable is Accessor fragments are cached and used later in Value::compileNode to ensure correct order of the compilation, @@ -2531,11 +2513,11 @@ Example:

  • -
  • +
  • - +

    Catch invalid CSX attributes:

    @@ -2559,11 +2541,11 @@ Example:
  • -
  • +
  • - +

    Super

    @@ -2572,11 +2554,11 @@ Example:
  • -
  • +
  • - +

    Takes care of converting super() calls into calls against the prototype’s function of the same name. @@ -2603,11 +2585,11 @@ expression.

  • -
  • +
  • - +

    If we might be in an expression we need to cache and return the result

    @@ -2641,11 +2623,11 @@ exports.Super = class
  • -
  • +
  • - +

    A super() call gets compiled to e.g. super.method(), which means the method property name gets compiled for the first time here, and @@ -2668,11 +2650,11 @@ that they’re there for the later compilation.

  • -
  • +
  • - +

    RegexWithInterpolations

    @@ -2681,11 +2663,11 @@ that they’re there for the later compilation.

  • -
  • +
  • - +

    Regexes with interpolations are in fact just a variation of a Call (a RegExp() call to be precise) with a StringWithInterpolations inside.

    @@ -2699,11 +2681,11 @@ that they’re there for the later compilation.

  • -
  • +
  • - +

    TaggedTemplateCall

    @@ -2721,11 +2703,11 @@ exports.TaggedTemplateCall = -
  • +
  • - +

    Extends

    @@ -2734,11 +2716,11 @@ exports.TaggedTemplateCall = -
  • +
  • - +

    Node to extend an object’s prototype with an ancestor object. After goog.inherits from the @@ -2755,11 +2737,11 @@ After goog.inherits from the

  • -
  • +
  • - +

    Hooks one constructor into another’s prototype chain.

    @@ -2771,11 +2753,11 @@ After goog.inherits from the
  • -
  • +
  • - +

    Access

    @@ -2784,11 +2766,11 @@ After goog.inherits from the
  • -
  • +
  • - +

    A . access into a property of a value, or the :: shorthand for an access into the object’s prototype.

    @@ -2815,11 +2797,11 @@ an access into the object’s prototype.

  • -
  • +
  • - +

    Index

    @@ -2828,11 +2810,11 @@ an access into the object’s prototype.

  • -
  • +
  • - +

    A [ ... ] indexed access into an array or object.

    @@ -2853,11 +2835,11 @@ an access into the object’s prototype.

  • -
  • +
  • - +

    Range

    @@ -2866,11 +2848,11 @@ an access into the object’s prototype.

  • -
  • +
  • - +

    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 @@ -2891,11 +2873,11 @@ corresponding array of integers at runtime.

  • -
  • +
  • - +

    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.

    @@ -2915,11 +2897,11 @@ But only if they need to be cached to avoid double evaluation.

  • -
  • +
  • - +

    When compiled normally, the range returns the contents of the for loop needed to iterate over the values in the range. Used by comprehensions.

    @@ -2933,11 +2915,11 @@ needed to iterate over the values in the range. Used by comprehensions.

  • -
  • +
  • - +

    Set up endpoints.

    @@ -2959,11 +2941,11 @@ needed to iterate over the values in the range. Used by comprehensions.

  • -
  • +
  • - +

    Generate the condition.

    @@ -2974,11 +2956,11 @@ needed to iterate over the values in the range. Used by comprehensions.

  • -
  • +
  • - +

    Always check if the step isn’t zero to avoid the infinite loop.

    @@ -2989,12 +2971,15 @@ needed to iterate over the values in the range. Used by comprehensions.

    lowerBound = "#{lt} #{ if known then to else @toVar }" upperBound = "#{gt} #{ if known then to else @toVar }" condPart = - if @step? - "#{stepNotZero} && (#{stepCond} ? #{lowerBound} : #{upperBound})" - else - if known - "#{ if from <= to then lt else gt } #{to}" - else + if @step? + if @stepNum? and @stepNum isnt 0 + if @stepNum > 0 then "#{lowerBound}" else "#{upperBound}" + else + "#{stepNotZero} && (#{stepCond} ? #{lowerBound} : #{upperBound})" + else + if known + "#{ if from <= to then lt else gt } #{to}" + else "(#{@fromVar} <= #{@toVar} ? #{lowerBound} : #{upperBound})" cond = if @stepVar then "#{@stepVar} > 0" else "#{@fromVar} <= #{@toVar}"
    @@ -3002,11 +2987,11 @@ needed to iterate over the values in the range. Used by comprehensions.

  • -
  • +
  • - +

    Generate the step.

    @@ -3031,11 +3016,11 @@ needed to iterate over the values in the range. Used by comprehensions.

  • -
  • +
  • - +

    The final loop body.

    @@ -3046,11 +3031,11 @@ needed to iterate over the values in the range. Used by comprehensions.

  • -
  • +
  • - +

    When used as a value, expand the range into the equivalent array.

    @@ -3081,11 +3066,11 @@ needed to iterate over the values in the range. Used by comprehensions.

  • -
  • +
  • - +

    Slice

    @@ -3094,11 +3079,11 @@ needed to iterate over the values in the range. Used by comprehensions.

  • -
  • +
  • - +

    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 @@ -3116,11 +3101,11 @@ is the index of the beginning.

  • -
  • +
  • - +

    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. @@ -3134,11 +3119,11 @@ is the index of the beginning.

  • -
  • +
  • - +

    Handle an expression in the property access, e.g. a[!b in c..].

    @@ -3165,11 +3150,11 @@ is the index of the beginning.

  • -
  • +
  • - +

    Obj

    @@ -3178,11 +3163,11 @@ is the index of the beginning.

  • -
  • +
  • - +

    An object literal, nothing fancy.

    @@ -3202,11 +3187,11 @@ is the index of the beginning.

  • -
  • +
  • - +

    Check for reserved words.

    @@ -3227,11 +3212,11 @@ is the index of the beginning.

  • -
  • +
  • - +

    Check if object contains splat.

    @@ -3250,11 +3235,11 @@ is the index of the beginning.

  • -
  • +
  • - +

    Object spread properties. https://github.com/tc39/proposal-object-rest-spread/blob/master/Spread.md

    @@ -3268,11 +3253,11 @@ is the index of the beginning.

  • -
  • +
  • - +

    CSX attributes

    @@ -3283,11 +3268,11 @@ is the index of the beginning.

  • -
  • +
  • - +

    If this object is the left-hand side of an assignment, all its children are too.

    @@ -3342,11 +3327,11 @@ are too.

  • -
  • +
  • - +

    { [foo()] } output as { [ref = foo()]: ref }.

    @@ -3361,11 +3346,11 @@ are too.

  • -
  • +
  • - +

    { [expression] } output as { [expression]: expression }.

    @@ -3394,11 +3379,11 @@ are too.

  • -
  • +
  • - +

    Object spread properties. https://github.com/tc39/proposal-object-rest-spread/blob/master/Spread.md obj2 = {a: 1, obj..., c: 3, d: 4}obj2 = _extends({}, {a: 1}, obj, {c: 3, d: 4})

    @@ -3411,11 +3396,11 @@ are too.

  • -
  • +
  • - +

    Store object spreads.

    @@ -3454,11 +3439,11 @@ are too.

  • -
  • +
  • - +

    Arr

    @@ -3467,11 +3452,11 @@ are too.

  • -
  • +
  • - +

    An array literal.

    @@ -3507,11 +3492,11 @@ are too.

  • -
  • +
  • - +

    Detect if Elisions at the beginning of the array are processed (e.g. [, , , a]).

    @@ -3526,11 +3511,11 @@ are too.

  • -
  • +
  • - +

    Let compileCommentFragments know to intersperse block comments into the fragments created when compiling this array.

    @@ -3544,11 +3529,11 @@ into the fragments created when compiling this array.

  • -
  • +
  • - +

    If this array is the left-hand side of an assignment, all its children are too.

    @@ -3564,11 +3549,11 @@ are too.

  • -
  • +
  • - +

    If compiledObjs includes newlines, we will output this as a multiline array (i.e. with a newline and indentation after the [). If an element @@ -3591,11 +3576,11 @@ first element’s line comments get output before or after the array.

  • -
  • +
  • - +

    Add ‘, ‘ if all Elisions from the beginning of the array are processed (e.g. [, , , a]) and element isn’t Elision or last element is Elision (e.g. [a,,b,,])

    @@ -3633,11 +3618,11 @@ element isn’t Elision or last element is Elision (e.
  • -
  • +
  • - +

    Class

    @@ -3646,11 +3631,11 @@ element isn’t Elision or last element is Elision (e.
  • -
  • +
  • - +

    The CoffeeScript class definition. Initialize a Class with its name, an optional superclass, and a body.

    @@ -3671,11 +3656,11 @@ exports.Class = class
  • -
  • +
  • - +

    Special handling to allow class expr.A extends A declarations

    @@ -3693,11 +3678,11 @@ exports.Class = class
  • -
  • +
  • - +

    Anonymous classes are only valid in expressions

    @@ -3746,11 +3731,11 @@ exports.Class = class
  • -
  • +
  • - +

    Figure out the appropriate name for this class

    @@ -3821,11 +3806,11 @@ exports.Class = class
  • -
  • +
  • - +

    Add an expression to the class initializer

    This is the key method for determining whether an expression in a class @@ -3854,11 +3839,11 @@ opposed to the Object.defineProperty method).

  • -
  • +
  • - +

    Checks if the given node is a valid ES class initializer method.

    @@ -3872,11 +3857,11 @@ opposed to the Object.defineProperty method).

  • -
  • +
  • - +

    Returns a configured class initializer method

    @@ -3973,11 +3958,11 @@ exports.ExecutableClassBody = +
  • - +

    Traverse the class’s children and: