Skip to content

calling method with std::list throws assertion error #8

@klvnptr

Description

@klvnptr

I have the following Wren code in "main.wren"

class MyClass {
    construct new() { }

    flyTo(city) {
        System.print("Flying to %(city)")
    }

    flyToList(cities) {
        System.print("flyToList.count %(cities.count)")

        cities.each { |word|
            System.print("Flying to %(word) FF")
        }
    }
}

var t = MyClass.new()

And I have the following C++ code:

int main()
{
    const char *module = "main";
    std::string src = read_main("src/main.wren");

    wren::VM vm;

    vm.runFromSource(module, src);

    std::list<int> ml;
    ml.push_back(2);

    wren::Method listCall = vm.find(module, "t").func("flyToList(_)");
    listCall(ml);

    return 0;
}

Running the C++ code throws the following error:

[../wren/src/vm/wren_vm.c:1658] Assert failed in validateApiSlot(): Not that many slots.

If I remove the ml.push_back(2); line, than everything is okay:

flyToList.count 0

What am I getting wrong?
Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions