Browse Source

Issue #823 - Change semantics of `disabled` attribute to not evaluate any of the parameters at run time

gingerBill 4 years ago
parent
commit
8239cd34eb
2 changed files with 14 additions and 0 deletions
  1. 7 0
      src/ir.cpp
  2. 7 0
      src/llvm_backend.cpp

+ 7 - 0
src/ir.cpp

@@ -7765,6 +7765,13 @@ irValue *ir_build_call_expr(irProcedure *proc, Ast *expr) {
 		}
 		}
 	}
 	}
 
 
+	Entity *proc_entity = entity_of_node(proc_expr);
+	if (proc_entity != nullptr) {
+		if (proc_entity->flags & EntityFlag_Disabled) {
+			return nullptr;
+		}
+	}
+
 	if (value == nullptr) {
 	if (value == nullptr) {
 		value = ir_build_expr(proc, proc_expr);
 		value = ir_build_expr(proc, proc_expr);
 	}
 	}

+ 7 - 0
src/llvm_backend.cpp

@@ -9198,6 +9198,13 @@ lbValue lb_build_call_expr(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);
 	}
 	}