dplassgit / d2lang

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

Write a NotNullOptimizer #346

Open dplassgit opened 3 months ago

dplassgit commented 3 months ago

Similar to constant propagation optimizer. If a variable is known to be not null, propagate its non nullness. This applies to string operations (substring, indexes), "new" operations and input.

dplassgit commented 2 months ago

Similarly, once a variable is tested for null, it doesn't have to be tested for null again (provided it hasn't changed between the checks.)