-Subproject commit 90919a17d261acf6b31d0b33981371b211f0cb2c
+Subproject commit 66d993ff6c549baffd5b863a7f9761d8f52b63a5
-class C
-{
- template<a>
+class C {
+ template<~a~>
function void test(a var){ <<<var>>>; }
class D { int i;}
}
-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<~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~>(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);
// mem
// rnd
// dl
- Scanner *scan;
Env env;
Emitter emit;
VM* vm;
static m_bool check(struct Gwion_* gwion, struct Compiler* c) {
CHECK_BB(compiler_open(c))
- CHECK_OB((c->ast = parse(gwion->scan, c->name, c->file)))
+ CHECK_OB((c->ast = parse(c->name, c->file)))
gwion->env->name = c->name;
return type_engine_check_prog(gwion->env, c->ast);
}
gwion->vm = new_vm();
gwion->emit = new_emitter();
gwion->env = new_env();
- gwion->scan = new_scanner(127); // !!! magic number
gwion->emit->env = gwion->env;
gwion->vm->gwion = gwion;
gwion->env->gwion = gwion;
free_env(gwion->env);
free_emitter(gwion->emit);
free_vm(gwion->vm);
- free_scanner(gwion->scan);
free_symbols();
}
DECL_SECTION_FUNC(scan1)
ANN static m_bool scan1_class_parent(const Env env, const Class_Def class_def) {
- if(class_def->ext->array) {
- if(class_def->ext->array->exp)
- CHECK_BB(scan1_exp(env, class_def->ext->array->exp))
- else
- ERR_B(class_def->ext->xid->pos, "can't use empty []'s in class extend")
- }
+ if(class_def->ext->array)
+ CHECK_BB(scan1_exp(env, class_def->ext->array->exp))
const Type parent = class_def->type->parent = known_type(env, class_def->ext);
CHECK_OB(parent)
if(isa(class_def->type->parent, t_object) < 0)
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){}
-// [contains] can't use empty
+// [contains] instantiate with empty
new Object[];
// [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>
+class C {
+ 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;
//class child {}
-//template<A, B>
+//template<~A, B~>
//class C{ A key; B value; }
-//<int, int>C c1;
+//<~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;
//<<<ct2.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)>>>;
-<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;
}
-Subproject commit e0446891fd79e6ac9f575b8811420427e10f9b8b
+Subproject commit 9e90c8e8470e94ad319e5bfc75717f6dacb1d6c4