diff options
author | Matthias Benkard <mulk@minimulk.mst-plus> | 2008-08-24 11:51:35 +0200 |
---|---|---|
committer | Matthias Benkard <mulk@minimulk.mst-plus> | 2008-08-24 11:51:35 +0200 |
commit | 1560780b5fad554f12ce3964854bd474da1048f8 (patch) | |
tree | ccd5432593ff0623e5e83c9cf3b0cc79e08bc9ee /MLKLexicalContext.m | |
parent | 8e704379e8655c2a59200042894fe55d0d82f279 (diff) |
MLKLexicalContext: Add -functionIsInline:.
Diffstat (limited to 'MLKLexicalContext.m')
-rw-r--r-- | MLKLexicalContext.m | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/MLKLexicalContext.m b/MLKLexicalContext.m index 3f820a8..a1bb8e8 100644 --- a/MLKLexicalContext.m +++ b/MLKLexicalContext.m @@ -35,6 +35,7 @@ #import "MLKSymbol.h" #import "MLKInteger.h" #import "runtime-compatibility.h" +#import "special-symbols.h" #import "util.h" #include <stdlib.h> @@ -51,18 +52,10 @@ static MLKLexicalContext *global_context; -static MLKPackage *cl; -static MLKPackage *sys; -static MLKSymbol *SPECIAL; -static MLKSymbol *LEXICAL; - - @implementation MLKLexicalContext +(void) initialize { MLKLexicalEnvironment *globalenv = [MLKLexicalEnvironment globalEnvironment]; - cl = [MLKPackage findPackage:@"COMMON-LISP"]; - sys = [MLKPackage findPackage:@"TOILET-SYSTEM"]; global_context = [[self alloc] initWithParent:nil variables:[globalenv variables] @@ -72,9 +65,8 @@ static MLKSymbol *LEXICAL; compilerMacros:nil symbolMacros:nil declarations:nil]; - - SPECIAL = [cl intern:@"SPECIAL"]; - LEXICAL = [sys intern:@"LEXICAL"]; + + ensure_symbols (); } -(MLKLexicalContext *) initWithParent:(MLKLexicalContext *)aContext @@ -299,6 +291,27 @@ static MLKSymbol *LEXICAL; else return (_parent && [_parent variableIsLexical:symbol]); } +-(BOOL) functionIsInline:(MLKSymbol *)symbol +{ + if ([_functions containsObject:symbol]) + { + id rest = _declarations; + while (rest) + { + id item = [rest car]; + if ([item isKindOfClass:[MLKCons class]] && [[item cdr] car] == symbol) + { + if ([item car] == INLINE) + return YES; + else if ([item car] == NOTINLINE) + return NO; + } + rest = [rest cdr]; + } + } + else return (_parent && [_parent functionIsInline:symbol]); +} + -(void) addVariable:(MLKSymbol *)symbol { symbol = symbol ? (id)symbol : (id)[NSNull null]; |