-Subproject commit 5f6b54084825368096489ced346db65dca4bb15e
+Subproject commit ef1917e40d3cae04f108ba71a2f905bb4b714811
int k[1][1];
-<<<i, j, o, p, r, q, s, t, k>>>;
+<<<i, j, o, p, r, s, t, k>>>;
[ 1.0, 2, 3, 4, 5 ];
[ #(0.0, 0.0) ];
-template“A” fun void test(A a) { <<<a>>>; }
+template<A> fun void test(A a) { <<<a>>>; }
1 => test;
1.3 => test;
test(1);
class C
{
- template“a”
+ template<a>
function void test(a var){ <<<var>>>; }
class D { int i;}
}
C c;
-<C.D> d;
-<C.D> @d_ref;
+C->D d;
+C->D @d_ref;
<<< c, " ", d, d_ref >>>;
-template “a”
+template <a>
function void test (a var){ <<< var>>>; }
-template “a, b”
+template <a, b>
function void test (a var, b var2){ <<< var>>>; }
//function void test (){ }
-test“int”(1);
-//test“float”(1.4);
-//test“int”(3, 1.4);
-//test“float”(3);
+test<int>(1);
+//test<float>(1.4);
+//test<int>(3, 1.4);
+//test<float>(3);
//test(3, 1.4);
-test“float, float”(3, 1.4);
-//test“float, float, int”(3, 1.4);
+test<float, float>(3, 1.4);
+//test<float, float, int>(3, 1.4);
-template “A, B”
+template <A, B>
function void test(A a, B b){<<<a, ", ", b>>>;}
test(1, 2.1);
test(1.1, 2.1);
-template “a”
+template <a>
fun void test(...) {
vararg.start;
<<<vararg.i>>>;
vararg.end;
}
-test“int”(1, 2);
-test“float”(1, 2, 3);
+test<int>(1, 2);
+test<float>(1, 2, 3);
INSTR(DotStatic) { GWDEBUG_EXE
const Type t = *(Type*)REG(-SZ_INT);
m_uint *const data = (m_uint*)(t->nspc->class_data + instr->m_val);
- *(m_uint*)REG(-SZ_INT) = *data;
+ *(m_uint*)REG(-SZ_INT) = data ? *data : 0;
}
INSTR(DotStatic2) { GWDEBUG_EXE
return GW_OK;
ERR_B(var->pos, "can't use non public typedef at global scope.")
}
- if(isa(type, env->class_def) < 0)
- ERR_B(var->pos, "can't use static variables for member function.")
+ if(isa(type, env->class_def) < 0 && !GET_FLAG(func, global))
+ ERR_B(var->pos, "can't use non global fptr of other class.")
if(GET_FLAG(func, member)) {
if(GET_FLAG(v, static))
ERR_B(var->pos, "can't use static variables for member function.")
if(!GET_FLAG(v, member))
ERR_B(var->pos, "can't use member variables for static function.")
- } else if(GET_FLAG(v, member))
- ERR_B(var->pos, "can't use member variables for static function.")
+ } //else if(GET_FLAG(v, member))
+ //ERR_B(var->pos, "can't use member variables for static function.")
return GW_OK;
}
if(!GET_FLAG(decl->td, ref) && t == env->class_def)
ERR_O(decl->self->pos, "...(note: object of type '%s' declared inside itself)", t->name)
}
- if(GET_FLAG(decl->td, global) && env->class_def)
+ if(GET_FLAG(decl->td, global) && env->class_def) // forbid this ?
UNSET_FLAG(decl->td, global);
}
if(GET_FLAG(t, template))
SET_FLAG(v, static);
if(GET_FLAG(stmt, private))
SET_FLAG(v, private);
+ else if(GET_FLAG(stmt, protect))
+ SET_FLAG(v, protect);
}
SET_FLAG(v, const | ae_flag_enum | ae_flag_checked);
nspc_add_value(stmt->t->owner, list->xid, v);
ANN m_bool scan1_stmt_union(const Env env, const Stmt_Union stmt) { GWDEBUG_EXE
Decl_List l = stmt->l;
const m_uint scope = union_push(env, stmt);
- if(stmt->xid || stmt->type_xid)
+ if(stmt->xid || stmt->type_xid) {
UNSET_FLAG(stmt, private);
+ UNSET_FLAG(stmt, protect);
+ }
do {
const Exp_Decl decl = l->self->d.exp_decl;
Var_Decl_List list = decl.list;
else SET_FLAG(v, static);
if(GET_FLAG(d, private))
SET_FLAG(v, private);
+ else if(GET_FLAG(d, protect))
+ SET_FLAG(v, protect);
}
d->func = v->d.func_ref = f;
return f->value_ref = v;
m_uint scope = env->scope;
if(GET_FLAG(f, global))
scope = env_push_global(env);
- CHECK_OB((value = func_create(env, f, overload, func_name)))
+ CHECK_OB((value = func_create(env, f, overload, func_name)))
if(GET_FLAG(f, global))
env_pop(env, scope);
} else
class Tester
{
- template“A”
+ template<A>
function int assert_equal(string description, A a, A b){ if(a == b) return 0; return 1; }
- template“A”
+ template<A>
function int assert_not_equal(string description, A a, A b){ if(a != b) return 0; return 1; }
}
-//template “a”
+//template <a>
function void test(){}
//function void test(int i[]){<<<i>>>;}
//function void test(Object o){}
}
class E extends C {
- <C.D> d;
+ C->D d;
}
class F {
- <F.D> d;
+ F->D d;
}
// [contains] can only be used at class scope.
-union private static { int i; } u;
+union static private { int i; } u;
// [contains] template call of non-function value
int test;
-test“int”();
+test<int>();
// [contains] you must provide template types
-template“A”
+template<A>
class C {
A a;
}
// [contains]
- template“a, b”
+ template<a, b>
function void test(){}
test();
// [contains] arguments do not match for template call
-template “i”
+template <i>
function void test(){ <<<"func">>>;}
-template “i”
+template <i>
function void test(int i){<<<"other func">>>;}
-test“int, float, int”();
-//test“int”();
+test<int, float, int>();
+//test<int>();
// [contains] arguments do not match for template call
class C
{
- template “a”
+ template <a>
function void test(float f) {}
- template “a”
+ template <a>
function void test() {}
}
C c;
-//c.test“int”();
-c.test“int”(2.3);
-c.test“int”(2.3, 2.3);
+//c.test<int>();
+c.test<int>(2.3);
+c.test<int>(2.3, 2.3);
// [contains]
- Math.rand“int”();
+ Math.rand<int>();
// [contains] unknown type
- template“my_type”
+ template<my_type>
function void my_function() { <<<"test">>>; }
-my_function“unknown_type”();
+my_function<unknown_type>();
// [contains] is not template
-“int”Object o;
+<int>Object o;
// [contains] unknown type
-function void test(<B.C> a){}
+function void test(B->C a){}
// [contains] can only be used at class scope.
-union private static { int i; };
+union static private { int i; };
//class child {}
-//template“A, B”
+//template<A, B>
//class C{ A key; B value; }
-//“int, int”C c1;
-//“float, float”C c2;
+//<int, int>C c1;
+//<float, float>C c2;
//<<<c1>>>;
//<<<c2>>>;
//<<<c2.value>>>;
-“int, int”ClassTemplate ct;
+<int, int>ClassTemplate ct;
<<<ct.key>>>;
-//“float, float”ClassTemplate ct2;
+//<float, float>ClassTemplate ct2;
//<<<ct2.key>>>;
-//“child, float”ClassTemplate ct3;
+//<child, float>ClassTemplate ct3;
//<<<ct3.key>>>;
-“int, int”PairExt p;
+<int, int>PairExt p;
<<<p>>>;
<<<p.key>>>;
<<<p.val>>>;
-“int, float”Map pp;
+<int, float>Map pp;
<<<pp>>>;
<<<pp.size()>>>;
<<<pp.set(1, 2)>>>;
-“int”Ptr ptr;
+<int>Ptr ptr;
int i[4];
for(auto@ a : i)
<<<*a>>>;
-template“A, B”
+template<A, B>
class C {
A a;
B b;
fun A test() {
<<<"lol">>>;
}
- template“C”
+ template<C>
fun void test2(C c) {
<<<c>>>;
}
}
//<<<C>>>;
-“int, int”C c;
-“float, int”C d;
-“polar, int”C e;
-“Vec3, int”C f;
-“Object, int”C g;
+<int, int>C c;
+<float, int>C d;
+<polar, int>C e;
+<Vec3, int>C f;
+<Object, int>C g;
//C c;
<<<c.a>>>;
<<<d.a>>>;
-“int, int”Map pp;
+<int, int>Map pp;
<<<pp>>>;
<<<pp.size()>>>;
<<<pp.set(1, 2)>>>;
-class C { union private static { int i; } u;<<<this, " ", u, " ", this.u.i>>>;
+class C { union static private { int i; } u;<<<this, " ", u, " ", this.u.i>>>;
}
C c;
<<<c>>>;
-“float, int”Pair p;
+<float, int>Pair p;
<<<p>>>;
1 => p.key;
2 => p.val;
-template “A”
+template <A>
class C {
A a;
}
class D {
- static “int”C c;
+ static <int>C c;
}
D d;
-template“A”
+template<A>
class C {}
-“int”C ref;
+<int>C ref;
<<<ref>>>;
-template“A”
+template<A>
function void test(A a){}
(maybe ? test : test)(1);
-“int, int”Pair p;
-typedef “int, int”Pair lol;
+<int, int>Pair p;
+typedef <int, int>Pair lol;
lol t;
<<<t>>>;
<<<t.key>>>;
class C extends lol { int i;}
C c;
<<<c.i>>>;
-template “A” class D {
+template <A> class D {
<<<"lol">>>;
int i;
}
-typedef “int”D Lol;
+typedef <int>D Lol;
class E extends Lol {
float f;
}