Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

internal: remove obsolete nkExprColonExpr detection #808

Merged

Commits on Jul 20, 2023

  1. internal: remove obsolete nkExprColonExpr detection

    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 contain `nkExprColonExpr` nodes
    in `nkTupleConstr` trees, so the detection for them in
    `ccgexprs.genTupleConstr` and `vmgen.genTupleConstr` is obsolete and
    thus removed. Since `jsgen.genTupleConstr` is used for both normal
    procedure-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` or `vmcompilerserdes`:
    - doesn't have `nkExprColonExpr` nodes in `nkBracket` (array
      construction) trees
    - always has `nkExprColonExpr` nodes in `nkObjConstr` trees
    
    Therefore, `ccgexprs.getNullValueAux` (code generation for constant
    object constructions) can depend on the presence of `nkExprColonExpr`
    nodes and `ccgexprs.genConstSimpleList` (code generation for constant
    array constructions) on their absence.
    zerbina committed Jul 20, 2023
    Configuration menu
    Copy the full SHA
    fee5a66 View commit details
    Browse the repository at this point in the history