File tree 2 files changed +15
-1
lines changed
2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -423,11 +423,22 @@ class Crystal::CodeGenVisitor
423
423
def codegen_primitive_pointer_malloc (node, target_def, call_args)
424
424
type = node.type.as(PointerInstanceType )
425
425
llvm_type = llvm_embedded_type(type .element_type)
426
+
427
+ old_debug_location = @current_debug_location
428
+ if @debug .line_numbers? && (location = node.location)
429
+ set_current_debug_location(node.location)
430
+ end
431
+
426
432
if type .element_type.has_inner_pointers?
427
433
last = array_malloc(llvm_type, call_args[1 ])
428
434
else
429
435
last = array_malloc_atomic(llvm_type, call_args[1 ])
430
436
end
437
+
438
+ if @debug .line_numbers?
439
+ set_current_debug_location(old_debug_location)
440
+ end
441
+
431
442
last
432
443
end
433
444
Original file line number Diff line number Diff line change @@ -355,7 +355,10 @@ class Crystal::TopLevelVisitor < Crystal::SemanticVisitor
355
355
node.raise " method marked as Primitive must have an empty body"
356
356
end
357
357
358
- node.body = Primitive .new(value)
358
+ primitive = Primitive .new(value)
359
+ primitive.location = node.location
360
+
361
+ node.body = primitive
359
362
end
360
363
361
364
def visit (node : Include )
You can’t perform that action at this time.
0 commit comments