src: prepare `MType::cname_blind` to be more customizable
authorAlexis Laferrière <alexis.laf@xymus.net>
Fri, 5 Jun 2015 20:58:05 +0000 (16:58 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Sat, 6 Jun 2015 14:38:37 +0000 (10:38 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

src/nitni/nitni_base.nit

index cc30171..a50aa8f 100644 (file)
@@ -71,14 +71,15 @@ redef class MType
 
        # Representation of this type in C for the internal of the system
        # Hides extern types.
-       fun cname_blind: String is abstract
+       fun cname_blind: String do return "struct nitni_instance *"
 
        # Representation of this type in mangled C
        #   Object -> Object
        #   Pointer -> Pointer
        fun mangled_cname: String is abstract
 
-       # Does this types has a primitive reprensentation
+       # Does this types has a primitive representation?
+       #
        #   type Object is_primitive? false
        #   type Pointer is_primitive? true
        fun is_cprimitive: Bool is abstract
@@ -111,7 +112,7 @@ redef class MClassType
                if name == "Byte" then return "unsigned char"
                if name == "NativeString" then return "unsigned char*"
                if mclass.kind == extern_kind then return "void*"
-               return "struct nitni_instance *"
+               return super
        end
 
        # Name of this type in C for normal classes (not extern and not primitive)
@@ -125,13 +126,12 @@ end
 
 redef class MNullableType
        redef fun cname do return mangled_cname
-       redef fun cname_blind do return "struct nitni_instance *"
        redef fun mangled_cname do return "nullable_{mtype.mangled_cname}"
        redef fun is_cprimitive do return false
 end
 
 redef class MVirtualType
-       redef fun mangled_cname: String do return to_s
+       redef fun mangled_cname do return to_s
 end
 
 redef class MGenericType