referenced_str = null
end
- fun get_c_string import String::items, NativeString::to_s, NativeString::to_s_with_copy, StringTest::ref_test, StringTest::copy_test `{
+ fun get_c_string import String.items, NativeString.to_s, NativeString.to_s_with_copy, StringTest.ref_test, StringTest.copy_test `{
char* string = "This is a test string";
String ref_string = NativeString_to_s(string);
var w : String = "w"
var rw : String = "rw"
- fun print_all import String::to_cstring, r, rw `{
+ fun print_all import String.to_cstring, r, rw `{
printf( "%s %s\n",
String_to_cstring( A_r( recv ) ),
String_to_cstring( A_rw( recv ) ) );
`}
- fun modify import NativeString::to_s, w=, rw= `{
+ fun modify import NativeString.to_s, w=, rw= `{
A_w__assign( recv, NativeString_to_s( "w set from native" ) );
A_rw__assign( recv, NativeString_to_s( "rw set from native" ) );
`}
end
class B
- fun print_and_modify( a : A ) import A::rw, A::rw=, String::to_cstring, NativeString::to_s `{
+ fun print_and_modify( a : A ) import A.rw, A.rw=, String.to_cstring, NativeString.to_s `{
printf( "%s\n", String_to_cstring( A_rw( a ) ) );
A_rw__assign( a, NativeString_to_s( "set from native" ) );
printf( "%s\n", String_to_cstring( A_rw( a ) ) );
return foobar;
`}
- fun test_me is extern import Test::foo, NativeString::to_s `{
+ fun test_me is extern import Test.foo, NativeString.to_s `{
int i;
for(i = 0; i < 2000; ++i) {
printf("%d\n", i);
Object_foo(recv);
`}
-fun call_a_constructor import A, A::bar `{
+fun call_a_constructor import A, A.bar `{
A a = new_A();
A_bar(a);
`}
redef fun foo do print self
end
-fun callbacks_with_as_casts(a: A, b: B) import B::foo, A::foo, B as(A), A as(B) `{
+fun callbacks_with_as_casts(a: A, b: B) import B.foo, A.foo, B.as(A), A.as(B) `{
A_foo(a);
B_foo(b);
B_foo(bb);
`}
-fun callbacks_with_nullable_casts(a: A, b: nullable B) import B as not nullable, A as nullable, A as(nullable B), B::foo `{
+fun callbacks_with_nullable_casts(a: A, b: nullable B) import B as not nullable, A as nullable, A.as(nullable B), B.foo `{
if (!nullable_B_is_a_B(b)) {
printf("Instance b is not a B (it is null)\n");
} else {
}
`}
-fun callbacks_with_failed_checks(a: A, b: nullable B) import B as not nullable, B as nullable, A as(B), B as (A) `{
+fun callbacks_with_failed_checks(a: A, b: nullable B) import B as not nullable, B as nullable, A.as(B), B.as(A) `{
if (!A_is_a_B(a)) {
printf("Instance of A is not a B.\n");
}
}
`}
-fun callbacks_with_primitives(o: Object, i: Int, ni: nullable Int) import Object as(Int), Int as(Object), nullable Int as(Int), Int::foo, Object::foo `{
+fun callbacks_with_primitives(o: Object, i: Int, ni: nullable Int) import Object.as(Int), Int.as(Object), nullable Int.as(Int), Int.foo, Object.foo `{
Object_foo(o);
Int_foo(i);
end
class A
- fun save_as_global( tbp : ToBePreserved, i : Int ) import ToBePreserved::output `{
+ fun save_as_global( tbp : ToBePreserved, i : Int ) import ToBePreserved.output `{
if ( global_tbps[i] != NULL )
ToBePreserved_decr_ref( global_tbps[i] );
fun m : Int is extern `{ return 10; `}
- fun n : String is extern import NativeString::to_s `{
+ fun n : String is extern import NativeString.to_s `{
return NativeString_to_s( "allo" );
`}
- fun o ( str : String ) is extern import String::to_cstring `{
+ fun o ( str : String ) is extern import String.to_cstring `{
f( String_to_cstring( str ) );
`}
fun in1(i: Int) do print "Back in Nit: in1 {i}"
fun in2(i: Float) do print "Back in Nit: in2"
-fun out(i: Int, f: Float): Int import in1, in2, A, A::alt, A::to_i `{
+fun out(i: Int, f: Float): Int import in1, in2, A, A.alt, A.to_i `{
printf("From C, beginning out: %ld\n", i);
Object_in1(recv, i);
A a = new_A();
return new_A( s / by );
`}
- redef fun ==( other ) import value, nullable Object as(A) `{
+ redef fun ==( other ) import value, nullable Object.as(A) `{
if ( nullable_Object_is_a_A( other ) &&
A_value( nullable_Object_as_A(other) ) == A_value( recv ) )
return 1;
return "char* from C";
`}
-fun print_string(str: String) import String::to_cstring `{
+fun print_string(str: String) import String.to_cstring `{
printf("str-> %s\n", String_to_cstring(str) );
`}
-fun get_string: String import NativeString::to_s, String::output `{
+fun get_string: String import NativeString.to_s, String.output `{
String str = NativeString_to_s("Nit string from C");
String_output(str);
printf("\n");
class B
super A
- redef fun id : String import super, NativeString::to_s, String::to_cstring `{
+ redef fun id : String import super, NativeString.to_s, String.to_cstring `{
char *new_name;
char *prefix = "B special ";
char *super_name = String_to_cstring( B_id___super( recv ) );