-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Example with variables:
var a = 1, b = 1;
if (x1) {
a = 2;
b = 2;
if (x2) {
a++;
b++;
}
}
if (x3) {
a = 3;
b = 3;
}
return a === b; //optimize to trueExample without variables:
(x ? 1 : 0) * 0; // 0, if x has no side effectThe steps to evaluate a === b are:
- Evaluate a:
- Find decision points (x1,x2,x3) affecting "a" and build a tree-like data structure.
- Iterate the tree and create a map of possible values where decision list is the key.
- Evaluate b like a.
- Evaluate a === b:
- Merge the possible values map of "a" and "b".
- Iterate the merged decision map.
- Create a new map by evaluating with "a" and "b" values.