summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <matthias@benkard.de>2008-08-24 20:26:51 +0200
committerMatthias Andreas Benkard <matthias@benkard.de>2008-08-24 20:26:51 +0200
commit4cf5aceb8f3b33ebda40225beb054b834ddfa4af (patch)
tree1c4049a7132ce7361a8014fb6268302ce6fd0817
parentcad4fe0ea19220fd4eddeccec5bd5102498711eb (diff)
MLKMacroCallForm: Handle macro functions returning no values more gracefully.
-rw-r--r--MLKForm.m18
1 files changed, 13 insertions, 5 deletions
diff --git a/MLKForm.m b/MLKForm.m
index 848dab3..78d1ff2 100644
--- a/MLKForm.m
+++ b/MLKForm.m
@@ -207,13 +207,21 @@
inContext:context
forCompiler:compiler];
+ id expansion;
+
id <MLKFuncallable> macrofun = [context macroForSymbol:_head];
//NSLog (@"Expanding: %@", MLKPrintToString (_form));
- id expansion = denullify ([[macrofun
- applyToArray:
- [NSArray arrayWithObjects:
- _form, context, nil]]
- objectAtIndex:0]);
+ NSArray *expansion_values = [macrofun applyToArray:
+ [NSArray arrayWithObjects:
+ _form, context, nil]];
+ if ([expansion_values count] > 0)
+ {
+ expansion = denullify ([expansion_values objectAtIndex:0]);
+ }
+ else
+ {
+ expansion = nil;
+ }
//NSLog (@"=> %@", MLKPrintToString (expansion));
return LRETAIN ([MLKForm formWithObject:expansion