summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MLKLexicalContext.h2
-rw-r--r--MLKLexicalContext.m12
2 files changed, 14 insertions, 0 deletions
diff --git a/MLKLexicalContext.h b/MLKLexicalContext.h
index f869d8d..3bc5078 100644
--- a/MLKLexicalContext.h
+++ b/MLKLexicalContext.h
@@ -25,6 +25,7 @@
@interface MLKLexicalContext : MLKLispValue
{
NSArray *_knownMacros;
+ NSArray *_knownSymbolMacros;
MLKEnvironment *_macros;
MLKEnvironment *_symbolMacros;
MLKEnvironment *_goTags;
@@ -45,6 +46,7 @@
-(BOOL) symbolNamesFunction:(MLKSymbol *)symbol;
-(BOOL) symbolNamesMacro:(MLKSymbol *)symbol;
+-(BOOL) symbolNamesSymbolMacro:(MLKSymbol *)symbol;
-(id) macroForSymbol:(MLKSymbol *)symbol;
-(void) setMacro:(MLKFuncallable *)function forSymbol:(MLKSymbol *)symbol;
diff --git a/MLKLexicalContext.m b/MLKLexicalContext.m
index 06d2ebb..2103989 100644
--- a/MLKLexicalContext.m
+++ b/MLKLexicalContext.m
@@ -95,6 +95,7 @@ static MLKSymbol *LEXICAL;
_symbolMacros = MAKE_ENVIRONMENT (macros, _parent, _parent->_symbolMacros);
_knownMacros = [macros allKeys];
+ _knownSymbolMacros = [symbolMacros allKeys];
ASSIGN (_declarations, declarations);
return self;
@@ -150,6 +151,16 @@ static MLKSymbol *LEXICAL;
return (_parent && [_parent symbolNamesMacro:symbol]);
}
+-(BOOL) symbolNamesSymbolMacro:(MLKSymbol *)symbol
+{
+ if ([_variableLocations objectForKey:(symbol ? (id)symbol : (id)[NSNull null])])
+ return NO;
+ else if ([_knownSymbolMacros containsObject:(symbol ? (id)symbol : (id)[NSNull null])])
+ return YES;
+ else
+ return (_parent && [_parent symbolNamesSymbolMacro:symbol]);
+}
+
-(BOOL) variableIsLexical:(MLKSymbol *)symbol
{
id rest;
@@ -200,6 +211,7 @@ static MLKSymbol *LEXICAL;
{
RELEASE (_macros);
RELEASE (_knownMacros);
+ RELEASE (_knownSymbolMacros);
RELEASE (_symbolMacros);
RELEASE (_goTags);
RELEASE (_functionLocations);