Skip to content

Semiautovivification with a concat assignment produces an erroneous code #1028

@pepkin88

Description

@pepkin88

Example:

a[]b ++= [1 2]

Result:

a.b || (a.b = []) = (a.b = []).concat([1, 2]);

Expected result:

a.b = (a.b || (a.b = [])).concat([1, 2]);

The current behavior produces a code, which gives a runtime error ReferenceError: Invalid left-hand side in assignment.


The "expected result" block is a result of compiling:
(after merging #1026)

a.b = a[]b ++ [1 2]

which is a simplification of (currently uncompilable):

a[]b = a[]b ++ [1 2]

because the effects of semiautovivification are canceled by an assign.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions