compound assignment
This commit is contained in:
@@ -84,6 +84,9 @@ Expr_Kind :: enum u8 {
|
||||
Negate,
|
||||
Not,
|
||||
Add,
|
||||
Sub,
|
||||
Mul,
|
||||
Div,
|
||||
Eq,
|
||||
Ne,
|
||||
Lt,
|
||||
@@ -126,6 +129,14 @@ Stmt_Kind :: enum u8 {
|
||||
For,
|
||||
}
|
||||
|
||||
Assignment_Op :: enum u8 {
|
||||
Set,
|
||||
Add,
|
||||
Sub,
|
||||
Mul,
|
||||
Div,
|
||||
}
|
||||
|
||||
Stmt :: struct {
|
||||
kind: Stmt_Kind,
|
||||
span: source.Span,
|
||||
@@ -134,6 +145,10 @@ Stmt :: struct {
|
||||
type: Type_Syntax,
|
||||
immutable: bool,
|
||||
pointer_capture: bool,
|
||||
// Assignments store the lvalue in `target`, the right-hand side in `expr`,
|
||||
// and the source operator in `assignment_op`. `Set` is ordinary `=`;
|
||||
// the arithmetic variants are `+=`, `-=`, `*=`, and `/=`.
|
||||
assignment_op: Assignment_Op,
|
||||
target: Expr_Id,
|
||||
expr: Expr_Id,
|
||||
// `If` statements use `expr` as the condition, `captures` as optional
|
||||
|
||||
Reference in New Issue
Block a user