summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gd_parser.cpp
diff options
context:
space:
mode:
authorAndreas Haas <liu.gam3@gmail.com>2017-05-26 19:45:39 +0200
committerAndreas Haas <liu.gam3@gmail.com>2017-05-27 10:59:59 +0200
commit015d36d18bb3f9fe21452a470aac2c3a3597b92f (patch)
tree5aa84e4c0f731fb0b788509a3da700513614957a /modules/gdscript/gd_parser.cpp
parentf89641907f8b45941f5e67891936ee8050a3ef92 (diff)
downloadredot-engine-015d36d18bb3f9fe21452a470aac2c3a3597b92f.tar.gz
GDScript: Use "is" keyword for type checking.
Replaces the `extends` keyword with `is` in the context of testing for type compatibility. `extends` is still used for declaring class inheritance. Example: ```gdscript extends Node2D func _input(ev): if ev is InputEventKey: print("yay, key event") ```
Diffstat (limited to 'modules/gdscript/gd_parser.cpp')
-rw-r--r--modules/gdscript/gd_parser.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp
index 4ae62eb1d0..d64cd86de6 100644
--- a/modules/gdscript/gd_parser.cpp
+++ b/modules/gdscript/gd_parser.cpp
@@ -1077,7 +1077,7 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool
case GDTokenizer::TK_OP_BIT_AND: op = OperatorNode::OP_BIT_AND; break;
case GDTokenizer::TK_OP_BIT_OR: op = OperatorNode::OP_BIT_OR; break;
case GDTokenizer::TK_OP_BIT_XOR: op = OperatorNode::OP_BIT_XOR; break;
- case GDTokenizer::TK_PR_EXTENDS: op = OperatorNode::OP_EXTENDS; break;
+ case GDTokenizer::TK_PR_IS: op = OperatorNode::OP_IS; break;
case GDTokenizer::TK_CF_IF: op = OperatorNode::OP_TERNARY_IF; break;
case GDTokenizer::TK_CF_ELSE: op = OperatorNode::OP_TERNARY_ELSE; break;
default: valid = false; break;
@@ -1117,7 +1117,7 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool
switch (expression[i].op) {
- case OperatorNode::OP_EXTENDS:
+ case OperatorNode::OP_IS:
priority = -1;
break; //before anything
@@ -1420,7 +1420,7 @@ GDParser::Node *GDParser::_reduce_expression(Node *p_node, bool p_to_const) {
}
}
- if (op->op == OperatorNode::OP_EXTENDS) {
+ if (op->op == OperatorNode::OP_IS) {
//nothing much
return op;
}