You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-09 12:50:35 +00:00
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")
```
This commit is contained in:
@@ -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" },
|
||||
|
||||
Reference in New Issue
Block a user