Merge pull request #120028 from HolonProduction/gdscript/blacklist-internal-classes
GDScript: Exclude `globals` internal classes in the analyzer
This commit is contained in:
3 files changed
+15
-5
No files matched your search
@@ -4632,11 +4632,15 @@ void GDScriptAnalyzer::reduce_identifier(GDScriptParser::IdentifierNode *p_ident
|
||||
}
|
||||
|
||||
if (GDScriptLanguage::get_singleton()->has_any_global_constant(name)) {
|
||||
Variant constant = GDScriptLanguage::get_singleton()->get_any_global_constant(name);
|
||||
p_identifier->set_datatype(type_from_variant(constant, p_identifier));
|
||||
p_identifier->is_constant = true;
|
||||
p_identifier->reduced_value = constant;
|
||||
return;
|
||||
// We checked for `ClassDB` classes above. Any `ClassDB` class that reaches this point is not exposed and should not be accessible.
|
||||
// TODO: Remove this check once `globals` does only contain publicly available things.
|
||||
if (!ClassDB::class_exists(name)) {
|
||||
Variant constant = GDScriptLanguage::get_singleton()->get_any_global_constant(name);
|
||||
p_identifier->set_datatype(type_from_variant(constant, p_identifier));
|
||||
p_identifier->is_constant = true;
|
||||
p_identifier->reduced_value = constant;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (CoreConstants::is_global_enum(name)) {
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
func test():
|
||||
print(GDScriptFunctionState)
|
||||
print(GDScriptNativeClass)
|
||||
@@ -0,0 +1,3 @@
|
||||
GDTEST_ANALYZER_ERROR
|
||||
>> ERROR at line 2: Identifier "GDScriptFunctionState" not declared in the current scope.
|
||||
>> ERROR at line 3: Identifier "GDScriptNativeClass" not declared in the current scope.
|
||||
Reference in new issue
Block a user