esmangle icon indicating copy to clipboard operation
esmangle copied to clipboard

constant folding

Open michaelficarra opened this issue 13 years ago • 3 comments

Just a general reminder to do constant folding.

  • "a" + "b" -> "ab"
  • 0 + 1 -> 1
  • typeof function(){} -> "function"
  • etc.

michaelficarra avatar Sep 12 '12 21:09 michaelficarra

At first, we should implement tree based constant folindg (not considering variable)

Constellation avatar Sep 17 '12 15:09 Constellation

I've implemented tree-based-constant-folding pass! 9184d32c1acdec07a0355165573cd3458c905892

Constellation avatar Sep 18 '12 21:09 Constellation

In tree-based-constant-folding pass, additionally we should handle above pass,

  • function expression
  • array expression
  • object expression
typeof function() { }

Constellation avatar Sep 18 '12 21:09 Constellation