compiler: implement intern `init` on NativeString
authorJean Privat <jean@pryen.org>
Thu, 12 Jun 2014 14:17:39 +0000 (10:17 -0400)
committerJean Privat <jean@pryen.org>
Thu, 12 Jun 2014 14:17:39 +0000 (10:17 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

src/abstract_compiler.nit

index a453f6b..d3ca7d8 100644 (file)
@@ -1881,6 +1881,9 @@ redef class AMethPropdef
                        else if pname == "atoi" then
                                v.ret(v.new_expr("atoi({arguments[0]});", ret.as(not null)))
                                return
+                       else if pname == "init" then
+                               v.ret(v.new_expr("(char*)nit_alloc({arguments[1]})", ret.as(not null)))
+                               return
                        end
                else if cname == "NativeArray" then
                        v.native_array_def(pname, ret, arguments)