Got the new scoping working! Still some odd stuff happening to certian templates, and I think vector is having problems with new/traits. Really need to get canonnical filenames and what not worked out
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import io;
|
||||
import io:*;
|
||||
|
||||
typedef Vec2 {
|
||||
|int| x;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import io;
|
||||
import io:*;
|
||||
|
||||
|int| fibanacci(|int| num) {
|
||||
if (num < 2)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Comment first! */
|
||||
import io;
|
||||
import io:*;
|
||||
|
||||
|int| main() {
|
||||
println(1337);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import io;
|
||||
import mem;
|
||||
import io:*;
|
||||
import mem:*;
|
||||
|
||||
typedef ClassWithConstructor {
|
||||
|int| data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import io;
|
||||
import io:*;
|
||||
|
||||
typedef DestructorPrint {
|
||||
|char*| myStr;
|
||||
|
||||
@@ -4,6 +4,6 @@ import io;
|
||||
|
||||
|int| main() {
|
||||
nothing();
|
||||
println("It was nothing");
|
||||
io::println("It was nothing");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import io;
|
||||
import io:*;
|
||||
|
||||
template <T,J> |void| addAndPrint(|T| a, |J| b) {
|
||||
print(a+b);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import io;
|
||||
import io:*;
|
||||
|
||||
|int| ret1() {
|
||||
return ret2() / 2;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import io;
|
||||
|
||||
template <T> |T| addAndPrint(|T| a, |T| b) {
|
||||
print(a+b);
|
||||
io::print(a+b);
|
||||
return a+b;
|
||||
}
|
||||
|
||||
|int| main() {
|
||||
addAndPrint<int>(10,12);
|
||||
print("\n");
|
||||
io::print("\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import mem;
|
||||
import io;
|
||||
import mem:*;
|
||||
import io:*;
|
||||
|
||||
typedef AnObject {
|
||||
|int| a;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import io;
|
||||
import io:*;
|
||||
|
||||
typedef firstObject {
|
||||
|int| objectNum;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import io;
|
||||
import trivial_container;
|
||||
import io:*;
|
||||
import trivial_container:*;
|
||||
|
||||
typedef RegularObject {
|
||||
|int| num;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
Qualified io!
|
||||
7
|
||||
0
|
||||
9
|
||||
11
|
||||
Qualified Container!
|
||||
Even template functions qualified!
|
||||
|
||||
Unqualified io!
|
||||
8
|
||||
0
|
||||
10
|
||||
12
|
||||
Unqualified Container!
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import io;
|
||||
import io:*;
|
||||
|
||||
typedef objectA {
|
||||
|int| a;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
krakenPath="../build/kraken"
|
||||
testDir=${1:-"../tests"}
|
||||
#testDir=${1:-"../tests"}
|
||||
testDir="."
|
||||
ext=${2:-"krak"}
|
||||
|
||||
fileList=""
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
typedef unqualified_class {
|
||||
|int| number;
|
||||
|qualified_class*| construct(|int| num) {
|
||||
|unqualified_class*| construct(|int| num) {
|
||||
number = num;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import io;
|
||||
import io:*;
|
||||
|
||||
|int| addAndPrintInt(|int| a, |int| b) {
|
||||
print(a+b);
|
||||
|
||||
@@ -5,12 +5,12 @@ typedef template <T,J> TemplateTest {
|
||||
|T| a;
|
||||
|J| b;
|
||||
|void| print() {
|
||||
print("a: ");
|
||||
print(a);
|
||||
print("\n");
|
||||
print("b: ");
|
||||
print(b);
|
||||
print("\n");
|
||||
io::print("a: ");
|
||||
io::print(a);
|
||||
io::print("\n");
|
||||
io::print("b: ");
|
||||
io::print(b);
|
||||
io::print("\n");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -5,12 +5,12 @@ typedef template <T> TemplateTest {
|
||||
|int| a;
|
||||
|T| b;
|
||||
|void| print() {
|
||||
print("a: ");
|
||||
print(a);
|
||||
print("\n");
|
||||
print("b: ");
|
||||
print(b);
|
||||
print("\n");
|
||||
io::print("a: ");
|
||||
io::print(a);
|
||||
io::print("\n");
|
||||
io::print("b: ");
|
||||
io::print(b);
|
||||
io::print("\n");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
|
||||
import io;
|
||||
|
||||
typedef FirstObject {
|
||||
|int| objectNum;
|
||||
|void| PrintSelf(|int| a) {
|
||||
print(objectNum);
|
||||
print(a);
|
||||
io::print(objectNum);
|
||||
io::print(a);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -13,6 +12,6 @@ typedef FirstObject {
|
||||
|FirstObject| wooObject;
|
||||
wooObject.objectNum = 5;
|
||||
wooObject.PrintSelf(7);
|
||||
print("\n");
|
||||
io::print("\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import io;
|
||||
import trivial_container;
|
||||
import io:*;
|
||||
import trivial_container:*;
|
||||
|
||||
typedef template <T> TemplateTest {
|
||||
|int| a;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import io;
|
||||
import mem;
|
||||
import io:*;
|
||||
import mem:*;
|
||||
|
||||
|int| main() {
|
||||
|int| b;
|
||||
|
||||
1
tests/topLevelVarInit.expected_results
Normal file
1
tests/topLevelVarInit.expected_results
Normal file
@@ -0,0 +1 @@
|
||||
42
|
||||
8
tests/topLevelVarInit.krak
Normal file
8
tests/topLevelVarInit.krak
Normal file
@@ -0,0 +1,8 @@
|
||||
import io;
|
||||
|
||||
|int| a = 42;
|
||||
|
||||
|int| main() {
|
||||
io::println(a);
|
||||
return 0;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import io;
|
||||
import io:*;
|
||||
|
||||
typedef NoTraits {};
|
||||
|
||||
@@ -48,13 +48,13 @@ typedef template<T(FirstTrait, SecondTrait)> OneTwoObj {};
|
||||
|Trait2| c;
|
||||
|TwoTrait| d;
|
||||
|AlreadySpecilized| e;
|
||||
|
||||
|
||||
OneTwoFunc<NoTraits>(a);
|
||||
OneTwoFunc<Trait1>(b);
|
||||
OneTwoFunc<Trait2>(c);
|
||||
OneTwoFunc<TwoTrait>(d);
|
||||
// OneTwoFunc<AlreadySpecilized>(e);
|
||||
|
||||
|
||||
println();
|
||||
|
||||
|OneTwoObj<NoTraits>| alpha;
|
||||
|
||||
@@ -7,7 +7,7 @@ typedef ClassWithConstructor {
|
||||
return this;
|
||||
}
|
||||
|void| printData() {
|
||||
println(data);
|
||||
io::println(data);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -15,6 +15,6 @@ typedef ClassWithConstructor {
|
||||
|ClassWithConstructor| object.construct(4);
|
||||
object.printData();
|
||||
|int| a = 8;
|
||||
println(a);
|
||||
io::println(a);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import io;
|
||||
import mem;
|
||||
import vector;
|
||||
import io:*;
|
||||
import mem:*;
|
||||
import vector:*;
|
||||
|
||||
typedef AbleToBeDestroyed (Destructable) {
|
||||
|void| destruct() {
|
||||
@@ -16,9 +16,9 @@ typedef AbleToBeDestroyed (Destructable) {
|
||||
intVec.addEnd(7);
|
||||
for (|int| i = 0; i < intVec.size; i++;)
|
||||
print(intVec.at(i));
|
||||
|
||||
|
||||
println();
|
||||
|
||||
|
||||
|vector<AbleToBeDestroyed>*| desVec = new<vector<AbleToBeDestroyed>>()->construct();
|
||||
|AbleToBeDestroyed| testDestruct;
|
||||
desVec->addEnd(testDestruct);
|
||||
|
||||
Reference in New Issue
Block a user