diff options
author | Matthias Andreas Benkard <matthias@benkard.de> | 2008-06-15 11:49:32 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <matthias@benkard.de> | 2008-06-15 11:49:32 +0200 |
commit | b17e5884d8427a6d162b87a9706ca4fd1046d9e5 (patch) | |
tree | 026644daf9cc93c3474a131275d8d36fe9e4f33b | |
parent | bc6ee43ce67241b940cd99bfb731156767457a0f (diff) |
MLKDynamicContext, MLKEnvironment: Add -valueForBinding: and -setValue:forBinding:.
-rw-r--r-- | MLKDynamicContext.h | 2 | ||||
-rw-r--r-- | MLKDynamicContext.m | 13 | ||||
-rw-r--r-- | MLKEnvironment.h | 4 | ||||
-rw-r--r-- | MLKEnvironment.m | 4 |
4 files changed, 19 insertions, 4 deletions
diff --git a/MLKDynamicContext.h b/MLKDynamicContext.h index bd08800..22014a4 100644 --- a/MLKDynamicContext.h +++ b/MLKDynamicContext.h @@ -47,6 +47,8 @@ -(id) findRestart:(MLKSymbol *)symbol; -(id) findHandler:(MLKSymbol *)symbol; -(id) findCatchTag:(MLKSymbol *)symbol; +-(id) valueForBinding:(MLKSymbol *)symbol; +-(void) setValue:(id)value forBinding:(MLKSymbol *)symbol; -(void) dealloc; @end diff --git a/MLKDynamicContext.m b/MLKDynamicContext.m index d08deaa..63c8ad7 100644 --- a/MLKDynamicContext.m +++ b/MLKDynamicContext.m @@ -142,6 +142,19 @@ return nil; } +-(id) valueForBinding:(MLKSymbol *)symbol +{ + return [[[MLKDynamicContext currentContext] environment] + valueForBinding:symbol]; +} + +-(void) setValue:(id)value forBinding:(MLKSymbol *)symbol +{ + [[[MLKDynamicContext currentContext] environment] + setValue:value + forBinding:symbol]; +} + -(void) dealloc { RELEASE (_conditionHandlers); diff --git a/MLKEnvironment.h b/MLKEnvironment.h index b70b5b9..20cf7ce 100644 --- a/MLKEnvironment.h +++ b/MLKEnvironment.h @@ -35,8 +35,8 @@ -(MLKEnvironment *) parent; -(void) addBindings:(NSDictionary *)bindings; --(void) addBinding:(MLKSymbol *)symbol to:(id)value; --(void) setBinding:(MLKSymbol *)symbol to:(id)value; +-(void) addValue:(id)value forBinding:(MLKSymbol *)symbol; +-(void) setValue:(id)value forBinding:(MLKSymbol *)symbol; -(id) valueForBinding:(MLKSymbol *)symbol; -(MLKEnvironment *) environmentForBinding:(MLKSymbol *)symbol; diff --git a/MLKEnvironment.m b/MLKEnvironment.m index 8a7c270..8c26519 100644 --- a/MLKEnvironment.m +++ b/MLKEnvironment.m @@ -53,7 +53,7 @@ return _parent; } --(void) setBinding:(MLKSymbol *)symbol to:(id)value +-(void) setValue:(id)value forBinding:(MLKSymbol *)symbol; { [self setBinding:symbol to:value inEnvironment:self]; } @@ -96,7 +96,7 @@ [_bindings addEntriesFromDictionary:bindings]; } --(void) addBinding:(MLKSymbol *)symbol to:(id)value +-(void) addValue:(id)value forBinding:(MLKSymbol *)symbol; { [_bindings setObject:value forKey:symbol]; } |