summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Marques <george@gmarqu.es>2019-01-15 16:03:56 -0200
committerGeorge Marques <george@gmarqu.es>2019-01-15 16:03:56 -0200
commit4d1551dbb563a2ad581ea2919f2a2cd08611491c (patch)
treed350f963187171e39bd2f1141d3908e9287667e2
parent7d5c970eff252db7daa1ece449b74afef8f6a561 (diff)
GDScript autocomplete: don't carry values when guessing from `is`
Guessing the type from an `is` operator should no be considered an assigment. This would cause crashes in certain scenarios.
-rw-r--r--modules/gdscript/gdscript_editor.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index 64678c7240..08ad101967 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -1181,7 +1181,11 @@ static bool _guess_identifier_type(const GDScriptCompletionContext &p_context, c
c.line = op->line;
c.block = blk;
if (_guess_expression_type(p_context, op->arguments[1], r_type)) {
- r_type.type.is_meta_type = false;
+ r_type.type.is_meta_type = false; // Right-hand of `is` will be a meta type, but the left-hand value is not
+ // Not an assignment, it shouldn't carry any value
+ r_type.value = Variant();
+ r_type.assigned_expression = NULL;
+
return true;
}
}