Browse Source

Fix `@(disable=...)`

gingerBill 3 years ago
parent
commit
8023c8abc7
1 changed files with 9 additions and 13 deletions
  1. 9 13
      src/llvm_backend_proc.cpp

+ 9 - 13
src/llvm_backend_proc.cpp

@@ -823,12 +823,6 @@ lbValue lb_emit_call(lbProcedure *p, lbValue value, Array<lbValue> const &args,
 	GB_ASSERT(pt->kind == Type_Proc);
 	GB_ASSERT(pt->kind == Type_Proc);
 	Type *results = pt->Proc.results;
 	Type *results = pt->Proc.results;
 
 
-	if (p->entity != nullptr) {
-		if (p->entity->flags & EntityFlag_Disabled) {
-			return {};
-		}
-	}
-
 	lbAddr context_ptr = {};
 	lbAddr context_ptr = {};
 	if (pt->Proc.calling_convention == ProcCC_Odin) {
 	if (pt->Proc.calling_convention == ProcCC_Odin) {
 		context_ptr = lb_find_or_generate_context_ptr(p);
 		context_ptr = lb_find_or_generate_context_ptr(p);
@@ -2280,6 +2274,15 @@ lbValue lb_build_call_expr_internal(lbProcedure *p, Ast *expr) {
 	// NOTE(bill): Regular call
 	// NOTE(bill): Regular call
 	lbValue value = {};
 	lbValue value = {};
 	Ast *proc_expr = unparen_expr(ce->proc);
 	Ast *proc_expr = unparen_expr(ce->proc);
+
+	Entity *proc_entity = entity_of_node(proc_expr);
+	if (proc_entity != nullptr) {
+		if (proc_entity->flags & EntityFlag_Disabled) {
+			GB_ASSERT(tv.type == nullptr);
+			return {};
+		}
+	}
+
 	if (proc_expr->tav.mode == Addressing_Constant) {
 	if (proc_expr->tav.mode == Addressing_Constant) {
 		ExactValue v = proc_expr->tav.value;
 		ExactValue v = proc_expr->tav.value;
 		switch (v.kind) {
 		switch (v.kind) {
@@ -2306,13 +2309,6 @@ lbValue lb_build_call_expr_internal(lbProcedure *p, Ast *expr) {
 		}
 		}
 	}
 	}
 
 
-	Entity *proc_entity = entity_of_node(proc_expr);
-	if (proc_entity != nullptr) {
-		if (proc_entity->flags & EntityFlag_Disabled) {
-			return {};
-		}
-	}
-
 	if (value.value == nullptr) {
 	if (value.value == nullptr) {
 		value = lb_build_expr(p, proc_expr);
 		value = lb_build_expr(p, proc_expr);
 	}
 	}