1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
package ast
import (
"testing"
)
func TestDeclRefExpr(t *testing.T) {
nodes := map[string]Node{
`0x7fc972064460 <col:8> 'FILE *' lvalue ParmVar 0x7fc9720642d0 '_p' 'FILE *'`: &DeclRefExpr{
Addr: 0x7fc972064460,
Pos: NewPositionFromString("col:8"),
Type: "FILE *",
Type1: "",
Lvalue: true,
For: "ParmVar",
Address2: "0x7fc9720642d0",
Name: "_p",
Type2: "FILE *",
Type3: "",
ChildNodes: []Node{},
},
`0x7fc97206a958 <col:11> 'int (int, FILE *)' Function 0x7fc972064198 '__swbuf' 'int (int, FILE *)'`: &DeclRefExpr{
Addr: 0x7fc97206a958,
Pos: NewPositionFromString("col:11"),
Type: "int (int, FILE *)",
Type1: "",
Lvalue: false,
For: "Function",
Address2: "0x7fc972064198",
Name: "__swbuf",
Type2: "int (int, FILE *)",
Type3: "",
ChildNodes: []Node{},
},
`0x7fa36680f170 <col:19> 'struct programming':'struct programming' lvalue Var 0x7fa36680dc20 'variable' 'struct programming':'struct programming'`: &DeclRefExpr{
Addr: 0x7fa36680f170,
Pos: NewPositionFromString("col:19"),
Type: "struct programming",
Type1: "struct programming",
Lvalue: true,
For: "Var",
Address2: "0x7fa36680dc20",
Name: "variable",
Type2: "struct programming",
Type3: "struct programming",
ChildNodes: []Node{},
},
`0x35cb438 <col:13> 'int' EnumConstant 0x35ca300 'Jan' 'int'`: &DeclRefExpr{
Addr: 0x35cb438,
Pos: NewPositionFromString("col:13"),
Type: "int",
Type1: "",
Lvalue: false,
For: "EnumConstant",
Address2: "0x35ca300",
Name: "Jan",
Type2: "int",
Type3: "",
ChildNodes: []Node{},
},
`0x1ff8770 <col:33> 'T_ENUM':'T_ENUM' lvalue Var 0x1ff8600 'cc' 'T_ENUM':'T_ENUM'`: &DeclRefExpr{
Addr: 0x1ff8770,
Pos: NewPositionFromString("col:33"),
Type: "T_ENUM",
Type1: "T_ENUM",
Lvalue: true,
For: "Var",
Address2: "0x1ff8600",
Name: "cc",
Type2: "T_ENUM",
Type3: "T_ENUM",
ChildNodes: []Node{},
},
`0x55e2113b7970 <col:16> 'char [123]' lvalue Var 0x55e2113b7758 'a' 'char [123]' non_odr_use_unevaluated`: &DeclRefExpr{
Addr: 0x55e2113b7970,
Pos: NewPositionFromString("col:16"),
Type: "char [123]",
Type1: "",
Lvalue: true,
For: "Var",
Address2: "0x55e2113b7758",
Name: "a",
Type2: "char [123]",
Type3: "",
NonODRUseUnevaluated: true,
ChildNodes: []Node{},
},
}
runNodeTests(t, nodes)
}
|