Lookahead cleanup. Start work on throws. Fix try expressions. Beginning work on initializer. Some fixes on LLVM types. Moving more target info into C3. Moving alignment into types Introducing a meta type (incomplete). Start work on macros. Splitting '@' from macro name.

This commit is contained in:
Christoffer Lerno
2020-02-14 11:15:35 +01:00
parent ae683d2811
commit ebbea2ac42
51 changed files with 7227 additions and 497 deletions

View File

@@ -15,17 +15,18 @@ public struct Map
uint mod;
}
public func Map@ Map.new()
public func Map* Map.init(Map *map)
{
return @calloc(Map);
*map = { };
return map;
}
public func Type *Map.valueForKey(Map *map, Key key)
public func Type* Map.valueForKey(Map *map, Key key)
{
if (!map.map) return nil;
usize hash = key.hash();
usize pos = hash & map.mod;
Entry *entry = &map.map[pop];
Entry* entry = &map.map[pop];
if () return nil;
while (entry)
{
@@ -80,7 +81,7 @@ public func void Map.removeLast(Vector *vector)
vector.array.pop();
}
public macro Vector.@foreach(Vector *vector : @body(Type value))
public macro Vector.foreach(Vector *vector, macro void(Type value) body)
{
for (usize i = 0, i < vector.array.size; i++)
{
@@ -98,7 +99,7 @@ test
{
printDigit(i);
}
vector.@foreach(int i)
@vector.foreach(int i)
{
printDigit(i);
}