summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-11-24 23:30:40 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-11-24 23:30:40 +0100
commit8b7efd230609a35cbea68793bf9656a29ff9434d (patch)
treeff78bb689f607adf4519eddcea32dc2fc8144503
parente5e9496b4ab73f7b4355a7840172565e6d91fde9 (diff)
parent5fd382c2ab3a117c0d98690f9f1f84fbf9d27234 (diff)
Merge pull request #69134 from jquinl/export_range_int_fix
GDScript: Properly respect `int` type hint for `@export_range`
-rw-r--r--modules/gdscript/gdscript_parser.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index 7f2f49f336..7074520a34 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -3740,6 +3740,12 @@ bool GDScriptParser::export_annotations(const AnnotationNode *p_annotation, Node
// This is called after the analyzer is done finding the type, so this should be set here.
DataType export_type = variable->get_datatype();
+ if (p_annotation->name == SNAME("@export_range")) {
+ if (export_type.builtin_type == Variant::INT) {
+ variable->export_info.type = Variant::INT;
+ }
+ }
+
if (p_annotation->name == SNAME("@export")) {
if (variable->datatype_specifier == nullptr && variable->initializer == nullptr) {
push_error(R"(Cannot use simple "@export" annotation with variable without type or initializer, since type can't be inferred.)", p_annotation);