1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-29 16:16:38 +00:00

Merge pull request #72979 from dalexeev/gds-annotation-parsing

GDScript: Fix and improve annotation parsing
This commit is contained in:
Yuri Sizov
2023-04-17 17:14:58 +02:00
committed by GitHub
5 changed files with 89 additions and 17 deletions

View File

@@ -0,0 +1,4 @@
@export_enum("A",, "B", "C") var a
func test():
pass

View File

@@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Expected expression as the annotation argument.

View File

@@ -0,0 +1,48 @@
extends Node
@export_enum("A", "B", "C") var a0
@export_enum("A", "B", "C",) var a1
@export_enum(
"A",
"B",
"C"
) var a2
@export_enum(
"A",
"B",
"C",
) var a3
@export
var a4: int
@export()
var a5: int
@export() var a6: int
@warning_ignore("onready_with_export") @onready @export var a7: int
@warning_ignore("onready_with_export") @onready() @export() var a8: int
@warning_ignore("onready_with_export")
@onready
@export
var a9: int
@warning_ignore("onready_with_export")
@onready()
@export()
var a10: int
@warning_ignore("onready_with_export")
@onready()
@export()
var a11: int
func test():
for property in get_property_list():
if property.usage & PROPERTY_USAGE_SCRIPT_VARIABLE:
print(property)

View File

@@ -0,0 +1,13 @@
GDTEST_OK
{ "name": "a0", "class_name": &"", "type": 2, "hint": 2, "hint_string": "A,B,C", "usage": 4102 }
{ "name": "a1", "class_name": &"", "type": 2, "hint": 2, "hint_string": "A,B,C", "usage": 4102 }
{ "name": "a2", "class_name": &"", "type": 2, "hint": 2, "hint_string": "A,B,C", "usage": 4102 }
{ "name": "a3", "class_name": &"", "type": 2, "hint": 2, "hint_string": "A,B,C", "usage": 4102 }
{ "name": "a4", "class_name": &"", "type": 2, "hint": 0, "hint_string": "int", "usage": 4102 }
{ "name": "a5", "class_name": &"", "type": 2, "hint": 0, "hint_string": "int", "usage": 4102 }
{ "name": "a6", "class_name": &"", "type": 2, "hint": 0, "hint_string": "int", "usage": 4102 }
{ "name": "a7", "class_name": &"", "type": 2, "hint": 0, "hint_string": "int", "usage": 4102 }
{ "name": "a8", "class_name": &"", "type": 2, "hint": 0, "hint_string": "int", "usage": 4102 }
{ "name": "a9", "class_name": &"", "type": 2, "hint": 0, "hint_string": "int", "usage": 4102 }
{ "name": "a10", "class_name": &"", "type": 2, "hint": 0, "hint_string": "int", "usage": 4102 }
{ "name": "a11", "class_name": &"", "type": 2, "hint": 0, "hint_string": "int", "usage": 4102 }