summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <matthias@benkard.de>2008-09-01 23:57:03 +0200
committerMatthias Andreas Benkard <matthias@benkard.de>2008-09-01 23:57:03 +0200
commitd2f326bbc766af34a2d1e5f0be4252eab41b2cac (patch)
tree1f5e3c6e1de94f8908c85ff4ebdb4710b66b76ac
parenta5364817b1cd751832a4634e4afbd67bb668fa2e (diff)
MLKLexicalContext: Add -variableIsGlobal:.
-rw-r--r--MLKLLVMCompiler.mm4
-rw-r--r--MLKLexicalContext-MLKLLVMCompilation.mm3
-rw-r--r--MLKLexicalContext.h1
-rw-r--r--MLKLexicalContext.m5
4 files changed, 9 insertions, 4 deletions
diff --git a/MLKLLVMCompiler.mm b/MLKLLVMCompiler.mm
index e0d53dd..75e444b 100644
--- a/MLKLLVMCompiler.mm
+++ b/MLKLLVMCompiler.mm
@@ -458,7 +458,7 @@ static Constant
onObject:dynctx
withArgumentVector:&args];
}
- else if ([_context contextForVariable:_form] == [MLKLexicalContext globalContext])
+ else if ([_context variableIsGlobal:_form])
{
//[_compiler insertTrace:@"Global."];
Value *binding = builder.Insert ([_context globalBindingValueForSymbol:_form]);
@@ -825,7 +825,7 @@ static Constant
onObject:dynctx
withArgumentVector:&args];
}
- else if ([_context contextForVariable:variable] == [MLKLexicalContext globalContext])
+ else if ([_context variableIsGlobal:variable])
{
Value *binding = builder.Insert ([_context globalBindingValueForSymbol:variable]);
std::vector<Value *> args (1, value);
diff --git a/MLKLexicalContext-MLKLLVMCompilation.mm b/MLKLexicalContext-MLKLLVMCompilation.mm
index d3a84b3..e670151 100644
--- a/MLKLexicalContext-MLKLLVMCompilation.mm
+++ b/MLKLexicalContext-MLKLLVMCompilation.mm
@@ -50,8 +50,7 @@ id MLKDummyUseLLVMLexicalContext = nil;
if (flag)
return [flag boolValue];
else
- return (![self contextForVariable:name]
- || [self contextForVariable:name] == [MLKLexicalContext globalContext]);
+ return (![self contextForVariable:name] || [self variableIsGlobal:name]);
}
-(Instruction *) functionCellValueForSymbol:(id)name
diff --git a/MLKLexicalContext.h b/MLKLexicalContext.h
index 2368636..3e703e5 100644
--- a/MLKLexicalContext.h
+++ b/MLKLexicalContext.h
@@ -93,6 +93,7 @@
-(void) addFunction:(MLKSymbol *)symbol;
-(BOOL) variableIsLexical:(MLKSymbol *)symbol;
+-(BOOL) variableIsGlobal:(id)name;
-(BOOL) functionIsInline:(MLKSymbol *)symbol;
-(id) deepPropertyForVariable:(id)name key:(id)key;
diff --git a/MLKLexicalContext.m b/MLKLexicalContext.m
index dd0dc9c..5f694ff 100644
--- a/MLKLexicalContext.m
+++ b/MLKLexicalContext.m
@@ -291,6 +291,11 @@ static MLKLexicalContext *global_context;
else return (_parent && [_parent variableIsLexical:symbol]);
}
+-(BOOL) variableIsGlobal:(id)name
+{
+ return [self contextForVariable:name] == [MLKLexicalContext globalContext];
+}
+
-(BOOL) functionIsInline:(MLKSymbol *)symbol
{
if ([_functions containsObject:symbol])