summaryrefslogtreecommitdiff
path: root/MLKLexicalContext.m
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <matthias@benkard.de>2008-09-02 10:22:24 +0200
committerMatthias Andreas Benkard <matthias@benkard.de>2008-09-02 10:22:24 +0200
commit1e1bbbf51144d68dcef7d1abf8dab0f3ade3fb1a (patch)
tree36601b862fa547ac51e253cf0456c8e0f0e021f3 /MLKLexicalContext.m
parent1dc0cdf8416eb0e98017d1f833ac1e9e6077fda5 (diff)
LLVM compiler: Access closure variables through the closure data pointer.
Diffstat (limited to 'MLKLexicalContext.m')
-rw-r--r--MLKLexicalContext.m27
1 files changed, 20 insertions, 7 deletions
diff --git a/MLKLexicalContext.m b/MLKLexicalContext.m
index 5f694ff..5456aa3 100644
--- a/MLKLexicalContext.m
+++ b/MLKLexicalContext.m
@@ -331,7 +331,7 @@ static MLKLexicalContext *global_context;
[_functions addObject:symbol];
}
--(id) deepPropertyForVariable:(id)name key:(id)key
+-(id) propertyForVariable:(id)name key:(id)key
{
NSDictionary *props = [_variableInfo objectForKey:nullify(name)];
id property;
@@ -341,7 +341,7 @@ static MLKLexicalContext *global_context;
else if (!_parent || [_variables containsObject:nullify(name)])
return nil;
else
- return [_parent deepPropertyForVariable:name key:key];
+ return [_parent propertyForVariable:name key:key];
}
-(void) setDeepProperty:(id)object
@@ -368,7 +368,20 @@ static MLKLexicalContext *global_context;
}
}
--(id) deepPropertyForFunction:(id)name key:(id)key
+-(void) addShallowProperty:(id)object
+ forVariable:(id)name
+ key:(id)key
+{
+ NSMutableDictionary *props = [_variableInfo objectForKey:nullify(name)];
+ if (!props)
+ {
+ props = [NSMutableDictionary dictionary];
+ [_variableInfo setObject:props forKey:nullify(name)];
+ }
+ [props setObject:object forKey:key];
+}
+
+-(id) propertyForFunction:(id)name key:(id)key
{
NSDictionary *props = [_functionInfo objectForKey:nullify(name)];
id property;
@@ -378,7 +391,7 @@ static MLKLexicalContext *global_context;
else if (!_parent || [_functions containsObject:nullify(name)])
return nil;
else
- return [_parent deepPropertyForFunction:name key:key];
+ return [_parent propertyForFunction:name key:key];
}
-(void) setDeepProperty:(id)object
@@ -403,7 +416,7 @@ static MLKLexicalContext *global_context;
-(void *) functionCellForSymbol:(id)name
{
- id prop = [self deepPropertyForFunction:name
+ id prop = [self propertyForFunction:name
key:@"LEXCTX.function-cell"];
if (!prop)
@@ -423,7 +436,7 @@ static MLKLexicalContext *global_context;
-(void *) closureDataPointerForSymbol:(id)name
{
- id prop = [self deepPropertyForFunction:name
+ id prop = [self propertyForFunction:name
key:@"LEXCTX.closure-data"];
if (!prop)
@@ -443,7 +456,7 @@ static MLKLexicalContext *global_context;
-(id) bindingForSymbol:(id)name
{
- id prop = [self deepPropertyForVariable:name
+ id prop = [self propertyForVariable:name
key:@"LEXCTX.variable-binding"];
if (!prop)