lib/more_collections: update more maps to accept nullable keys
[nit.git] / src / nitni / nitni_base.nit
index 391a2b0..4f31aaf 100644 (file)
@@ -22,6 +22,7 @@ module nitni_base
 
 import parser
 import modelbuilder # builder only for externcalls
+private import compiler::abstract_compiler
 
 redef class MMethod
        # Short name of this method in C (without the class name)
@@ -30,6 +31,7 @@ redef class MMethod
 
                if nit_name == "+" then return "_plus"
                if nit_name == "-" then return "_minus"
+               if nit_name == "unary -" then return "_unary_minus"
                if nit_name == "*" then return "_star"
                if nit_name == "/" then return "_slash"
                if nit_name == "%" then return "_percent"
@@ -52,7 +54,8 @@ end
 
 redef class MModule
        # Mangled name of this module in C
-       fun cname: String do return name
+       fun cname: String do return c_name # FIXME this is a hack to keep the internal FFI
+       # API independent of the compilers while still using the `MModule::c_name` service.
 end
 
 redef class MMethodDef
@@ -89,7 +92,7 @@ redef class MClassType
                if name == "Bool" then return "int"
                if name == "Char" then return "char"
                if name == "Float" then return "double"
-               if name == "Int" then return "int"
+               if name == "Int" then return "long"
                if name == "NativeString" then return "char*"
                if mclass.kind == extern_kind then
                        var ctype = mclass.ctype
@@ -104,7 +107,7 @@ redef class MClassType
                if name == "Bool" then return "int"
                if name == "Char" then return "char"
                if name == "Float" then return "double"
-               if name == "Int" then return "int"
+               if name == "Int" then return "long"
                if name == "NativeString" then return "char*"
                if mclass.kind == extern_kind then return "void*"
                return "struct nitni_instance *"