You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (!base_class->is_abstract && base_class != p_class) {
1414
+
break;
1415
+
}
1416
+
for (GDScriptParser::ClassNode::Member member : base_class->members) {
1417
+
if (member.type == GDScriptParser::ClassNode::Member::FUNCTION) {
1418
+
if (member.function->is_abstract) {
1419
+
if (base_class == p_class) {
1420
+
push_error(vformat(R"*(Class %s is not abstract but contains abstract methods. Mark the class as @abstract, or remove @abstract from all methods in this class.)*", p_class->identifier == nullptr ? p_class->fqcn.get_file() : String(p_class->identifier->name)), p_class);
push_error(vformat(R"*(Class %s must implement "%s" and other methods from inherited abstract classes, or be marked as @abstract.)*", p_class->identifier == nullptr ? p_class->fqcn.get_file() : String(p_class->identifier->name), vformat(R"(%s::%s)", base_class->identifier == nullptr ? base_class->fqcn.get_file() : String(base_class->identifier->name), member.function->identifier->name)), p_class);
if (p_function->body->statements.size() != 1 || p_function->body->statements[0]->type != GDScriptParser::Node::PASS) {
1835
+
push_error(vformat(R"*(Abstract method %s cannot have an implementation. The method body must contain only a single "pass" statement.)*", p_function->identifier->name), p_function);
1836
+
}
1837
+
}
1838
+
1798
1839
if (!p_function->get_datatype().is_hard_type() && p_function->body->get_datatype().is_set()) {
1799
1840
// Use the suite inferred type if return isn't explicitly set.
ERR_FAIL_COND_V_MSG(p_target->type != Node::CLASS, false, R"("@abstract" annotation can only be applied to classes.)");
3889
+
//ERR_FAIL_COND_V_MSG(p_target->type != Node::CLASS && p_target->type != Node::FUNCTION, false, R"("@abstract" annotation can only be applied to classes and functions.)");
3890
3890
// Note: Use `p_target`, **not** `p_class`, because when `p_target` is a class then `p_class` refers to the parent class.
0 commit comments