elamaunt / GDShrapt

GDShrapt is object-oriented one-pass parser of GDScript programming language.
MIT License
38 stars 4 forks source link

Stackoverflow exeption on Array[Type] #1

Closed Jemy191 closed 10 months ago

Jemy191 commented 1 year ago

Parsing this file make an Stackoverflow exeption:

class_name ChooseDeck
extends Control

@export var deckEntryScene: PackedScene
@export var deckBuilderScene: PackedScene

signal deck_choosen(deck: int)

func setup(decks: Array[DeckData]): <<<<<<<< Stackoverflow happend here because of : Array[DeckData]
    for deckVar in decks:
        var deck := deckVar as DeckData
        var deckEntry = deckEntryScene.instantiate() as DeckEntry
        $FlowContainer.add_child(deckEntry)
        deckEntry.setup(deck.Name, deck.Id, self)

func choose_deck() -> int:
    visible = true
    var deckId = await deck_choosen
    visible = false
    return deckId

func new_deck() -> void:
    SceneLoader.goto_deckbuilder(true)

Parsing the file is fine except when I add : Array[DeckData] in func setup

DeckData is a GodotObject defined in C#

I use version 3.1.2 alpha

Edit: Does the package only work with GdScript v1? Because I am using Godot 4.1 with GdScript v2 you should add that to the readme.

elamaunt commented 1 year ago

Thanks for the sample. Typed arrays is godot 4.0 feature. The project currently supports 3.5. The update to 4.0 is under WIP. I will fix your SO error anyway soon.

Jemy191 commented 1 year ago

Thanks I will check that when it will be ready

elamaunt commented 10 months ago

GDScript 2.0 support is released with GDShrapt.Reader 4.0.0. Your StackOverflow error is fixed also.