diff options
author | Matthias Andreas Benkard <matthias@benkard.de> | 2008-07-07 20:16:53 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <matthias@benkard.de> | 2008-07-07 20:16:53 +0200 |
commit | f47f28ae81b71049496fa96e6f27b3e2794fc9cb (patch) | |
tree | bd21b52cb841b1ef65d71e0add5b0e9c812fe722 /MLKDynamicContext.m | |
parent | ffba1c0c3bb96239a7d8b4463d5b78d0455adc40 (diff) |
Interpreter: Establish catch tags in the dynamic context.
Diffstat (limited to 'MLKDynamicContext.m')
-rw-r--r-- | MLKDynamicContext.m | 20 |
1 files changed, 5 insertions, 15 deletions
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 |