From 03f8b9a2dd1a41baee46fd82e07545ad7c10986d Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Sun, 24 Aug 2008 18:07:16 +0200 Subject: MLKInterpretedClosure: Adapt to the new interpreter. --- MLKInterpretedClosure.m | 38 ++++++++++---------------------------- 1 file changed, 10 insertions(+), 28 deletions(-) (limited to 'MLKInterpretedClosure.m') diff --git a/MLKInterpretedClosure.m b/MLKInterpretedClosure.m index 6507956..8389bdb 100644 --- a/MLKInterpretedClosure.m +++ b/MLKInterpretedClosure.m @@ -38,16 +38,12 @@ static MLKSymbol *PROGN; PROGN = [cl intern:@"PROGN"]; } --(id) initWithBodyForms:(id)forms - lambdaListName:(MLKSymbol *)symbol - context:(MLKLexicalContext *)lexctx - environment:(MLKLexicalEnvironment *)lexenv +-(id) initWithForm:(MLKSimpleLambdaForm *)form + environment:(MLKLexicalEnvironment *)lexenv { self = [super init]; - LASSIGN (bodyForm, [MLKCons cons:PROGN with:forms]); - LASSIGN (context, lexctx); - LASSIGN (environment, lexenv); - LASSIGN (lambdaListName, symbol); + LASSIGN (_environment, lexenv); + LASSIGN (_form, form); return self; } @@ -56,24 +52,12 @@ static MLKSymbol *PROGN; id arglist = [MLKCons listWithArray:arguments]; MLKLexicalEnvironment *new_environment = - [MLKLexicalEnvironment environmentWithParent:environment - variables:[NSDictionary dictionaryWithObject:nullify(arglist) - forKey:lambdaListName] + [MLKLexicalEnvironment environmentWithParent:_environment + variables:[NSDictionary dictionaryWithObject:arglist + forKey:nullify([_form lambdaListName])] functions:nil]; - MLKLexicalContext *new_context = - [MLKLexicalContext contextWithParent:context - variables:[NSSet setWithObject:lambdaListName] - functions:nil - goTags:nil - macros:nil - compilerMacros:nil - symbolMacros:nil - declarations:nil]; - - return [MLKInterpreter eval:bodyForm - inLexicalContext:new_context - withEnvironment:new_environment]; + return [_form interpretBodyWithEnvironment:new_environment]; } -(NSString *) description @@ -88,10 +72,8 @@ static MLKSymbol *PROGN; -(void) dealloc { - LDESTROY (bodyForm); - LDESTROY (lambdaListName); - LDESTROY (context); - LDESTROY (environment); + LDESTROY (_environment); + LDESTROY (_form); [super dealloc]; } @end -- cgit v1.2.3