DGen
- Cleaned up emit() method - New test case hashes inserted for entryPoint test code Test cases - Updated `simple_function_decls.t` to be exactly that, ONLY declarations with basic bodies - Migrated advanced function usage testing code to a new unit test: `simple_functions.t`
This commit is contained in:
parent
f8a6fb0962
commit
9405c03e10
|
@ -195,20 +195,15 @@ public final class DCodeEmitter : CodeEmitter
|
|||
// Emit header comment (NOTE: Change this to a useful piece of text)
|
||||
emitHeaderComment("Place any extra information by code generator here"); // NOTE: We can pass a string with extra information to it if we want to
|
||||
|
||||
// Emit static allocation code
|
||||
emitStaticAllocations();
|
||||
|
||||
// Emit globals
|
||||
emitCodeQueue();
|
||||
|
||||
// Emit function definitions
|
||||
emitFunctionDefinitions();
|
||||
|
||||
gprintln("\n\n\n");
|
||||
|
||||
// emitCodeQueue();
|
||||
|
||||
gprintln("\n\n\n");
|
||||
|
||||
//TODO: Emit function definitions
|
||||
|
||||
//TODO: Emit main (entry point)
|
||||
emitEntryPoint();
|
||||
}
|
||||
|
@ -376,9 +371,9 @@ public final class DCodeEmitter : CodeEmitter
|
|||
#include<stdio.h>
|
||||
int main()
|
||||
{
|
||||
printf("k: %u\n", t_0c9714cea1ccdfdd0345347c86885620);
|
||||
printf("k: %u\n", t_7b6d477c5859059f16bc9da72fc8cc3b);
|
||||
banana(1);
|
||||
printf("k: %u\n", t_0c9714cea1ccdfdd0345347c86885620);
|
||||
printf("k: %u\n", t_7b6d477c5859059f16bc9da72fc8cc3b);
|
||||
return 0;
|
||||
}`);
|
||||
}
|
||||
|
|
|
@ -6,16 +6,9 @@ int k = 22;
|
|||
int apple(int arg1, int arg2)
|
||||
{
|
||||
int h = 69;
|
||||
|
||||
arg1=1+arg1;
|
||||
|
||||
k=arg1+arg2;
|
||||
}
|
||||
|
||||
int banana(int arg1)
|
||||
{
|
||||
int h = 64;
|
||||
|
||||
k=1+h+apple(1, apple(2, 3))+k;
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
module simple_functions;
|
||||
|
||||
int j = 21;
|
||||
int k = 22;
|
||||
|
||||
int apple(int arg1, int arg2)
|
||||
{
|
||||
int h = 69;
|
||||
|
||||
arg1=1+arg1;
|
||||
|
||||
k=arg1+arg2;
|
||||
}
|
||||
|
||||
int banana(int arg1)
|
||||
{
|
||||
int h = 64;
|
||||
|
||||
k=1+h+apple(1, apple(2, 3))+k;
|
||||
|
||||
}
|
Loading…
Reference in New Issue