Skip to content

Commit f479097

Browse files
committed
Add test.
1 parent 9ca389d commit f479097

File tree

3 files changed

+283
-0
lines changed

3 files changed

+283
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
{
2+
"absolutePath": "a",
3+
"exportedSymbols":
4+
{
5+
"A":
6+
[
7+
3
8+
],
9+
"f":
10+
[
11+
13
12+
]
13+
},
14+
"id": 14,
15+
"nodeType": "SourceUnit",
16+
"nodes":
17+
[
18+
{
19+
"canonicalName": "A",
20+
"id": 3,
21+
"members":
22+
[
23+
{
24+
"id": 1,
25+
"name": "X",
26+
"nameLocation": "9:1:1",
27+
"nodeType": "EnumValue",
28+
"src": "9:1:1"
29+
},
30+
{
31+
"id": 2,
32+
"name": "Y",
33+
"nameLocation": "12:1:1",
34+
"nodeType": "EnumValue",
35+
"src": "12:1:1"
36+
}
37+
],
38+
"name": "A",
39+
"nameLocation": "5:1:1",
40+
"nodeType": "EnumDefinition",
41+
"src": "0:15:1"
42+
},
43+
{
44+
"body":
45+
{
46+
"id": 12,
47+
"nodeType": "Block",
48+
"src": "46:15:1",
49+
"statements":
50+
[
51+
{
52+
"expression":
53+
{
54+
"expression":
55+
{
56+
"id": 9,
57+
"name": "A",
58+
"nodeType": "Identifier",
59+
"overloadedDeclarations": [],
60+
"referencedDeclaration": 3,
61+
"src": "55:1:1",
62+
"typeDescriptions":
63+
{
64+
"typeIdentifier": "t_type$_t_enum$_A_$3_$",
65+
"typeString": "type(enum A)"
66+
}
67+
},
68+
"id": 10,
69+
"isConstant": false,
70+
"isLValue": false,
71+
"isPure": true,
72+
"lValueRequested": false,
73+
"memberName": "X",
74+
"nodeType": "MemberAccess",
75+
"referencedDeclaration": 1,
76+
"src": "55:3:1",
77+
"typeDescriptions":
78+
{
79+
"typeIdentifier": "t_enum$_A_$3",
80+
"typeString": "enum A"
81+
}
82+
},
83+
"functionReturnParameters": 8,
84+
"id": 11,
85+
"nodeType": "Return",
86+
"src": "48:10:1"
87+
}
88+
]
89+
},
90+
"id": 13,
91+
"implemented": true,
92+
"kind": "freeFunction",
93+
"modifiers": [],
94+
"name": "f",
95+
"nameLocation": "25:1:1",
96+
"nodeType": "FunctionDefinition",
97+
"parameters":
98+
{
99+
"id": 4,
100+
"nodeType": "ParameterList",
101+
"parameters": [],
102+
"src": "26:2:1"
103+
},
104+
"returnParameters":
105+
{
106+
"id": 8,
107+
"nodeType": "ParameterList",
108+
"parameters":
109+
[
110+
{
111+
"constant": false,
112+
"id": 7,
113+
"mutability": "mutable",
114+
"name": "",
115+
"nameLocation": "-1:-1:-1",
116+
"nodeType": "VariableDeclaration",
117+
"scope": 13,
118+
"src": "43:1:1",
119+
"stateVariable": false,
120+
"storageLocation": "default",
121+
"typeDescriptions":
122+
{
123+
"typeIdentifier": "t_enum$_A_$3",
124+
"typeString": "enum A"
125+
},
126+
"typeName":
127+
{
128+
"id": 6,
129+
"nodeType": "UserDefinedTypeName",
130+
"pathNode":
131+
{
132+
"id": 5,
133+
"name": "A",
134+
"nodeType": "IdentifierPath",
135+
"referencedDeclaration": 3,
136+
"src": "43:1:1"
137+
},
138+
"referencedDeclaration": 3,
139+
"src": "43:1:1",
140+
"typeDescriptions":
141+
{
142+
"typeIdentifier": "t_enum$_A_$3",
143+
"typeString": "enum A"
144+
}
145+
},
146+
"visibility": "internal"
147+
}
148+
],
149+
"src": "42:3:1"
150+
},
151+
"scope": 14,
152+
"src": "16:45:1",
153+
"stateMutability": "pure",
154+
"virtual": false,
155+
"visibility": "internal"
156+
}
157+
],
158+
"src": "0:62:1"
159+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
enum A { X, Y }
2+
function f() pure returns (A) { return A.X; }
3+
4+
// ----
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
{
2+
"absolutePath": "a",
3+
"id": 14,
4+
"nodeType": "SourceUnit",
5+
"nodes":
6+
[
7+
{
8+
"id": 3,
9+
"members":
10+
[
11+
{
12+
"id": 1,
13+
"name": "X",
14+
"nameLocation": "9:1:1",
15+
"nodeType": "EnumValue",
16+
"src": "9:1:1"
17+
},
18+
{
19+
"id": 2,
20+
"name": "Y",
21+
"nameLocation": "12:1:1",
22+
"nodeType": "EnumValue",
23+
"src": "12:1:1"
24+
}
25+
],
26+
"name": "A",
27+
"nameLocation": "5:1:1",
28+
"nodeType": "EnumDefinition",
29+
"src": "0:15:1"
30+
},
31+
{
32+
"body":
33+
{
34+
"id": 12,
35+
"nodeType": "Block",
36+
"src": "46:15:1",
37+
"statements":
38+
[
39+
{
40+
"expression":
41+
{
42+
"expression":
43+
{
44+
"id": 9,
45+
"name": "A",
46+
"nodeType": "Identifier",
47+
"overloadedDeclarations": [],
48+
"src": "55:1:1",
49+
"typeDescriptions": {}
50+
},
51+
"id": 10,
52+
"memberName": "X",
53+
"nodeType": "MemberAccess",
54+
"src": "55:3:1",
55+
"typeDescriptions": {}
56+
},
57+
"id": 11,
58+
"nodeType": "Return",
59+
"src": "48:10:1"
60+
}
61+
]
62+
},
63+
"id": 13,
64+
"implemented": true,
65+
"kind": "freeFunction",
66+
"modifiers": [],
67+
"name": "f",
68+
"nameLocation": "25:1:1",
69+
"nodeType": "FunctionDefinition",
70+
"parameters":
71+
{
72+
"id": 4,
73+
"nodeType": "ParameterList",
74+
"parameters": [],
75+
"src": "26:2:1"
76+
},
77+
"returnParameters":
78+
{
79+
"id": 8,
80+
"nodeType": "ParameterList",
81+
"parameters":
82+
[
83+
{
84+
"constant": false,
85+
"id": 7,
86+
"mutability": "mutable",
87+
"name": "",
88+
"nameLocation": "-1:-1:-1",
89+
"nodeType": "VariableDeclaration",
90+
"src": "43:1:1",
91+
"stateVariable": false,
92+
"storageLocation": "default",
93+
"typeDescriptions": {},
94+
"typeName":
95+
{
96+
"id": 6,
97+
"nodeType": "UserDefinedTypeName",
98+
"pathNode":
99+
{
100+
"id": 5,
101+
"name": "A",
102+
"nodeType": "IdentifierPath",
103+
"src": "43:1:1"
104+
},
105+
"src": "43:1:1",
106+
"typeDescriptions": {}
107+
},
108+
"visibility": "internal"
109+
}
110+
],
111+
"src": "42:3:1"
112+
},
113+
"src": "16:45:1",
114+
"stateMutability": "pure",
115+
"virtual": false,
116+
"visibility": "internal"
117+
}
118+
],
119+
"src": "0:62:1"
120+
}

0 commit comments

Comments
 (0)