Improved Evaluation
This commit is contained in:
@@ -45,22 +45,27 @@ static MPEvaluationContext *sharedContext;
|
||||
[self.stack removeLastObject];
|
||||
}
|
||||
|
||||
- (void)bindValue:(NSDecimalNumber *)value toName:(NSString *)variableName
|
||||
- (void)defineVariable:(NSString *)variable withValue:(id)value
|
||||
{
|
||||
NSMutableDictionary *currentBindings = self.stack.lastObject;
|
||||
currentBindings[variableName] = value;
|
||||
currentBindings[variable] = value;
|
||||
}
|
||||
|
||||
- (void)unbindVariableName:(NSString *)variableName
|
||||
- (void)undefineVariable:(NSString *)variable
|
||||
{
|
||||
NSMutableDictionary *currentBindings = self.stack.lastObject;
|
||||
[currentBindings removeObjectForKey:variableName];
|
||||
[currentBindings removeObjectForKey:variable];
|
||||
}
|
||||
|
||||
- (NSDecimalNumber *)valueForVariableName:(NSString *)variableName
|
||||
- (NSDecimalNumber *)valueForVariable:(NSString *)variable
|
||||
{
|
||||
NSMutableDictionary *currentBindings = self.stack.lastObject;
|
||||
return currentBindings[variableName];
|
||||
return currentBindings[variable];
|
||||
}
|
||||
|
||||
- (BOOL)isVariableDefined:(NSString *)variable
|
||||
{
|
||||
return [self valueForVariable:variable] != nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user