diff options
author | Andreas Haas <liu.gam3@gmail.com> | 2017-05-26 19:45:39 +0200 |
---|---|---|
committer | Andreas Haas <liu.gam3@gmail.com> | 2017-05-27 10:59:59 +0200 |
commit | 015d36d18bb3f9fe21452a470aac2c3a3597b92f (patch) | |
tree | 5aa84e4c0f731fb0b788509a3da700513614957a /modules/gdscript/gd_compiler.cpp | |
parent | f89641907f8b45941f5e67891936ee8050a3ef92 (diff) |
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_compiler.cpp')
-rw-r--r-- | modules/gdscript/gd_compiler.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/gdscript/gd_compiler.cpp b/modules/gdscript/gd_compiler.cpp index 12b43d6060..d4ede4cb17 100644 --- a/modules/gdscript/gd_compiler.cpp +++ b/modules/gdscript/gd_compiler.cpp @@ -1014,7 +1014,7 @@ int GDCompiler::_parse_expression(CodeGen &codegen, const GDParser::Node *p_expr } } break; - case GDParser::OperatorNode::OP_EXTENDS: { + case GDParser::OperatorNode::OP_IS: { ERR_FAIL_COND_V(on->arguments.size() != 2, false); |