diff options
author | Matthias Andreas Benkard <matthias@benkard.de> | 2008-08-24 20:26:51 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <matthias@benkard.de> | 2008-08-24 20:26:51 +0200 |
commit | 4cf5aceb8f3b33ebda40225beb054b834ddfa4af (patch) | |
tree | 1c4049a7132ce7361a8014fb6268302ce6fd0817 | |
parent | cad4fe0ea19220fd4eddeccec5bd5102498711eb (diff) |
MLKMacroCallForm: Handle macro functions returning no values more gracefully.
-rw-r--r-- | MLKForm.m | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -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 |