aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-02-02 15:03:00 -0500
committerAndrew Kelley <superjoe30@gmail.com>2017-02-02 15:03:21 -0500
commit8b1c6d8b76ad1861f963fc7a2a079af5d8729a70 (patch)
tree904a60a263aed9a8dfb5c02136cead6a66599591 /src/ir.cpp
parent2b88441295d39d3e988c0771b6ad64531948ff0a (diff)
downloadzig-8b1c6d8b76ad1861f963fc7a2a079af5d8729a70.tar.gz
zig-8b1c6d8b76ad1861f963fc7a2a079af5d8729a70.zip
fix ability to call method on variable at compile time
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index b0908dd7cf..e37cee2e07 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -7808,9 +7808,15 @@ static TypeTableEntry *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *cal
size_t next_proto_i = 0;
if (first_arg_ptr) {
- IrInstruction *first_arg = ir_get_deref(ira, first_arg_ptr, first_arg_ptr);
- if (first_arg->value.type->id == TypeTableEntryIdInvalid)
- return ira->codegen->builtin_types.entry_invalid;
+ IrInstruction *first_arg;
+ assert(first_arg_ptr->value.type->id == TypeTableEntryIdPointer);
+ if (handle_is_ptr(first_arg_ptr->value.type->data.pointer.child_type)) {
+ first_arg = first_arg_ptr;
+ } else {
+ first_arg = ir_get_deref(ira, first_arg_ptr, first_arg_ptr);
+ if (first_arg->value.type->id == TypeTableEntryIdInvalid)
+ return ira->codegen->builtin_types.entry_invalid;
+ }
if (!ir_analyze_fn_call_inline_arg(ira, fn_proto_node, first_arg, &exec_scope, &next_proto_i))
return ira->codegen->builtin_types.entry_invalid;