Created
March 22, 2012 17:06
-
-
Save ejamesc/2159782 to your computer and use it in GitHub Desktop.
Assignment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public StoreAndValue eval(Store s, Environment e) { | |
| StoreAndValue s_and_v = rightHandSide.eval(s, e); | |
| int loc = s.newLocation(); | |
| // Be careful of this. It might be wrong, though it works now | |
| e.extendDestructive(leftHandSide, loc); | |
| if (s_and_v.value instanceof BoolValue) { | |
| BoolValue res = (BoolValue) s_and_v.value; | |
| s = s.extend(loc, res); | |
| return new StoreAndValue(s, res); | |
| } else if (s_and_v.value instanceof IntValue) { | |
| IntValue res = (IntValue) s_and_v.value; | |
| s = s.extend(loc, res); | |
| return new StoreAndValue(s, res); | |
| } else if (s_and_v.value instanceof FunValue) { | |
| FunValue res = (FunValue) s_and_v.value; | |
| s = s.extend(loc, res); | |
| return new StoreAndValue(s, res); | |
| } else { | |
| return new StoreAndValue(s,new BoolValue(true)); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment