HaxeFoundation / HaxeFoundation/haxe

[tre] redundant local var and/or assignment for TRE-optimized local functions

Open
#8,954 0 comments 0 reactions 1 assignee Claimed by @RealyUniqueName View on GitHub
feature-tre priority-netherlands
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

```haxe
class Main {
static function main() {
function f1() {} // no local var even
f1();

function f2() {} // stored in an immediately initialized local var
f2();
f2();

function ftre() { // separate null-initialized local var + assignment
ftre();
}
ftre();
}
}
```
```js
Main.main = function() {
(function() {
})();
var f2 = function() {
};
f2();
f2();
var ftre = null;
ftre = function() {
while(true) continue;
};
ftre();
};
```

This is of course minor and happens because TRE runs long after the local var is introduced (in the typer?), but still maybe we could clean this up somehow.

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.