summaryrefslogtreecommitdiff
path: root/MLKInterpretedClosure.m
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <matthias@benkard.de>2008-08-24 19:10:21 +0200
committerMatthias Andreas Benkard <matthias@benkard.de>2008-08-24 19:10:21 +0200
commitaa3f4a2b760c3d890aa51b3afa904ab604de794c (patch)
treec031c1242e0c1ad2ae92cf00347f36ec343065de /MLKInterpretedClosure.m
parentbaae263841853c289d48ce172e614171167cf1dd (diff)
parenta34b771cd9cc823260407b2905312b3be05390db (diff)
Merge mulk_benkard@ssh.phx.nearlyfreespeech.net:/home/htdocs/code/mulklisp
Diffstat (limited to 'MLKInterpretedClosure.m')
-rw-r--r--MLKInterpretedClosure.m38
1 files changed, 10 insertions, 28 deletions
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