From f47f28ae81b71049496fa96e6f27b3e2794fc9cb Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Mon, 7 Jul 2008 20:16:53 +0200 Subject: Interpreter: Establish catch tags in the dynamic context. --- MLKDynamicContext.m | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'MLKDynamicContext.m') diff --git a/MLKDynamicContext.m b/MLKDynamicContext.m index 55d6c4e..593f4a7 100644 --- a/MLKDynamicContext.m +++ b/MLKDynamicContext.m @@ -257,7 +257,7 @@ static MLKDynamicContext *global_context; variables:(NSDictionary *)vars handlers:(NSDictionary *)handlers restarts:(NSDictionary *)restarts - catchTags:(NSDictionary *)catchTags + catchTags:(NSSet *)catchTags activeHandlerEnvironment:(MLKEnvironment *)handlerEnv; { self = [super init]; @@ -267,7 +267,7 @@ static MLKDynamicContext *global_context; _parent, _parent->_conditionHandlers); _restarts = MAKE_ENVIRONMENT(restarts, _parent, _parent->_restarts); - _catchTags = MAKE_ENVIRONMENT(catchTags, _parent, _parent->_catchTags); + _catchTags = [[NSSet alloc] initWithSet:catchTags]; ASSIGN (_activeHandlerEnvironment, handlerEnv ? (id) handlerEnv @@ -347,20 +347,10 @@ static MLKDynamicContext *global_context; return nil; } --(id) findCatchTag:(MLKSymbol *)symbol +-(BOOL) catchTagIsEstablished:(id)tag { - NS_DURING - { - NS_VALUERETURN ([_catchTags valueForSymbol:symbol], id); - } - NS_HANDLER - { - if (![[localException name] isEqualToString: @"MLKUnboundVariableError"]) - [localException raise]; - } - NS_ENDHANDLER; - - return nil; + return ([_catchTags containsObject:tag] || + (_parent && [_parent catchTagIsEstablished:tag])); } -(id) valueForSymbol:(MLKSymbol *)symbol -- cgit v1.2.3