Browse Source

Made 'faked' static reference undef so it's not detected as constant

Brian Fiete 4 months ago
parent
commit
11ccb876a3
2 changed files with 3 additions and 1 deletions
  1. 2 0
      IDEHelper/Compiler/BfIRBuilder.cpp
  2. 1 1
      IDEHelper/Compiler/BfModule.cpp

+ 2 - 0
IDEHelper/Compiler/BfIRBuilder.cpp

@@ -664,6 +664,8 @@ bool BfIRConstHolder::IsConstValue(BfIRValue value)
 
 	if (constant->mConstType == BfConstType_GlobalVar)
 		return false;
+	if (constant->mConstType == BfConstType_Undef)
+		return false;
 
 	return true;
 }

+ 1 - 1
IDEHelper/Compiler/BfModule.cpp

@@ -15752,7 +15752,7 @@ BfTypedValue BfModule::ReferenceStaticField(BfFieldInstance* fieldInstance)
 	{
 		// Just fake it for the extern and unspecialized modules
 		// We can't do this for compilation because unreified methods with default params need to get actual global variable refs
-		return BfTypedValue(mBfIRBuilder->CreateConstNull(), fieldInstance->GetResolvedType(), true);
+		return BfTypedValue(mBfIRBuilder->CreateUndefValue(mBfIRBuilder->GetPrimitiveType(BfTypeCode_NullPtr)), fieldInstance->GetResolvedType(), true);
 	}
 
 	BfIRValue* globalValuePtr = NULL;