Rework resolver (#489)

* Rework IR and resolver to use nested lookup tables
* Integrate types into IR
* Make components prefer IR, slimmed down AST
* Implement `export *`
* Add `@lazy` annotation and remove `--noTreeShaking`
* Add `@start` annotation and remove magic `main`
* Related refactoring, cleanup and docs
This commit is contained in:
Daniel Wirtz
2019-02-21 00:11:22 +01:00
committed by GitHub
parent e623786b42
commit 0c64f21250
234 changed files with 16949 additions and 37871 deletions

View File

@ -59,20 +59,20 @@ export namespace atomic {
@builtin export declare function i8(value: void): i8;
export namespace i8 {
export const MIN_VALUE: i8 = -128;
export const MAX_VALUE: i8 = 127;
@lazy export const MIN_VALUE: i8 = -128;
@lazy export const MAX_VALUE: i8 = 127;
}
@builtin export declare function i16(value: void): i16;
export namespace i16 {
export const MIN_VALUE: i16 = -32768;
export const MAX_VALUE: i16 = 32767;
@lazy export const MIN_VALUE: i16 = -32768;
@lazy export const MAX_VALUE: i16 = 32767;
}
@builtin export declare function i32(value: void): i32;
export namespace i32 {
export const MIN_VALUE: i32 = -2147483648;
export const MAX_VALUE: i32 = 2147483647;
@lazy export const MIN_VALUE: i32 = -2147483648;
@lazy export const MAX_VALUE: i32 = 2147483647;
@builtin export declare function clz(value: i32): i32;
@builtin export declare function ctz(value: i32): i32;
@builtin export declare function popcnt(value: i32): i32;
@ -134,8 +134,8 @@ export namespace i32 {
@builtin export declare function i64(value: void): i64;
export namespace i64 {
export const MIN_VALUE: i64 = -9223372036854775808;
export const MAX_VALUE: i64 = 9223372036854775807;
@lazy export const MIN_VALUE: i64 = -9223372036854775808;
@lazy export const MAX_VALUE: i64 = 9223372036854775807;
@builtin export declare function clz(value: i64): i64;
@builtin export declare function ctz(value: i64): i64;
@builtin export declare function load8_s(offset: usize, constantOffset?: usize): i64;
@ -210,60 +210,60 @@ export namespace i64 {
@builtin export declare function isize(value: void): isize;
export namespace isize {
export const MIN_VALUE: isize = sizeof<i32>() == sizeof<isize>()
@lazy export const MIN_VALUE: isize = sizeof<i32>() == sizeof<isize>()
? -2147483648
: <isize>-9223372036854775808;
export const MAX_VALUE: isize = sizeof<i32>() == sizeof<isize>()
@lazy export const MAX_VALUE: isize = sizeof<i32>() == sizeof<isize>()
? 2147483647
: <isize>9223372036854775807;
}
@builtin export declare function u8(value: void): u8;
export namespace u8 {
export const MIN_VALUE: u8 = 0;
export const MAX_VALUE: u8 = 255;
@lazy export const MIN_VALUE: u8 = 0;
@lazy export const MAX_VALUE: u8 = 255;
}
@builtin export declare function u16(value: void): u16;
export namespace u16 {
export const MIN_VALUE: u16 = 0;
export const MAX_VALUE: u16 = 65535;
@lazy export const MIN_VALUE: u16 = 0;
@lazy export const MAX_VALUE: u16 = 65535;
}
@builtin export declare function u32(value: void): u32;
export namespace u32 {
export const MIN_VALUE: u32 = 0;
export const MAX_VALUE: u32 = 4294967295;
@lazy export const MIN_VALUE: u32 = 0;
@lazy export const MAX_VALUE: u32 = 4294967295;
}
@builtin export declare function u64(value: void): u64;
export namespace u64 {
export const MIN_VALUE: u64 = 0;
export const MAX_VALUE: u64 = 18446744073709551615;
@lazy export const MIN_VALUE: u64 = 0;
@lazy export const MAX_VALUE: u64 = 18446744073709551615;
}
@builtin export declare function usize(value: void): usize;
export namespace usize {
export const MIN_VALUE: usize = 0;
export const MAX_VALUE: usize = sizeof<u32>() == sizeof<usize>()
@lazy export const MIN_VALUE: usize = 0;
@lazy export const MAX_VALUE: usize = sizeof<u32>() == sizeof<usize>()
? 4294967295
: <usize>18446744073709551615;
}
@builtin export declare function bool(value: void): bool;
export namespace bool {
export const MIN_VALUE: bool = false;
export const MAX_VALUE: bool = true;
@lazy export const MIN_VALUE: bool = false;
@lazy export const MAX_VALUE: bool = true;
}
@builtin export declare function f32(value: void): f32;
export namespace f32 {
export const EPSILON = reinterpret<f32>(0x34000000); // 0x1p-23f
export const MIN_VALUE = reinterpret<f32>(0x00000001); // 0x0.000001p+0f
export const MAX_VALUE = reinterpret<f32>(0x7F7FFFFF); // 0x1.fffffep+127f
export const MIN_NORMAL_VALUE = reinterpret<f32>(0x00800000); // 0x1p-126f
export const MIN_SAFE_INTEGER: f32 = -16777215;
export const MAX_SAFE_INTEGER: f32 = 16777215;
@lazy export const EPSILON = reinterpret<f32>(0x34000000); // 0x1p-23f
@lazy export const MIN_VALUE = reinterpret<f32>(0x00000001); // 0x0.000001p+0f
@lazy export const MAX_VALUE = reinterpret<f32>(0x7F7FFFFF); // 0x1.fffffep+127f
@lazy export const MIN_NORMAL_VALUE = reinterpret<f32>(0x00800000); // 0x1p-126f
@lazy export const MIN_SAFE_INTEGER: f32 = -16777215;
@lazy export const MAX_SAFE_INTEGER: f32 = 16777215;
@builtin export declare function abs(value: f32): f32;
@builtin export declare function ceil(value: f32): f32;
@builtin export declare function copysign(x: f32, y: f32): f32;
@ -280,12 +280,12 @@ export namespace f32 {
@builtin export declare function f64(value: void): f64;
export namespace f64 {
export const EPSILON = reinterpret<f64>(0x3CB0000000000000); // 0x1p-52
export const MIN_VALUE = reinterpret<f64>(0x0000000000000001); // 0x0.0000000000001p+0
export const MAX_VALUE = reinterpret<f64>(0x7FEFFFFFFFFFFFFF); // 0x1.fffffffffffffp+1023
export const MIN_NORMAL_VALUE = reinterpret<f64>(0x0010000000000000); // 0x1p-1022
export const MIN_SAFE_INTEGER: f64 = -9007199254740991;
export const MAX_SAFE_INTEGER: f64 = 9007199254740991;
@lazy export const EPSILON = reinterpret<f64>(0x3CB0000000000000); // 0x1p-52
@lazy export const MIN_VALUE = reinterpret<f64>(0x0000000000000001); // 0x0.0000000000001p+0
@lazy export const MAX_VALUE = reinterpret<f64>(0x7FEFFFFFFFFFFFFF); // 0x1.fffffffffffffp+1023
@lazy export const MIN_NORMAL_VALUE = reinterpret<f64>(0x0010000000000000); // 0x1p-1022
@lazy export const MIN_SAFE_INTEGER: f64 = -9007199254740991;
@lazy export const MAX_SAFE_INTEGER: f64 = 9007199254740991;
@builtin export declare function abs(value: f64): f64;
@builtin export declare function ceil(value: f64): f64;
@builtin export declare function copysign(x: f64, y: f64): f64;
@ -301,5 +301,3 @@ export namespace f64 {
}
@builtin export declare function start(): void;
@builtin export function NATIVE_CODE(): void { unreachable(); }