diff options
author | Matthias Andreas Benkard <matthias@benkard.de> | 2008-10-01 19:40:42 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <matthias@benkard.de> | 2008-10-01 19:40:42 +0200 |
commit | afaaec406bc86bf52ef976634b458dbc7e01fdc9 (patch) | |
tree | ce715c4b8fb6cbe95c4e2e80fc85af6706acfb44 /MLKLexicalContext.m | |
parent | fd7702e9b009d2984328b2519db946f82ad834e9 (diff) | |
parent | a0dae1a2756c0f9a84c3a258f3a4a05e63afc1c6 (diff) |
Merge mulk_benkard@ssh.phx.nearlyfreespeech.net:/home/htdocs/code/mulklisp
Diffstat (limited to 'MLKLexicalContext.m')
-rw-r--r-- | MLKLexicalContext.m | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/MLKLexicalContext.m b/MLKLexicalContext.m index 8574e0b..ccd348a 100644 --- a/MLKLexicalContext.m +++ b/MLKLexicalContext.m @@ -81,7 +81,7 @@ static MLKLexicalContext *global_context; self = [super init]; LASSIGN (_parent, (aContext ? aContext : [MLKLexicalContext globalContext])); - + LASSIGN (_variables, [NSMutableSet setWithSet:vars]); LASSIGN (_functions, [NSMutableSet setWithSet:functions]); @@ -297,6 +297,12 @@ static MLKLexicalContext *global_context; || [self contextForVariable:name] == [MLKLexicalContext globalContext]); } +-(BOOL) functionIsGlobal:(id)name +{ + return (![self contextForFunction:name] + || [self contextForFunction:name] == [MLKLexicalContext globalContext]); +} + -(BOOL) functionIsInline:(MLKSymbol *)symbol { if ([_functions containsObject:symbol]) @@ -456,6 +462,26 @@ static MLKLexicalContext *global_context; } } +-(intptr_t *) closureDataLengthForSymbol:(id)name +{ + id prop = [self propertyForFunction:name + key:@"LEXCTX.closure-data-length"]; + + if (!prop) + { + intptr_t *cell = malloc (sizeof(intptr_t)); + prop = [NSValue valueWithPointer:cell]; + [self setDeepProperty:prop + forFunction:name + key:@"LEXCTX.closure-data-length"]; + return cell; + } + else + { + return (intptr_t*)[prop pointerValue]; + } +} + -(id) bindingForSymbol:(id)name { id prop = [self propertyForVariable:name |