Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8cb3965

Browse files
committedJun 3, 2019
expr v2-rc.2
1 parent 42135c7 commit 8cb3965

File tree

12 files changed

+655
-463
lines changed

12 files changed

+655
-463
lines changed
 

‎ast/location.go

Lines changed: 81 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,165 +1,165 @@
11
package ast
22

33
import (
4-
"reflect"
4+
"github.com/antonmedv/expr/internal/helper"
55
)
66

7-
func (n *NilNode) SetType(t reflect.Type) {
8-
n.t = t
7+
func (n *NilNode) SetLocation(l helper.Location) {
8+
n.l = l
99
}
1010

11-
func (n *NilNode) GetType() reflect.Type {
12-
return n.t
11+
func (n *NilNode) GetLocation() helper.Location {
12+
return n.l
1313
}
1414

15-
func (n *IdentifierNode) SetType(t reflect.Type) {
16-
n.t = t
15+
func (n *IdentifierNode) SetLocation(l helper.Location) {
16+
n.l = l
1717
}
1818

19-
func (n *IdentifierNode) GetType() reflect.Type {
20-
return n.t
19+
func (n *IdentifierNode) GetLocation() helper.Location {
20+
return n.l
2121
}
2222

23-
func (n *IntegerNode) SetType(t reflect.Type) {
24-
n.t = t
23+
func (n *IntegerNode) SetLocation(l helper.Location) {
24+
n.l = l
2525
}
2626

27-
func (n *IntegerNode) GetType() reflect.Type {
28-
return n.t
27+
func (n *IntegerNode) GetLocation() helper.Location {
28+
return n.l
2929
}
3030

31-
func (n *FloatNode) SetType(t reflect.Type) {
32-
n.t = t
31+
func (n *FloatNode) SetLocation(l helper.Location) {
32+
n.l = l
3333
}
3434

35-
func (n *FloatNode) GetType() reflect.Type {
36-
return n.t
35+
func (n *FloatNode) GetLocation() helper.Location {
36+
return n.l
3737
}
3838

39-
func (n *BoolNode) SetType(t reflect.Type) {
40-
n.t = t
39+
func (n *BoolNode) SetLocation(l helper.Location) {
40+
n.l = l
4141
}
4242

43-
func (n *BoolNode) GetType() reflect.Type {
44-
return n.t
43+
func (n *BoolNode) GetLocation() helper.Location {
44+
return n.l
4545
}
4646

47-
func (n *StringNode) SetType(t reflect.Type) {
48-
n.t = t
47+
func (n *StringNode) SetLocation(l helper.Location) {
48+
n.l = l
4949
}
5050

51-
func (n *StringNode) GetType() reflect.Type {
52-
return n.t
51+
func (n *StringNode) GetLocation() helper.Location {
52+
return n.l
5353
}
5454

55-
func (n *UnaryNode) SetType(t reflect.Type) {
56-
n.t = t
55+
func (n *UnaryNode) SetLocation(l helper.Location) {
56+
n.l = l
5757
}
5858

59-
func (n *UnaryNode) GetType() reflect.Type {
60-
return n.t
59+
func (n *UnaryNode) GetLocation() helper.Location {
60+
return n.l
6161
}
6262

63-
func (n *BinaryNode) SetType(t reflect.Type) {
64-
n.t = t
63+
func (n *BinaryNode) SetLocation(l helper.Location) {
64+
n.l = l
6565
}
6666

67-
func (n *BinaryNode) GetType() reflect.Type {
68-
return n.t
67+
func (n *BinaryNode) GetLocation() helper.Location {
68+
return n.l
6969
}
7070

71-
func (n *MatchesNode) SetType(t reflect.Type) {
72-
n.t = t
71+
func (n *MatchesNode) SetLocation(l helper.Location) {
72+
n.l = l
7373
}
7474

75-
func (n *MatchesNode) GetType() reflect.Type {
76-
return n.t
75+
func (n *MatchesNode) GetLocation() helper.Location {
76+
return n.l
7777
}
7878

79-
func (n *PropertyNode) SetType(t reflect.Type) {
80-
n.t = t
79+
func (n *PropertyNode) SetLocation(l helper.Location) {
80+
n.l = l
8181
}
8282

83-
func (n *PropertyNode) GetType() reflect.Type {
84-
return n.t
83+
func (n *PropertyNode) GetLocation() helper.Location {
84+
return n.l
8585
}
8686

87-
func (n *IndexNode) SetType(t reflect.Type) {
88-
n.t = t
87+
func (n *IndexNode) SetLocation(l helper.Location) {
88+
n.l = l
8989
}
9090

91-
func (n *IndexNode) GetType() reflect.Type {
92-
return n.t
91+
func (n *IndexNode) GetLocation() helper.Location {
92+
return n.l
9393
}
9494

95-
func (n *MethodNode) SetType(t reflect.Type) {
96-
n.t = t
95+
func (n *MethodNode) SetLocation(l helper.Location) {
96+
n.l = l
9797
}
9898

99-
func (n *MethodNode) GetType() reflect.Type {
100-
return n.t
99+
func (n *MethodNode) GetLocation() helper.Location {
100+
return n.l
101101
}
102102

103-
func (n *FunctionNode) SetType(t reflect.Type) {
104-
n.t = t
103+
func (n *FunctionNode) SetLocation(l helper.Location) {
104+
n.l = l
105105
}
106106

107-
func (n *FunctionNode) GetType() reflect.Type {
108-
return n.t
107+
func (n *FunctionNode) GetLocation() helper.Location {
108+
return n.l
109109
}
110110

111-
func (n *BuiltinNode) SetType(t reflect.Type) {
112-
n.t = t
111+
func (n *BuiltinNode) SetLocation(l helper.Location) {
112+
n.l = l
113113
}
114114

115-
func (n *BuiltinNode) GetType() reflect.Type {
116-
return n.t
115+
func (n *BuiltinNode) GetLocation() helper.Location {
116+
return n.l
117117
}
118118

119-
func (n *ClosureNode) SetType(t reflect.Type) {
120-
n.t = t
119+
func (n *ClosureNode) SetLocation(l helper.Location) {
120+
n.l = l
121121
}
122122

123-
func (n *ClosureNode) GetType() reflect.Type {
124-
return n.t
123+
func (n *ClosureNode) GetLocation() helper.Location {
124+
return n.l
125125
}
126126

127-
func (n *PointerNode) SetType(t reflect.Type) {
128-
n.t = t
127+
func (n *PointerNode) SetLocation(l helper.Location) {
128+
n.l = l
129129
}
130130

131-
func (n *PointerNode) GetType() reflect.Type {
132-
return n.t
131+
func (n *PointerNode) GetLocation() helper.Location {
132+
return n.l
133133
}
134134

135-
func (n *ConditionalNode) SetType(t reflect.Type) {
136-
n.t = t
135+
func (n *ConditionalNode) SetLocation(l helper.Location) {
136+
n.l = l
137137
}
138138

139-
func (n *ConditionalNode) GetType() reflect.Type {
140-
return n.t
139+
func (n *ConditionalNode) GetLocation() helper.Location {
140+
return n.l
141141
}
142142

143-
func (n *ArrayNode) SetType(t reflect.Type) {
144-
n.t = t
143+
func (n *ArrayNode) SetLocation(l helper.Location) {
144+
n.l = l
145145
}
146146

147-
func (n *ArrayNode) GetType() reflect.Type {
148-
return n.t
147+
func (n *ArrayNode) GetLocation() helper.Location {
148+
return n.l
149149
}
150150

151-
func (n *MapNode) SetType(t reflect.Type) {
152-
n.t = t
151+
func (n *MapNode) SetLocation(l helper.Location) {
152+
n.l = l
153153
}
154154

155-
func (n *MapNode) GetType() reflect.Type {
156-
return n.t
155+
func (n *MapNode) GetLocation() helper.Location {
156+
return n.l
157157
}
158158

159-
func (n *PairNode) GetType() reflect.Type {
160-
return n.t
159+
func (n *PairNode) GetLocation() helper.Location {
160+
return n.l
161161
}
162162

163-
func (n *PairNode) SetType(t reflect.Type) {
164-
n.t = t
163+
func (n *PairNode) SetLocation(l helper.Location) {
164+
n.l = l
165165
}

0 commit comments

Comments
 (0)
Please sign in to comment.