From b17e5884d8427a6d162b87a9706ca4fd1046d9e5 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sun, 15 Jun 2008 11:49:32 +0200 Subject: MLKDynamicContext, MLKEnvironment: Add -valueForBinding: and -setValue:forBinding:. --- MLKDynamicContext.h | 2 ++ MLKDynamicContext.m | 13 +++++++++++++ MLKEnvironment.h | 4 ++-- 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]; } -- cgit v1.2.3