HaxeFoundation / HaxeFoundation/haxe
[tre] redundant local var and/or assignment for TRE-optimized local functions
Open
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
Assessment
This issue has not been assessed yet.