contrib/objcwrapper: each ObjcProperty keeps track of its declaring class
authorAlexis Laferrière <alexis.laf@xymus.net>
Tue, 1 Sep 2015 14:52:41 +0000 (10:52 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Wed, 2 Sep 2015 19:57:50 +0000 (15:57 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

contrib/objcwrapper/src/objc_model.nit
contrib/objcwrapper/src/objc_visitor.nit

index 3ce3946..21a34fa 100644 (file)
@@ -93,6 +93,9 @@ end
 
 # Property of an `ObjcClass`
 class ObjcProperty
+       # Introducing class
+       var objc_class: ObjcClass
+
        # Is this property to be commented out?
        var is_commented = false is writable
 end
index 0c131cc..295434e 100644 (file)
@@ -73,7 +73,10 @@ end
 redef class Nsignature_block_signature
        redef fun accept_objc(v)
        do
-               var method = new ObjcMethod
+               var c = v.objc_class
+               assert c != null
+
+               var method = new ObjcMethod(c)
                method.return_type = n_signature_return_type.to_type
                method.is_class_property = n_scope.is_class_property
 
@@ -94,7 +97,7 @@ redef class Nsignature_block_signature
                        method.params.add param
                end
 
-               v.objc_class.methods.add method
+               c.methods.add method
        end
 end
 
@@ -102,11 +105,14 @@ end
 redef class Nproperty_property
        redef fun accept_objc(v)
        do
-               var attr = new ObjcAttribute
+               var c = v.objc_class
+               assert c != null
+
+               var attr = new ObjcAttribute(c)
                attr.return_type = n_type.to_type
                attr.name = n_left.collect_text
 
-               v.objc_class.attributes.add attr
+               c.attributes.add attr
        end
 end