gloss 0.0.6 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gloss.yml +1 -0
- data/Gemfile.lock +3 -3
- data/exe/gloss +10 -13
- data/ext/gloss/src/cr_ast.cr +61 -71
- data/ext/gloss/src/rb_ast.cr +37 -36
- data/lib/gloss.rb +14 -7
- data/lib/gloss/cli.rb +61 -40
- data/lib/gloss/config.rb +3 -1
- data/lib/gloss/errors.rb +1 -1
- data/lib/gloss/logger.rb +1 -6
- data/lib/gloss/prog_loader.rb +141 -0
- data/lib/gloss/scope.rb +1 -1
- data/lib/gloss/source.rb +1 -1
- data/lib/gloss/type_checker.rb +46 -28
- data/lib/gloss/utils.rb +44 -0
- data/lib/gloss/version.rb +1 -1
- data/lib/gloss/{builder.rb → visitor.rb} +80 -53
- data/lib/gloss/watcher.rb +2 -2
- data/lib/gloss/writer.rb +21 -10
- data/sig/core.rbs +2 -0
- data/sig/fast_blank.rbs +4 -0
- data/sig/{gloss.rbs → gls.rbs} +0 -0
- data/sig/optparse.rbs +6 -0
- data/sig/rubygems.rbs +9 -0
- data/sig/yaml.rbs +3 -0
- data/src/exe/gloss +19 -0
- data/src/lib/gloss.gl +26 -0
- data/src/lib/gloss/cli.gl +41 -26
- data/src/lib/gloss/config.gl +2 -2
- data/src/lib/gloss/logger.gl +1 -6
- data/src/lib/gloss/prog_loader.gl +133 -0
- data/src/lib/gloss/scope.gl +0 -2
- data/src/lib/gloss/type_checker.gl +42 -24
- data/src/lib/gloss/utils.gl +38 -0
- data/src/lib/gloss/version.gl +1 -1
- data/src/lib/gloss/{builder.gl → visitor.gl} +73 -44
- data/src/lib/gloss/watcher.gl +3 -4
- data/src/lib/gloss/writer.gl +15 -13
- metadata +16 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f2a161efc722fa324547e073280e488143cd33141d9267609419d72894bcffc
|
4
|
+
data.tar.gz: 163032e06b8c91cdd1286b423846ff6a41a278a3fef7ed19bac5dcd21fb85e87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 636bafe05b90c4b46f27a91b3d29d653a37cd3fcf083b6e80326be5b665fa48ba5648ae65a3b7eb7b7eba79c610ed3fee44f1ef586d4fcace105a9955ddc1299
|
7
|
+
data.tar.gz: 73fba2b35872586cfe17253f9a295c7c277fd4c298e796300f882386b555ea13e367bc2a2de2a153f12a053df9608ae89999803c893163ba8ebf7c73f0dee7aa
|
data/.gloss.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
gloss (0.0
|
4
|
+
gloss (0.1.0)
|
5
5
|
fast_blank
|
6
6
|
listen
|
7
7
|
rbs
|
@@ -25,7 +25,7 @@ GEM
|
|
25
25
|
diff-lcs (1.4.4)
|
26
26
|
fast_blank (1.0.0)
|
27
27
|
ffi (1.14.2)
|
28
|
-
i18n (1.8.
|
28
|
+
i18n (1.8.8)
|
29
29
|
concurrent-ruby (~> 1.0)
|
30
30
|
language_server-protocol (3.15.0.1)
|
31
31
|
listen (3.4.1)
|
@@ -77,7 +77,7 @@ GEM
|
|
77
77
|
rubocop-ast (1.4.0)
|
78
78
|
parser (>= 2.7.1.5)
|
79
79
|
ruby-progressbar (1.11.0)
|
80
|
-
steep (0.
|
80
|
+
steep (0.41.0)
|
81
81
|
activesupport (>= 5.1)
|
82
82
|
ast_utils (>= 0.4.0)
|
83
83
|
language_server-protocol (~> 3.15.0.1)
|
data/exe/gloss
CHANGED
@@ -1,20 +1,17 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
##### This file was generated by Gloss; any changes made here will be overwritten.
|
5
|
+
##### See src/ to make changes
|
2
6
|
|
3
7
|
require "bundler/setup"
|
4
8
|
require "gloss"
|
5
|
-
|
6
9
|
begin
|
7
|
-
Gloss::CLI.new(ARGV)
|
10
|
+
Gloss::CLI.new(ARGV)
|
11
|
+
.run
|
8
12
|
rescue SystemExit
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
Message: #{e.message}
|
14
|
-
Trace:
|
15
|
-
#{e.backtrace.join("\n")}
|
16
|
-
|
17
|
-
This is probably a bug and may warrant a bug report at https://github.com/johansenja/gloss/issues
|
18
|
-
MSG
|
19
|
-
exit 1
|
13
|
+
rescue => e
|
14
|
+
abort(" Unexpected error: #{e.class
|
15
|
+
.name}\n Message: #{e.message}\n Trace:\n #{e.backtrace
|
16
|
+
.join("\n")}\n\n This is probably a bug and may warrant a bug report at https://github.com/johansenja/gloss/issues")
|
20
17
|
end
|
data/ext/gloss/src/cr_ast.cr
CHANGED
@@ -5,7 +5,7 @@ require "./rb_ast"
|
|
5
5
|
module Crystal
|
6
6
|
abstract class ASTNode
|
7
7
|
def to_rb
|
8
|
-
Rb::AST::EmptyNode.new(self.class.name)
|
8
|
+
Rb::AST::EmptyNode.new(self.class.name, @location)
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
@@ -17,13 +17,13 @@ module Crystal
|
|
17
17
|
|
18
18
|
class Expressions < ASTNode
|
19
19
|
def to_rb
|
20
|
-
Rb::AST::CollectionNode.new(@expressions.map(&.to_rb))
|
20
|
+
Rb::AST::CollectionNode.new(@expressions.map(&.to_rb), @location)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
24
|
class NilLiteral < ASTNode
|
25
25
|
def to_rb
|
26
|
-
Rb::AST::LiteralNode.new("nil", Rb::AST::RbLiteral::NilClass)
|
26
|
+
Rb::AST::LiteralNode.new("nil", Rb::AST::RbLiteral::NilClass, @location)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -31,74 +31,73 @@ module Crystal
|
|
31
31
|
def to_rb
|
32
32
|
Rb::AST::LiteralNode.new(
|
33
33
|
@value.inspect,
|
34
|
-
@value ? Rb::AST::RbLiteral::TrueClass : Rb::AST::RbLiteral::FalseClass
|
35
|
-
)
|
34
|
+
@value ? Rb::AST::RbLiteral::TrueClass : Rb::AST::RbLiteral::FalseClass, @location)
|
36
35
|
end
|
37
36
|
end
|
38
37
|
|
39
38
|
class NumberLiteral < ASTNode
|
40
39
|
def to_rb
|
41
|
-
Rb::AST::LiteralNode.new(@value, Rb::AST::RbLiteral::Integer)
|
40
|
+
Rb::AST::LiteralNode.new(@value, Rb::AST::RbLiteral::Integer, @location)
|
42
41
|
end
|
43
42
|
end
|
44
43
|
|
45
44
|
class CharLiteral < ASTNode
|
46
45
|
def to_rb
|
47
|
-
Rb::AST::LiteralNode.new(@value.inspect, Rb::AST::RbLiteral::String)
|
46
|
+
Rb::AST::LiteralNode.new(@value.inspect, Rb::AST::RbLiteral::String, @location)
|
48
47
|
end
|
49
48
|
end
|
50
49
|
|
51
50
|
class StringLiteral < ASTNode
|
52
51
|
def to_rb
|
53
|
-
Rb::AST::LiteralNode.new(@value.inspect, Rb::AST::RbLiteral::String)
|
52
|
+
Rb::AST::LiteralNode.new(@value.inspect, Rb::AST::RbLiteral::String, @location)
|
54
53
|
end
|
55
54
|
end
|
56
55
|
|
57
56
|
class StringInterpolation < ASTNode
|
58
57
|
def to_rb
|
59
|
-
Rb::AST::StringInterpolation.new(@expressions.map &.to_rb)
|
58
|
+
Rb::AST::StringInterpolation.new(@expressions.map &.to_rb, @location)
|
60
59
|
end
|
61
60
|
end
|
62
61
|
|
63
62
|
class SymbolLiteral < ASTNode
|
64
63
|
def to_rb
|
65
|
-
Rb::AST::LiteralNode.new(%{:"#{@value.to_s}"}, Rb::AST::RbLiteral::Symbol)
|
64
|
+
Rb::AST::LiteralNode.new(%{:"#{@value.to_s}"}, Rb::AST::RbLiteral::Symbol, @location)
|
66
65
|
end
|
67
66
|
end
|
68
67
|
|
69
68
|
class ArrayLiteral < ASTNode
|
70
69
|
def to_rb
|
71
|
-
Rb::AST::ArrayLiteral.new(@elements.map(&.to_rb))
|
70
|
+
Rb::AST::ArrayLiteral.new(@elements.map(&.to_rb), @location)
|
72
71
|
end
|
73
72
|
end
|
74
73
|
|
75
74
|
class HashLiteral < ASTNode
|
76
75
|
def to_rb
|
77
|
-
Rb::AST::HashLiteral.new(@entries.map { |e| {e.key.to_rb, e.value.to_rb} })
|
76
|
+
Rb::AST::HashLiteral.new(@entries.map { |e| {e.key.to_rb, e.value.to_rb} }, @location)
|
78
77
|
end
|
79
78
|
end
|
80
79
|
|
81
80
|
class NamedTupleLiteral < ASTNode
|
82
81
|
def to_rb
|
83
|
-
Rb::AST::HashLiteral.new(@entries.map { |e| {e.key, e.value.to_rb} }, frozen: true)
|
82
|
+
Rb::AST::HashLiteral.new(@entries.map { |e| {e.key, e.value.to_rb} }, @location, frozen: true)
|
84
83
|
end
|
85
84
|
end
|
86
85
|
|
87
86
|
class RangeLiteral < ASTNode
|
88
87
|
def to_rb
|
89
|
-
Rb::AST::RangeLiteral.new(@from.to_rb, @to.to_rb, @exclusive)
|
88
|
+
Rb::AST::RangeLiteral.new(@from.to_rb, @to.to_rb, @exclusive, @location)
|
90
89
|
end
|
91
90
|
end
|
92
91
|
|
93
92
|
class RegexLiteral < ASTNode
|
94
93
|
def to_rb
|
95
|
-
Rb::AST::RegexLiteral.new(@value.to_rb)
|
94
|
+
Rb::AST::RegexLiteral.new(@value.to_rb, @location)
|
96
95
|
end
|
97
96
|
end
|
98
97
|
|
99
98
|
class TupleLiteral < ASTNode
|
100
99
|
def to_rb
|
101
|
-
Rb::AST::ArrayLiteral.new(@elements.map(&.to_rb), frozen: true)
|
100
|
+
Rb::AST::ArrayLiteral.new(@elements.map(&.to_rb), @location, frozen: true)
|
102
101
|
end
|
103
102
|
end
|
104
103
|
|
@@ -115,26 +114,25 @@ module Crystal
|
|
115
114
|
@body.to_rb,
|
116
115
|
return_type.try(&.to_rb),
|
117
116
|
@yields,
|
118
|
-
@block_arg.try &.to_rb
|
119
|
-
)
|
117
|
+
@block_arg.try &.to_rb, @location)
|
120
118
|
end
|
121
119
|
end
|
122
120
|
|
123
121
|
class ClassDef < ASTNode
|
124
122
|
def to_rb
|
125
|
-
Rb::AST::ClassNode.new(@name.to_rb, @body.to_rb, @superclass.try(&.to_rb), @type_vars, @abstract)
|
123
|
+
Rb::AST::ClassNode.new(@name.to_rb, @body.to_rb, @superclass.try(&.to_rb), @type_vars, @abstract, @location)
|
126
124
|
end
|
127
125
|
end
|
128
126
|
|
129
127
|
class ModuleDef < ASTNode
|
130
128
|
def to_rb
|
131
|
-
Rb::AST::ModuleNode.new(@name.to_rb, @body.to_rb, @type_vars)
|
129
|
+
Rb::AST::ModuleNode.new(@name.to_rb, @body.to_rb, @type_vars, @location)
|
132
130
|
end
|
133
131
|
end
|
134
132
|
|
135
133
|
class Var < ASTNode
|
136
134
|
def to_rb
|
137
|
-
Rb::AST::Var.new(@name)
|
135
|
+
Rb::AST::Var.new(@name, @location)
|
138
136
|
end
|
139
137
|
end
|
140
138
|
|
@@ -142,7 +140,7 @@ module Crystal
|
|
142
140
|
def to_rb
|
143
141
|
positional_args = args.dup
|
144
142
|
splat = @splat_index ? positional_args.delete_at(@splat_index.as(Int32)) : nil
|
145
|
-
Rb::AST::Block.new(positional_args.map(&.to_rb), splat.try &.to_rb, @body.to_rb)
|
143
|
+
Rb::AST::Block.new(positional_args.map(&.to_rb), splat.try &.to_rb, @body.to_rb, @location)
|
146
144
|
end
|
147
145
|
end
|
148
146
|
|
@@ -155,8 +153,7 @@ module Crystal
|
|
155
153
|
@named_args.try(&.map(&.to_rb.as(Rb::AST::Arg))),
|
156
154
|
@block.try(&.to_rb),
|
157
155
|
@block_arg.try(&.to_rb),
|
158
|
-
@has_parentheses
|
159
|
-
)
|
156
|
+
@has_parentheses, @location)
|
160
157
|
end
|
161
158
|
end
|
162
159
|
|
@@ -165,121 +162,121 @@ module Crystal
|
|
165
162
|
|
166
163
|
def to_rb
|
167
164
|
Rb::AST::Arg.new(@name, @external_name, @restriction.try(&.to_rb),
|
168
|
-
@default_value.try(&.to_rb), @keyword_arg)
|
165
|
+
@default_value.try(&.to_rb), @keyword_arg, @location)
|
169
166
|
end
|
170
167
|
end
|
171
168
|
|
172
169
|
class NamedArgument < ASTNode
|
173
170
|
def to_rb
|
174
|
-
Rb::AST::Arg.new(@name, @name, nil, @value.to_rb, true)
|
171
|
+
Rb::AST::Arg.new(@name, @name, nil, @value.to_rb, true, @location)
|
175
172
|
end
|
176
173
|
end
|
177
174
|
|
178
175
|
class If < ASTNode
|
179
176
|
def to_rb
|
180
|
-
Rb::AST::If.new(@cond.to_rb, @then.to_rb, @else.to_rb)
|
177
|
+
Rb::AST::If.new(@cond.to_rb, @then.to_rb, @else.to_rb, @location)
|
181
178
|
end
|
182
179
|
end
|
183
180
|
|
184
181
|
class Unless < ASTNode
|
185
182
|
def to_rb
|
186
|
-
Rb::AST::Unless.new(@cond.to_rb, @then.to_rb, @else.to_rb)
|
183
|
+
Rb::AST::Unless.new(@cond.to_rb, @then.to_rb, @else.to_rb, @location)
|
187
184
|
end
|
188
185
|
end
|
189
186
|
|
190
187
|
class Assign < ASTNode
|
191
188
|
def to_rb
|
192
|
-
Rb::AST::Assign.new(@target.to_rb, @value.to_rb)
|
189
|
+
Rb::AST::Assign.new(@target.to_rb, @value.to_rb, nil, @location)
|
193
190
|
end
|
194
191
|
end
|
195
192
|
|
196
193
|
class OpAssign < ASTNode
|
197
194
|
def to_rb
|
198
|
-
Rb::AST::Assign.new(@target.to_rb, @value.to_rb, @op)
|
195
|
+
Rb::AST::Assign.new(@target.to_rb, @value.to_rb, @op, @location)
|
199
196
|
end
|
200
197
|
end
|
201
198
|
|
202
199
|
class MultiAssign < ASTNode
|
203
200
|
def to_rb
|
204
|
-
Rb::AST::MultiAssign.new(@targets.map(&.to_rb), @values.map(&.to_rb))
|
201
|
+
Rb::AST::MultiAssign.new(@targets.map(&.to_rb), @values.map(&.to_rb), @location)
|
205
202
|
end
|
206
203
|
end
|
207
204
|
|
208
205
|
class InstanceVar < ASTNode
|
209
206
|
def to_rb
|
210
|
-
Rb::AST::InstanceVar.new(@name)
|
207
|
+
Rb::AST::InstanceVar.new(@name, @location)
|
211
208
|
end
|
212
209
|
end
|
213
210
|
|
214
211
|
class ReadInstanceVar < ASTNode
|
215
212
|
def to_rb
|
216
|
-
Rb::AST::EmptyNode.new(self.class.name)
|
213
|
+
Rb::AST::EmptyNode.new(self.class.name, @location)
|
217
214
|
end
|
218
215
|
end
|
219
216
|
|
220
217
|
class ClassVar < ASTNode
|
221
218
|
def to_rb
|
222
|
-
Rb::AST::EmptyNode.new(self.class.name)
|
219
|
+
Rb::AST::EmptyNode.new(self.class.name, @location)
|
223
220
|
end
|
224
221
|
end
|
225
222
|
|
226
223
|
class Global < ASTNode
|
227
224
|
def to_rb
|
228
|
-
Rb::AST::GlobalVar.new(@name)
|
225
|
+
Rb::AST::GlobalVar.new(@name, @location)
|
229
226
|
end
|
230
227
|
end
|
231
228
|
|
232
229
|
class Annotation < ASTNode
|
233
230
|
def to_rb
|
234
|
-
Rb::AST::EmptyNode.new(self.class.name)
|
231
|
+
Rb::AST::EmptyNode.new(self.class.name, @location)
|
235
232
|
end
|
236
233
|
end
|
237
234
|
|
238
235
|
class MacroIf < ASTNode
|
239
236
|
def to_rb
|
240
|
-
Rb::AST::MacroIf.new(@cond.to_rb, @then.to_rb, @else.to_rb)
|
237
|
+
Rb::AST::MacroIf.new(@cond.to_rb, @then.to_rb, @else.to_rb, @location)
|
241
238
|
end
|
242
239
|
end
|
243
240
|
|
244
241
|
class MacroFor < ASTNode
|
245
242
|
def to_rb
|
246
|
-
Rb::AST::MacroFor.new(@vars.map(&.to_rb), @exp.to_rb, @body.to_rb)
|
243
|
+
Rb::AST::MacroFor.new(@vars.map(&.to_rb), @exp.to_rb, @body.to_rb, @location)
|
247
244
|
end
|
248
245
|
end
|
249
246
|
|
250
247
|
class MacroVar < ASTNode
|
251
248
|
def to_rb
|
252
|
-
Rb::AST::EmptyNode.new(self.class.name)
|
249
|
+
Rb::AST::EmptyNode.new(self.class.name, @location)
|
253
250
|
end
|
254
251
|
end
|
255
252
|
|
256
253
|
class MacroExpression < ASTNode
|
257
254
|
def to_rb
|
258
|
-
Rb::AST::MacroExpression.new(@exp.to_rb, @output)
|
255
|
+
Rb::AST::MacroExpression.new(@exp.to_rb, @output, @location)
|
259
256
|
end
|
260
257
|
end
|
261
258
|
|
262
259
|
class MacroLiteral < ASTNode
|
263
260
|
def to_rb
|
264
|
-
Rb::AST::MacroLiteral.new(@value)
|
261
|
+
Rb::AST::MacroLiteral.new(@value, @location)
|
265
262
|
end
|
266
263
|
end
|
267
264
|
|
268
265
|
class Annotation < ASTNode
|
269
266
|
def to_rb
|
270
|
-
Rb::AST::EmptyNode.new(self.class.name)
|
267
|
+
Rb::AST::EmptyNode.new(self.class.name, @location)
|
271
268
|
end
|
272
269
|
end
|
273
270
|
|
274
271
|
class EnumDef < ASTNode
|
275
272
|
def to_rb
|
276
|
-
Rb::AST::Enum.new(@name, @members.map(&.to_rb))
|
273
|
+
Rb::AST::Enum.new(@name, @members.map(&.to_rb), @location)
|
277
274
|
end
|
278
275
|
end
|
279
276
|
|
280
277
|
class Path < ASTNode
|
281
278
|
def to_rb
|
282
|
-
Rb::AST::Path.new(full_name)
|
279
|
+
Rb::AST::Path.new(full_name, @location)
|
283
280
|
end
|
284
281
|
|
285
282
|
def full_name
|
@@ -291,13 +288,13 @@ module Crystal
|
|
291
288
|
|
292
289
|
class Require < ASTNode
|
293
290
|
def to_rb
|
294
|
-
Rb::AST::Require.new(@string)
|
291
|
+
Rb::AST::Require.new(@string, @location)
|
295
292
|
end
|
296
293
|
end
|
297
294
|
|
298
295
|
class TypeDeclaration < ASTNode
|
299
296
|
def to_rb
|
300
|
-
Rb::AST::TypeDeclaration.new(@var.to_rb, @declared_type.to_rb, @value.try(&.to_rb))
|
297
|
+
Rb::AST::TypeDeclaration.new(@var.to_rb, @declared_type.to_rb, @value.try(&.to_rb), @location)
|
301
298
|
end
|
302
299
|
end
|
303
300
|
|
@@ -307,8 +304,7 @@ module Crystal
|
|
307
304
|
@cond.try(&.to_rb),
|
308
305
|
@whens.map(&.to_rb),
|
309
306
|
@else.try(&.to_rb),
|
310
|
-
@exhaustive
|
311
|
-
)
|
307
|
+
@exhaustive, @location)
|
312
308
|
end
|
313
309
|
end
|
314
310
|
|
@@ -322,16 +318,14 @@ module Crystal
|
|
322
318
|
Def.new(
|
323
319
|
"->",
|
324
320
|
[Arg.new(arg_name)],
|
325
|
-
c.tap { |call| call.obj = Var.new(arg_name) }
|
326
|
-
)
|
321
|
+
c.tap { |call| call.obj = Var.new(arg_name) })
|
327
322
|
).to_rb
|
328
323
|
else
|
329
324
|
c.to_rb
|
330
325
|
end
|
331
326
|
end,
|
332
327
|
@body.to_rb,
|
333
|
-
@exhaustive
|
334
|
-
)
|
328
|
+
@exhaustive, @location)
|
335
329
|
end
|
336
330
|
end
|
337
331
|
|
@@ -351,8 +345,7 @@ module Crystal
|
|
351
345
|
Rb::AST::UnaryExpr.new(
|
352
346
|
@exp.to_rb,
|
353
347
|
op,
|
354
|
-
requires_parentheses
|
355
|
-
)
|
348
|
+
requires_parentheses ,@location)
|
356
349
|
end
|
357
350
|
end
|
358
351
|
{% end %}
|
@@ -367,8 +360,7 @@ module Crystal
|
|
367
360
|
"||",
|
368
361
|
{% end %}
|
369
362
|
@left.to_rb,
|
370
|
-
@right.to_rb
|
371
|
-
)
|
363
|
+
@right.to_rb ,@location)
|
372
364
|
end
|
373
365
|
end
|
374
366
|
{% end %}
|
@@ -376,7 +368,7 @@ module Crystal
|
|
376
368
|
{% for class_name in %w[Return Break Next] %}
|
377
369
|
class {{class_name.id}} < ControlExpression
|
378
370
|
def to_rb
|
379
|
-
Rb::AST::{{class_name.id}}.new(@exp.try(&.to_rb))
|
371
|
+
Rb::AST::{{class_name.id}}.new(@exp.try(&.to_rb),@location)
|
380
372
|
end
|
381
373
|
end
|
382
374
|
{% end %}
|
@@ -384,43 +376,43 @@ module Crystal
|
|
384
376
|
class ExceptionHandler < ASTNode
|
385
377
|
def to_rb
|
386
378
|
Rb::AST::ExceptionHandler.new(@body.to_rb, @rescues.try(&.map(&.to_rb)), @else.try(&.to_rb),
|
387
|
-
@ensure.try(&.to_rb))
|
379
|
+
@ensure.try(&.to_rb), @location)
|
388
380
|
end
|
389
381
|
end
|
390
382
|
|
391
383
|
class Rescue < ASTNode
|
392
384
|
def to_rb
|
393
|
-
Rb::AST::Rescue.new(@body.to_rb, @types.try(&.map(&.to_rb)), @name)
|
385
|
+
Rb::AST::Rescue.new(@body.to_rb, @types.try(&.map(&.to_rb)), @name, @location)
|
394
386
|
end
|
395
387
|
end
|
396
388
|
|
397
389
|
class Union < ASTNode
|
398
390
|
def to_rb
|
399
|
-
Rb::AST::Union.new(@types.map(&.to_rb))
|
391
|
+
Rb::AST::Union.new(@types.map(&.to_rb), @location)
|
400
392
|
end
|
401
393
|
end
|
402
394
|
|
403
395
|
class Generic < ASTNode
|
404
396
|
def to_rb
|
405
|
-
Rb::AST::Generic.new(@name.to_rb, @type_vars.map(&.to_rb))
|
397
|
+
Rb::AST::Generic.new(@name.to_rb, @type_vars.map(&.to_rb), @location)
|
406
398
|
end
|
407
399
|
end
|
408
400
|
|
409
401
|
class ProcLiteral < ASTNode
|
410
402
|
def to_rb
|
411
|
-
Rb::AST::Proc.new(@def.to_rb)
|
403
|
+
Rb::AST::Proc.new(@def.to_rb, @location)
|
412
404
|
end
|
413
405
|
end
|
414
406
|
|
415
407
|
class Include < ASTNode
|
416
408
|
def to_rb
|
417
|
-
Rb::AST::Include.new(@name.to_rb)
|
409
|
+
Rb::AST::Include.new(@name.to_rb, @location)
|
418
410
|
end
|
419
411
|
end
|
420
412
|
|
421
413
|
class Extend < ASTNode
|
422
414
|
def to_rb
|
423
|
-
Rb::AST::Extend.new(@name.to_rb)
|
415
|
+
Rb::AST::Extend.new(@name.to_rb, @location)
|
424
416
|
end
|
425
417
|
end
|
426
418
|
|
@@ -433,14 +425,13 @@ module Crystal
|
|
433
425
|
nil,
|
434
426
|
nil,
|
435
427
|
nil,
|
436
|
-
false
|
437
|
-
)
|
428
|
+
false, @location)
|
438
429
|
end
|
439
430
|
end
|
440
431
|
|
441
432
|
class VisibilityModifier < ASTNode
|
442
433
|
def to_rb
|
443
|
-
Rb::AST::VisibilityModifier.new(@modifier, @exp.to_rb)
|
434
|
+
Rb::AST::VisibilityModifier.new(@modifier, @exp.to_rb, @location)
|
444
435
|
end
|
445
436
|
end
|
446
437
|
|
@@ -453,8 +444,7 @@ module Crystal
|
|
453
444
|
nil,
|
454
445
|
nil,
|
455
446
|
nil,
|
456
|
-
!@exps.empty
|
457
|
-
)
|
447
|
+
!@exps.empty?, @location)
|
458
448
|
end
|
459
449
|
end
|
460
450
|
|
@@ -465,7 +455,7 @@ module Crystal
|
|
465
455
|
Underscore MagicConstant Asm AsmOperand] %}
|
466
456
|
class {{class_name.id}} < ASTNode
|
467
457
|
def to_rb
|
468
|
-
Rb::AST::EmptyNode.new(self.class.name)
|
458
|
+
Rb::AST::EmptyNode.new(self.class.name,@location)
|
469
459
|
end
|
470
460
|
end
|
471
461
|
{% end %}
|
@@ -473,7 +463,7 @@ module Crystal
|
|
473
463
|
{% for class_name in %w[PointerOf SizeOf InstanceSizeOf Out MacroVerbatim] %}
|
474
464
|
class {{class_name.id}} < UnaryExpression
|
475
465
|
def to_rb
|
476
|
-
Rb::AST::EmptyNode.new(self.class.name)
|
466
|
+
Rb::AST::EmptyNode.new(self.class.name,@location)
|
477
467
|
end
|
478
468
|
end
|
479
469
|
{% end %}
|