Merge branch 'fix-ni' into wip
authorJean Privat <jean@pryen.org>
Mon, 27 Feb 2012 21:23:56 +0000 (16:23 -0500)
committerJean Privat <jean@pryen.org>
Mon, 27 Feb 2012 21:23:56 +0000 (16:23 -0500)
src/metamodel/static_type.nit
src/native_interface/frontier.nit
src/native_interface/ni_metamodel.nit
src/syntax/mmbuilder.nit

index 4d443ce..7e45da4 100644 (file)
@@ -68,13 +68,13 @@ redef class MMLocalProperty
 end
 
 class MMParam
-       readable var _mmtype: MMType
-       readable var _name: Symbol
+       var mmtype: MMType
+       var name: Symbol writable
 
        init ( t  : MMType, n : Symbol )
        do
-           _mmtype = t
-           _name = n
+           mmtype = t
+           name = n
        end
 
        redef fun to_s do return "{name}: {mmtype}"
index 86f4b11..2d42bd2 100644 (file)
@@ -461,7 +461,7 @@ redef class MMType
 
                        # add null version, as a struct
                        if is_nullable then
-                               var null_getter = "null_{as_notnull.friendly_extern_name}"
+                               var null_getter = "null_{as_notnull.mangled_name}"
                                var null_getter_local = "{mmmodule.to_s}_{null_getter}"
 
                                v.header.add( "{name} {null_getter_local}();\n" )
index 8fab011..f820e54 100644 (file)
@@ -39,6 +39,16 @@ redef class MMType
                end
        end
 
+       fun mangled_name: String
+       do
+               var pi = local_class.primitive_info
+               if is_nullable then
+                       return "nullable_{local_class.name.to_s}"
+               else
+                       return local_class.name.to_s
+               end
+       end
+
        # Return the expression to convert this type from its native version.
        fun from_native( name : String ) : String
        do
@@ -72,7 +82,7 @@ redef class MMType
                        not is_nullable then # int, float, point/void* ...
                        return "{nit_name} = {boxtype(native_name)}"
                else
-                       return "{nit_name} = {"{native_name}.v"}"
+                       return "{nit_name} = {native_name}.v"
                end
        end
 end
@@ -219,16 +229,16 @@ redef class MMImportedCast
                if is_about_nullable_only then
                        if is_not_null_to_nullable  then # to null
                                # nullable_Object Object_as_nullable( Object o )
-                               return "{from.friendly_extern_name}_as_nullable"
+                               return "{from.mangled_name}_as_nullable"
                        else if is_nullable_to_not_null then # from null
                                # Object Object_as_not_null( nullable_Object o )
-                               return "{to.friendly_extern_name}_as_not_null"
+                               return "{to.mangled_name}_as_not_null"
                        else
                                abort
                        end
                else # inter types
                        # String Object_as_String( Object o )
-                       return "{from.friendly_extern_name}_as_{to.friendly_extern_name}"
+                       return "{from.mangled_name}_as_{to.mangled_name}"
                end
        end
 
@@ -253,13 +263,13 @@ redef class MMImportedCast
                        else if is_nullable_to_not_null then # from null
                                # Object_is_null( nullable_Object o )
                                # is opposite from others
-                               return "{to.local_class}_is_null"
+                               return "{to.mangled_name}_is_null"
                        else
                                abort
                        end
                else # inter types
                        # Object_is_a_String( Object o )
-                       return "{from.friendly_extern_name}_is_a_{to.friendly_extern_name}"
+                       return "{from.mangled_name}_is_a_{to.mangled_name}"
                end
        end
 
index 77eca56..8999b01 100644 (file)
@@ -976,6 +976,8 @@ redef class APropdef
                                                t = v.type_array(t)
                                        end
                                        p.variable.stype = t
+
+                                       isig.params[p.position].name = p.variable.name
                                end
                                s = isig
                                prop.signature = s