Skip to content

Commit

Permalink
implement defer statement
Browse files Browse the repository at this point in the history
  • Loading branch information
mattn committed Apr 4, 2018
1 parent 8ba6b1a commit 983b8c5
Show file tree
Hide file tree
Showing 7 changed files with 997 additions and 821 deletions.
2 changes: 2 additions & 0 deletions ast/expr.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ type CallExpr struct {
SubExprs []Expr
VarArg bool
Go bool
Defer bool
}

// AnonCallExpr provide anonymous calling expression. ex: func(){}().
Expand All @@ -113,6 +114,7 @@ type AnonCallExpr struct {
SubExprs []Expr
VarArg bool
Go bool
Defer bool
}

// MemberExpr provide expression to refer member.
Expand Down
6 changes: 6 additions & 0 deletions ast/stmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,9 @@ type GoroutineStmt struct {
StmtImpl
Expr Expr
}

// DeferStmt provide statement of defer.
type DeferStmt struct {
StmtImpl
Expr Expr
}
1 change: 1 addition & 0 deletions parser/lexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ var opName = map[string]int{
"case": CASE,
"default": DEFAULT,
"go": GO,
"defer": DEFER,
"chan": CHAN,
"make": MAKE,
"type": TYPE,
Expand Down
Loading

0 comments on commit 983b8c5

Please sign in to comment.