* compile params at LEVEL_PAREN * test
This commit is contained in:
parent
63ffe0aead
commit
ca275c2a1c
|
@ -282,7 +282,7 @@
|
|||
|
||||
// Occasionally it may be useful to make an expression behave as if it was 'hoisted', whereby the
|
||||
// result of the expression is available before its location in the source, but the expression's
|
||||
// variable scope corresponds the source position. This is used extensively to deal with executable
|
||||
// variable scope corresponds to the source position. This is used extensively to deal with executable
|
||||
// class bodies in classes.
|
||||
|
||||
// Calling this method mutates the node, proxying the `compileNode` and `compileToFragments`
|
||||
|
@ -4058,7 +4058,7 @@
|
|||
// (e.g. `ref`), shift those into the parent scope since we can’t put a
|
||||
// `var` line inside a function parameter list.
|
||||
scopeVariablesCount = o.scope.variables.length;
|
||||
signature.push(...param.compileToFragments(o));
|
||||
signature.push(...param.compileToFragments(o, LEVEL_PAREN));
|
||||
if (scopeVariablesCount !== o.scope.variables.length) {
|
||||
generatedVariables = o.scope.variables.splice(scopeVariablesCount);
|
||||
o.scope.parent.variables.push(...generatedVariables);
|
||||
|
|
|
@ -2744,7 +2744,7 @@ exports.Code = class Code extends Base
|
|||
# (e.g. `ref`), shift those into the parent scope since we can’t put a
|
||||
# `var` line inside a function parameter list.
|
||||
scopeVariablesCount = o.scope.variables.length
|
||||
signature.push param.compileToFragments(o)...
|
||||
signature.push param.compileToFragments(o, LEVEL_PAREN)...
|
||||
if scopeVariablesCount isnt o.scope.variables.length
|
||||
generatedVariables = o.scope.variables.splice scopeVariablesCount
|
||||
o.scope.parent.variables.push generatedVariables...
|
||||
|
|
|
@ -493,3 +493,7 @@ test "#4657: destructured array parameters", ->
|
|||
result = f [1, 2, 3, 4]
|
||||
arrayEq result.a, [1, 2, 3]
|
||||
eq result.b, 4
|
||||
|
||||
test "#5128: default parameters of function in binary operation", ->
|
||||
foo = yes or (a, b = {}) -> null
|
||||
eq foo, yes
|
||||
|
|
Loading…
Reference in New Issue