HaxeFoundation / HaxeFoundation/haxe

[lua] inline function as param not working as expected

Open
#7,121 3 comments 0 reactions 1 assignee Claimed by @jdonaldson View on GitHub
platform-lua
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

Code:

```haxe
class TestInline {

static public function main()
{
new TestInline();
}

function new()
{
var array = [0, 1, 2, 3];
this.push = this._push;
this.push(shrink(array, 2));
}

public var push:Array->Void;
function _push(array:Array)
{
trace(array); // expected [0,1], but is null on lua
}

static inline public function shrink(buf:Array, size:Int) {
if (buf.length != size) {
buf = buf.slice(0, size);
}
return buf;
}
}
```

This should output `[0,1]`, but traces `null` for the lua target.

Tested with haxe 4.0.0 @ 3018ab109, lua 5.3.4

cc @jdonaldson

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.