typecheck
parent 49de425e45
commit b5488d5c92

@ -299,6 +299,7 @@ public final class TypeChecker
* Emit a variable declaration instruction
*/
Variable variablePNode = cast(Variable)dnode.getEntity();
gprintln("HELLO NIGGA");
string variableName = resolver.generateName(modulle, variablePNode);
VariableDeclaration varDecInstr = new VariableDeclaration(variableName, 4);
@ -361,6 +362,11 @@ public final class TypeChecker
string clazzName = resolver.generateName(modulle, clazzPNode);
/* TODO: I am rushing so idk which quantum op to use */
// addInstrB(new ClassStaticInitAllocate(clazzName));
/**
* Add the class allocator instruction
*/
addInstrB(new ClassStaticInitAllocate(clazzName));
SList!(Instruction) kept;
@ -417,6 +423,8 @@ public final class TypeChecker
}
/**
* Add the collected instructions
*/
@ -1330,4 +1338,39 @@ unittest
/* Make sure the member y.y collided with root container (module) y */
assert(e.defined == container);
}
}
/* Test name colliding with container name (1/2) */
unittest
{
import std.file;
import std.stdio;
import compiler.lexer;
import compiler.parsing.core;
string sourceFile = "source/tlang/testing/typecheck/simple_dependence_correct7.t";
File sourceFileFile;
sourceFileFile.open(sourceFile); /* TODO: Error handling with ANY file I/O */
ulong fileSize = sourceFileFile.size();
byte[] fileBytes;
fileBytes.length = fileSize;
fileBytes = sourceFileFile.rawRead(fileBytes);
sourceFileFile.close();
string sourceCode = cast(string) fileBytes;
Lexer currentLexer = new Lexer(sourceCode);
currentLexer.performLex();
Parser parser = new Parser(currentLexer.getTokens());
Module modulle = parser.parse();
TypeChecker typeChecker = new TypeChecker(modulle);
/* Perform test */
typeChecker.beginCheck();
}

@ -18,6 +18,8 @@ p = 4;
p = 4;
j=232321213;
discard "Must look at case the above line doesn't exist and STILL we should allocate (line 28)";
class F
{
static G f1;
@ -25,6 +27,8 @@ class F
P p1;
static P p2;
static class P
{
int p1;
@ -46,3 +50,4 @@ class G
F f;
G g;

Loading…
Cancel
Save