Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/compiler/crystal/codegen/call.cr
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,10 @@ class Crystal::CodeGenVisitor

# Create self var if available
if node_obj
new_vars["%self"] = LLVMVar.new(@last, node_obj.type, true)
# call `#remove_indirection` here so that the downcast call in
# `#visit(Var)` doesn't spend time expanding module types again and again
# (it should be the only use site of `node_obj.type`)
new_vars["%self"] = LLVMVar.new(@last, node_obj.type.remove_indirection, true)
end

# Get type if of args and create arg vars
Expand All @@ -359,6 +362,10 @@ class Crystal::CodeGenVisitor

is_super = node.super?

# call `#remove_indirection` here so that the `match_type_id` below doesn't
# spend time expanding module types again and again
owner = owner.remove_indirection unless is_super

with_cloned_context do
context.vars = new_vars

Expand Down