summaryrefslogtreecommitdiff
path: root/MLKRoot.m
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <matthias@benkard.de>2008-08-03 18:58:42 +0200
committerMatthias Andreas Benkard <matthias@benkard.de>2008-08-03 18:58:42 +0200
commit172fe17e991e5cdff87a0d794bcb7272e4824c95 (patch)
treed25055bf520b21a0e40f9e577141b4ed4bcf9d97 /MLKRoot.m
parent804925fe07251561cfd53e93bece7f3ed259e9cb (diff)
Make MACROEXPAND-1 aware of symbol macros.
Diffstat (limited to 'MLKRoot.m')
-rw-r--r--MLKRoot.m12
1 files changed, 11 insertions, 1 deletions
diff --git a/MLKRoot.m b/MLKRoot.m
index f155733..e3680f3 100644
--- a/MLKRoot.m
+++ b/MLKRoot.m
@@ -229,12 +229,22 @@ static id truify (BOOL value)
id form = [args objectAtIndex:0];
id env = [args count] > 1 ? denullify([args objectAtIndex:1]) : nil;
MLKLexicalContext *context = env ? (id)env : (id)[MLKLexicalContext globalContext];
+ id <MLKFuncallable> macrofun = nil;
if ([form isKindOfClass:[MLKCons class]]
&& (![form car] || [[form car] isKindOfClass:[MLKSymbol class]])
&& [context symbolNamesMacro:[form car]])
{
- id <MLKFuncallable> macrofun = [context macroForSymbol:[form car]];
+ macrofun = [context macroForSymbol:[form car]];
+ }
+ else if ([form isKindOfClass:[MLKSymbol class]]
+ && [context symbolNamesSymbolMacro:form])
+ {
+ macrofun = [context symbolMacroForSymbol:[form car]];
+ }
+
+ if (macrofun)
+ {
form = denullify ([[macrofun applyToArray:
[NSArray arrayWithObjects:
form, context, nil]]