[macruby-changes] [4273] MacRuby/trunk/objc.m

source_changes at macosforge.org source_changes at macosforge.org
Thu Jun 24 18:27:59 PDT 2010


Revision: 4273
          http://trac.macosforge.org/projects/ruby/changeset/4273
Author:   lsansonetti at apple.com
Date:     2010-06-24 18:27:57 -0700 (Thu, 24 Jun 2010)
Log Message:
-----------
more relax parser (10.6 builtin files are less good)

Modified Paths:
--------------
    MacRuby/trunk/objc.m

Modified: MacRuby/trunk/objc.m
===================================================================
--- MacRuby/trunk/objc.m	2010-06-25 00:57:38 UTC (rev 4272)
+++ MacRuby/trunk/objc.m	2010-06-25 01:27:57 UTC (rev 4273)
@@ -819,15 +819,17 @@
 static NSString *
 get_type(NSXMLElement *elem)
 {
-   NSXMLNode *node = nil;
+    NSXMLNode *node = nil;
 #if __LP64__
-   node = [elem attributeForName:@"type64"];
+    node = [elem attributeForName:@"type64"];
 #endif
-   if (node == nil) {
-       node = [elem attributeForName:@"type"];
-       assert(node != nil);
-   }
-   return [node stringValue];
+    if (node == nil) {
+	node = [elem attributeForName:@"type"];
+	if (node == nil) {
+	    return nil;
+	}
+    }
+    return [node stringValue];
 }
 
 static void
@@ -838,17 +840,30 @@
 {
     NSXMLNode *name = [elem attributeForName:is_objc
 	? @"selector" : @"name"];
+    if (name == nil) {
+	return;
+    }
     NSArray *ary = [elem elementsForName:@"retval"];
-    assert([ary count] == 1);
+    if ([ary count] != 1) {
+	return;
+    }
     NSXMLElement *retval = [ary objectAtIndex:0];
     NSMutableString *types = [NSMutableString new];
-    [types appendString:get_type(retval)];
+    NSString *type = get_type(retval);
+    if (type == nil) {
+	return;
+    }
+    [types appendString:type];
     if (is_objc) {
 	[types appendString:@"@:"]; // self, sel
     }
     ary = [elem elementsForName:@"arg"];
     for (NSXMLElement *a in ary) {
-	[types appendString:get_type(a)];
+	type = get_type(a);
+	if (type == nil) {
+	    return;
+	}
+	[types appendString:type];
     }
     NSString *sel_str = [name stringValue];
     if (!is_objc && [ary count] > 0) {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100624/79858374/attachment.html>


More information about the macruby-changes mailing list