dplassgit / d2lang

D2 is a strongly-typed, statically-typed, (mostly) inferred-type compiled language.
MIT License
5 stars 1 forks source link

Optimize function calls #334

Closed dplassgit closed 3 weeks ago

dplassgit commented 1 month ago
__temp1 = size()
__longtemp2 = __temp1

should be

__longtemp2 = size()

It's like a constant propagation but it's not a constant.

dplassgit commented 1 month ago

https://github.com/dplassgit/d2lang/blob/trunk/src/com/plasstech/lang/d2/optimize/TempPropagationOptimizer.java would be the place