Skip to content

Make type of Assign more specific #21

@keyboardDrummer

Description

@keyboardDrummer

Change

| Assign (targets : List (AstNode StmtExpr)) (value : AstNode StmtExpr)
/-- A variable reference by name. -/
| Identifier (name : Identifier)
/-- Read a field from a target expression. Combined with `Assign` for field writes. -/
| FieldSelect (target : AstNode StmtExpr) (fieldName : Identifier)

into

| Assign (targets : List (AstNode Variable)) (value : AstNode StmtExpr)
| Variable (variable: Variable)

with

inductive Variable where
  | Local (name : Identifier)
  | Field (target : AstNode StmtExpr) (fieldName : Identifier)

and enable multi-target assignment in the Laurel grammar.
Update the assign comment to say that multiple targets only work with identifier targets, and a call as a RHS.

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions