Use correct sizes and alignments. Fix designated initializers and literals. Added todo

This commit is contained in:
Christoffer Lerno
2020-04-06 13:45:58 +02:00
parent 60c60a3205
commit 400c38b95b
23 changed files with 537 additions and 163 deletions

View File

@@ -2,16 +2,6 @@ module bar;
typedef int as Bob;
/* hello *//* there */
/+ why /+ you /* lucky +/ +/
// Whut
// Here
//
//---
/*
Hello
*/
struct Test
{
int a;
@@ -38,32 +28,6 @@ struct Teob
int oekfeo;
}
typedef long as Frob;
enum EnumTestAlias : Frob
{
VALUE1 = 4,
VALUE2
}
enum EnumTestDefault
{
VALUE,
VALUE2
}
enum EnumTestNoOverflowAfterLong : long
{
VALUE = 0x7FFF_FFFF_FFFF_FFFE,
VALUE_NO_EXCEED
}
enum EnumTestSmall : ushort
{
VALUE = 0xFF,
VALUE2 = 0xFFFF
}
enum EnumWithData : ushort (int a, char[] x, long b = 4)
{
// Currently the args are ignored TODO!
@@ -105,8 +69,8 @@ error Error
{
BLURB,
NO_SUCH_FILE,
}
error OtherError
{
FOO_BAR
@@ -128,6 +92,39 @@ enum Inf2 : byte
typedef Inf as BooInf;
struct TestStruct
{
int a;
}
struct TestStruct2
{
TestStruct a;
char xx;
TestStruct b;
int c;
}
union TestUnion
{
int a;
double f;
}
func TestStruct structTest(int i)
{
TestUnion tu;
/* TestStruct foo = { i };
TestStruct foo2 = { a = i };*/
TestStruct foo3 = TestStruct { i };
return foo3;
/* TestStruct2 bar = { c = 2 };
int x = 3 * i;
TestStruct2 bar2 = { b.a = x, a.a = x + 1 };
return bar2;*/
}
func void enumInferenceTest()
{
OtherError e = OtherError.FOO_BAR;

View File

@@ -0,0 +1,13 @@
module comments;
/* Span *//* style */
/+ Nested /+ Errors /* Inside +/ +/
// Single line
/*
Multiline span style
*/
func void test()
{
return;
}

View File

@@ -4,3 +4,28 @@ enum EnumTest : long
VALUE2
}
typedef long as Frob;
enum EnumTestAlias : Frob
{
VALUE1 = 4,
VALUE2
}
enum EnumTestDefault
{
VALUE,
VALUE2
}
enum EnumTestNoOverflowAfterLong : long
{
VALUE = 0x7FFF_FFFF_FFFF_FFFE,
VALUE_NO_EXCEED
}
enum EnumTestSmall : ushort
{
VALUE = 0xFF,
VALUE2 = 0xFFFF
}

View File

@@ -0,0 +1,12 @@
module errors;
error TheError
{
FOO_MISSING,
NO_SUCH_FILE,
}
error OtherError
{
BAR_OVERFLOWED
}

View File

View File

@@ -0,0 +1,5 @@
module typedefs;
typedef Loop as Loop2;
typedef Loop2 as Loop3;
typedef Loop3 as Loop;

View File

@@ -0,0 +1,14 @@
module typedefs;
// Standard case
typedef int as Foo;
// Nested resolution
typedef AType as BType;
typedef int as AType;
enum Bar : BType
{
A,
B
}