Commit graph

4 commits

Author SHA1 Message Date
Eric Swanson
36d8603666 Add elvis operator:
a ?: b

Evaluates to a if a is true (not: false, 0, undefined, etc)
Otherwise evaluates to b

Short-circuit evaluation
2020-04-29 02:50:11 -07:00
Eric Swanson
0e4d54bf2b
Remove TYP_USERFUNC tokens during expression optimization (#136)
* Remove TYP_USERFUNC tokens during expression optimization, rather than when emitting tokens
2020-04-29 02:38:52 -07:00
Eric Swanson
88e22c1fcb
Make getUserArgs optimize arguments, rename Expression::eat2 -> consume_tokens (#134)
* getUserArgs: optimize arguments immediately

This would have also happened when the whole expression (function call + arguments) was processed.

Doing it here reduces the number of places that call IIP directly.

* remove dead code Expression::eat

* rename Expression::eat2() to consume_tokens(), and modernize
2020-04-28 14:02:16 -07:00
Eric Swanson
df5c3ced7b Move Expression class to expression.cpp/h 2020-04-24 13:37:26 -07:00