Skip to content

Commit

Permalink
parser: add test _instance/instance5
Browse files Browse the repository at this point in the history
  • Loading branch information
visualfc committed Oct 26, 2023
1 parent df6221e commit 3363ba1
Show file tree
Hide file tree
Showing 2 changed files with 121 additions and 0 deletions.
6 changes: 6 additions & 0 deletions parser/_instance/instance5/cmd.gop
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
var a [2]int
if 0 < a[0] {
println a
println T[int]{1}
println (T[int]){a:1,b:2}
}
115 changes: 115 additions & 0 deletions parser/_instance/instance5/parser.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
package main

file cmd.gop
noEntrypoint
ast.GenDecl:
Tok: var
Specs:
ast.ValueSpec:
Names:
ast.Ident:
Name: a
Type:
ast.ArrayType:
Len:
ast.BasicLit:
Kind: INT
Value: 2
Elt:
ast.Ident:
Name: int
ast.FuncDecl:
Name:
ast.Ident:
Name: main
Type:
ast.FuncType:
Params:
ast.FieldList:
Body:
ast.BlockStmt:
List:
ast.IfStmt:
Cond:
ast.BinaryExpr:
X:
ast.BasicLit:
Kind: INT
Value: 0
Op: <
Y:
ast.IndexExpr:
X:
ast.Ident:
Name: a
Index:
ast.BasicLit:
Kind: INT
Value: 0
Body:
ast.BlockStmt:
List:
ast.ExprStmt:
X:
ast.CallExpr:
Fun:
ast.Ident:
Name: println
Args:
ast.Ident:
Name: a
ast.ExprStmt:
X:
ast.CallExpr:
Fun:
ast.Ident:
Name: println
Args:
ast.CompositeLit:
Type:
ast.IndexExpr:
X:
ast.Ident:
Name: T
Index:
ast.Ident:
Name: int
Elts:
ast.BasicLit:
Kind: INT
Value: 1
ast.ExprStmt:
X:
ast.CallExpr:
Fun:
ast.Ident:
Name: println
Args:
ast.CompositeLit:
Type:
ast.ParenExpr:
X:
ast.IndexExpr:
X:
ast.Ident:
Name: T
Index:
ast.Ident:
Name: int
Elts:
ast.KeyValueExpr:
Key:
ast.Ident:
Name: a
Value:
ast.BasicLit:
Kind: INT
Value: 1
ast.KeyValueExpr:
Key:
ast.Ident:
Name: b
Value:
ast.BasicLit:
Kind: INT
Value: 2

0 comments on commit 3363ba1

Please sign in to comment.