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_tokenizer.cpp | |
parent | f89641907f8b45941f5e67891936ee8050a3ef92 (diff) | |
download | redot-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_tokenizer.cpp')
-rw-r--r-- | modules/gdscript/gd_tokenizer.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/modules/gdscript/gd_tokenizer.cpp b/modules/gdscript/gd_tokenizer.cpp index 5e1a48ae86..f4e0cc8e29 100644 --- a/modules/gdscript/gd_tokenizer.cpp +++ b/modules/gdscript/gd_tokenizer.cpp @@ -90,6 +90,7 @@ const char *GDTokenizer::token_names[TK_MAX] = { "func", "class", "extends", + "is", "onready", "tool", "static", @@ -864,6 +865,7 @@ void GDTokenizerText::_advance() { { TK_PR_FUNCTION, "func" }, { TK_PR_CLASS, "class" }, { TK_PR_EXTENDS, "extends" }, + { TK_PR_IS, "is" }, { TK_PR_ONREADY, "onready" }, { TK_PR_TOOL, "tool" }, { TK_PR_STATIC, "static" }, |