| 5462 | } |
| 5463 | |
| 5464 | bool GDScriptParser::DataType::can_reference(const GDScriptParser::DataType &p_other) const { |
| 5465 | if (p_other.is_meta_type) { |
| 5466 | return false; |
| 5467 | } else if (builtin_type != p_other.builtin_type) { |
| 5468 | return false; |
| 5469 | } else if (builtin_type != Variant::OBJECT) { |
| 5470 | return true; |
| 5471 | } |
| 5472 | |
| 5473 | if (native_type == StringName()) { |
| 5474 | return true; |
| 5475 | } else if (p_other.native_type == StringName()) { |
| 5476 | return false; |
| 5477 | } else if (native_type != p_other.native_type && !ClassDB::is_parent_class(p_other.native_type, native_type)) { |
| 5478 | return false; |
| 5479 | } |
| 5480 | |
| 5481 | Ref<Script> script = script_type; |
| 5482 | if (kind == GDScriptParser::DataType::CLASS && script.is_null()) { |
| 5483 | Error err = OK; |
| 5484 | Ref<GDScript> scr = GDScriptCache::get_shallow_script(script_path, err); |
| 5485 | ERR_FAIL_COND_V_MSG(err, false, vformat(R"(Error while getting cache for script "%s".)", script_path)); |
| 5486 | script.reference_ptr(scr->find_class(class_type->fqcn)); |
| 5487 | } |
| 5488 | |
| 5489 | Ref<Script> script_other = p_other.script_type; |
| 5490 | if (p_other.kind == GDScriptParser::DataType::CLASS && script_other.is_null()) { |
| 5491 | Error err = OK; |
| 5492 | Ref<GDScript> scr = GDScriptCache::get_shallow_script(p_other.script_path, err); |
| 5493 | ERR_FAIL_COND_V_MSG(err, false, vformat(R"(Error while getting cache for script "%s".)", p_other.script_path)); |
| 5494 | script_other.reference_ptr(scr->find_class(p_other.class_type->fqcn)); |
| 5495 | } |
| 5496 | |
| 5497 | if (script.is_null()) { |
| 5498 | return true; |
| 5499 | } else if (script_other.is_null()) { |
| 5500 | return false; |
| 5501 | } else if (script != script_other && !script_other->inherits_script(script)) { |
| 5502 | return false; |
| 5503 | } |
| 5504 | |
| 5505 | return true; |
| 5506 | } |
| 5507 | |
| 5508 | void GDScriptParser::complete_extents(Node *p_node) { |
| 5509 | while (!nodes_in_progress.is_empty() && nodes_in_progress.back()->get() != p_node) { |
no test coverage detected