summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript_parser.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-01-09 13:35:54 +0100
committerGitHub <noreply@github.com>2020-01-09 13:35:54 +0100
commit05a3e0e34420cd4692b74e64a0b7660338b30bc5 (patch)
treebe9e393cc9ea809851c1378dd445e4a4c2c2fe1a /modules/gdscript/gdscript_parser.cpp
parentbe97c4cd48e2d531829798f87022ab9f9b85c1d8 (diff)
parent7d4fc79eb359263ea4239dd7cd02ab07f90971a5 (diff)
downloadredot-engine-05a3e0e34420cd4692b74e64a0b7660338b30bc5.tar.gz
Merge pull request #34946 from vnen/gdscript-ternary-warning
Add GDScript warning for standalone expression
Diffstat (limited to 'modules/gdscript/gdscript_parser.cpp')
-rw-r--r--modules/gdscript/gdscript_parser.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index fc35678e65..54e6f43917 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -8274,7 +8274,11 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
_mark_line_as_safe(op->line);
_reduce_node_type(op); // Test for safety anyway
#ifdef DEBUG_ENABLED
- _add_warning(GDScriptWarning::STANDALONE_EXPRESSION, statement->line);
+ if (op->op == OperatorNode::OP_TERNARY_IF) {
+ _add_warning(GDScriptWarning::STANDALONE_TERNARY, statement->line);
+ } else {
+ _add_warning(GDScriptWarning::STANDALONE_EXPRESSION, statement->line);
+ }
#endif // DEBUG_ENABLED
}
}