HaxeFoundation / HaxeFoundation/haxe

Missing AST transformation with array assignment in value-place

Open
#5,077 4 comments 0 reactions 1 assignee Claimed by @Simn View on GitHub
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

``` haxe
using StringTools;

class Main {
static function test(inp:String){
var p = inp.split("."),
v = p[0].length - ( p[0] = p[0].substr(0,1)).length;
trace(v);
}

static function main() test("-----.------");
}
```

Dump:

```
= function(inp:String) = {
var p = inp.split(".");
var _hx_tmp = p[0].length;
var v = _hx_tmp - (p[0] = p[0].substr(0,1)).length;
haxe.Log.trace(v,{fileName : "Main.hx",lineNumber : 7,className : "Main",methodName : "test"});
}
```

C++:

``` c++
Int v = (_hx_tmp - p[(int)0] = p->__get((int)0).substr((int)0,(int)1).length);
```

Error:

```
./src/Main.cpp(34) : error C2106: '=' : left operand must be l-value
```

I'll see what I can do.

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.