internal: remove obsolete nkExprColonExpr
detection
#808
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Remove detection of
nkExprColonExpr
nodes in the context of tuple,array, and object construction expressions in the code generators. The
ASTs reaching the code generators are expected to have a specific shape;
violations thereof need to be treated as internal errors and should
not be silently supported.
Details
The AST coming out of
astgen
does not containnkExprColonExpr
nodesin
nkTupleConstr
trees, so the detection for them inccgexprs.genTupleConstr
andvmgen.genTupleConstr
is obsolete andthus removed. Since
jsgen.genTupleConstr
is used for both normalprocedure-level code and constant initializers, it cannot have the
detection removed, as constant initializers do use
nkExprColonExpr
nodes for named tuple constructions (
nkTupleConstr
).In addition, the constant initializer AST that comes out of both
semfold
orvmcompilerserdes
:nkExprColonExpr
nodes innkBracket
(arrayconstruction) trees
nkExprColonExpr
nodes innkObjConstr
treesTherefore,
ccgexprs.getNullValueAux
(code generation for constantobject constructions) can depend on the presence of
nkExprColonExpr
nodes and
ccgexprs.genConstSimpleList
(code generation for constantarray constructions) on their absence.