diff options
Diffstat (limited to 'modules/gdscript')
-rw-r--r-- | modules/gdscript/doc_classes/@GDScript.xml | 7 | ||||
-rw-r--r-- | modules/gdscript/doc_classes/GDScript.xml | 2 | ||||
-rw-r--r-- | modules/gdscript/doc_classes/GDScriptFunctionState.xml | 4 | ||||
-rw-r--r-- | modules/gdscript/doc_classes/GDScriptNativeClass.xml | 2 | ||||
-rw-r--r-- | modules/gdscript/gdscript_function.cpp | 4 | ||||
-rw-r--r-- | modules/gdscript/gdscript_functions.cpp | 6 | ||||
-rw-r--r-- | modules/gdscript/gdscript_parser.cpp | 13 | ||||
-rw-r--r-- | modules/gdscript/language_server/gdscript_extend_parser.cpp | 2 |
8 files changed, 21 insertions, 19 deletions
diff --git a/modules/gdscript/doc_classes/@GDScript.xml b/modules/gdscript/doc_classes/@GDScript.xml index c4b7e4887e..b947d95fac 100644 --- a/modules/gdscript/doc_classes/@GDScript.xml +++ b/modules/gdscript/doc_classes/@GDScript.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="@GDScript" category="Core" version="3.2"> +<class name="@GDScript" version="4.0"> <brief_description> Built-in GDScript functions. </brief_description> @@ -39,12 +39,11 @@ <argument index="1" name="alpha" type="float" default="1.0"> </argument> <description> - Returns a color according to the standardised [code]name[/code] with [code]alpha[/code] ranging from 0 to 1. + Returns a color according to the standardized [code]name[/code] with [code]alpha[/code] ranging from 0 to 1. [codeblock] red = ColorN("red", 1) [/codeblock] - Supported color names: - "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflower", "cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "webgray", "green", "webgreen", "greenyellow", "honeydew", "hotpink", "indianred", "indigo", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrod", "lightgray", "lightgreen", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "webmaroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navyblue", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "webpurple", "rebeccapurple", "red", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen". + Supported color names are the same as the constants defined in [Color]. </description> </method> <method name="abs"> diff --git a/modules/gdscript/doc_classes/GDScript.xml b/modules/gdscript/doc_classes/GDScript.xml index 8e175a7ab8..5d0e93e117 100644 --- a/modules/gdscript/doc_classes/GDScript.xml +++ b/modules/gdscript/doc_classes/GDScript.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="GDScript" inherits="Script" category="Core" version="3.2"> +<class name="GDScript" inherits="Script" version="4.0"> <brief_description> A script implemented in the GDScript programming language. </brief_description> diff --git a/modules/gdscript/doc_classes/GDScriptFunctionState.xml b/modules/gdscript/doc_classes/GDScriptFunctionState.xml index 690953108f..9a73764646 100644 --- a/modules/gdscript/doc_classes/GDScriptFunctionState.xml +++ b/modules/gdscript/doc_classes/GDScriptFunctionState.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="GDScriptFunctionState" inherits="Reference" category="Core" version="3.2"> +<class name="GDScriptFunctionState" inherits="Reference" version="4.0"> <brief_description> State of a function call after yielding. </brief_description> @@ -33,7 +33,7 @@ </methods> <signals> <signal name="completed"> - <argument index="0" name="result" type="Nil"> + <argument index="0" name="result" type="Variant"> </argument> <description> </description> diff --git a/modules/gdscript/doc_classes/GDScriptNativeClass.xml b/modules/gdscript/doc_classes/GDScriptNativeClass.xml index 70583d47a7..0a8982de8e 100644 --- a/modules/gdscript/doc_classes/GDScriptNativeClass.xml +++ b/modules/gdscript/doc_classes/GDScriptNativeClass.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="GDScriptNativeClass" inherits="Reference" category="Core" version="3.2"> +<class name="GDScriptNativeClass" inherits="Reference" version="4.0"> <brief_description> </brief_description> <description> diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp index 524be480d7..452b1933eb 100644 --- a/modules/gdscript/gdscript_function.cpp +++ b/modules/gdscript/gdscript_function.cpp @@ -1550,10 +1550,8 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a OPCODE_BREAK; } -// Enable for debugging -#if 0 +#if 0 // Enable for debugging. default: { - err_text = "Illegal opcode " + itos(_code_ptr[ip]) + " at address " + itos(ip); OPCODE_BREAK; } diff --git a/modules/gdscript/gdscript_functions.cpp b/modules/gdscript/gdscript_functions.cpp index 01d62a1c62..c398633dc5 100644 --- a/modules/gdscript/gdscript_functions.cpp +++ b/modules/gdscript/gdscript_functions.cpp @@ -800,7 +800,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ } String message = *p_args[0]; - ERR_PRINTS(message); + ERR_PRINT(message); r_ret = Variant(); } break; case PUSH_WARNING: { @@ -814,7 +814,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ } String message = *p_args[0]; - WARN_PRINTS(message); + WARN_PRINT(message); r_ret = Variant(); } break; case VAR_TO_STR: { @@ -1260,7 +1260,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ if (err != OK) { r_ret = Variant(); - ERR_PRINTS(vformat("Error parsing JSON at line %s: %s", errl, errs)); + ERR_PRINT(vformat("Error parsing JSON at line %s: %s", errl, errs)); } } break; diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 5c2e7137bf..d125da5b79 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -1868,6 +1868,10 @@ GDScriptParser::Node *GDScriptParser::_reduce_expression(Node *p_node, bool p_to _set_error("Can't assign to constant", tokenizer->get_token_line() - 1); error_line = op->line; return op; + } else if (op->arguments[0]->type == Node::TYPE_SELF) { + _set_error("Can't assign to self.", op->line); + error_line = op->line; + return op; } if (op->arguments[0]->type == Node::TYPE_OPERATOR) { @@ -5404,12 +5408,12 @@ void GDScriptParser::_determine_inheritance(ClassNode *p_class, bool p_recursive ident += ("." + subclass); - if (base_script->get_subclasses().has(subclass)) { + if (find_subclass->get_subclasses().has(subclass)) { - find_subclass = base_script->get_subclasses()[subclass]; - } else if (base_script->get_constants().has(subclass)) { + find_subclass = find_subclass->get_subclasses()[subclass]; + } else if (find_subclass->get_constants().has(subclass)) { - Ref<GDScript> new_base_class = base_script->get_constants()[subclass]; + Ref<GDScript> new_base_class = find_subclass->get_constants()[subclass]; if (new_base_class.is_null()) { _set_error("Constant isn't a class: " + ident, p_class->line); return; @@ -6290,6 +6294,7 @@ GDScriptParser::DataType GDScriptParser::_reduce_node_type(Node *p_node) { node_type.has_type = true; node_type.kind = DataType::CLASS; node_type.class_type = current_class; + node_type.is_constant = true; } break; case Node::TYPE_IDENTIFIER: { IdentifierNode *id = static_cast<IdentifierNode *>(p_node); diff --git a/modules/gdscript/language_server/gdscript_extend_parser.cpp b/modules/gdscript/language_server/gdscript_extend_parser.cpp index 701809e755..0f6f13944b 100644 --- a/modules/gdscript/language_server/gdscript_extend_parser.cpp +++ b/modules/gdscript/language_server/gdscript_extend_parser.cpp @@ -757,7 +757,7 @@ Dictionary ExtendGDScriptParser::dump_class_api(const GDScriptParser::ClassNode Array static_functions; for (int i = 0; i < p_class->static_functions.size(); ++i) { - static_functions.append(dump_function_api(p_class->functions[i])); + static_functions.append(dump_function_api(p_class->static_functions[i])); } class_api["static_functions"] = static_functions; |