Skip to content

Commit 719a444

Browse files
New Features development (#149)
* some updates * added fix for captured generics in reduce call * added test for labdba function with captured variables * added fixes and test * updated test * update test * progress of implementing struct null checks * added support for null type * fixes union with null and undefined * progress of fixes for array debug info * set array size type as index * refactoring length with index type * update of length type * some fixes to length ops with new index type * more fixes to index type for length * more fixes * progress of fixes * fix null checks * fixes to array ops using new index type * fix to newarray * fixes * fix for using null and any * fixes for optional null type * added missing part to parse directives in comments * added ts-nocheck and ts-check * updated tests to disable null checks * more fixes to index type and set length * fixed cast from index to float * some fixes to unboxing from union type * added cast from index to string * removed hack to use ToString on number etc * fixed issue with merging function types * update * replaced strict null check comment pragma * fixed issue with opt value and union type * fix for casting from null type * fixed issue with templated literal type * added test for template type * fixes to array index operations * updated readme and build files * updating print functions * fixes to print types * progress of implementing vscode project * progress of implementing vscode project * added some files to vscode proj * added launch template for vscode * updated dumps for linux and win32 in vscode * added path to app * update * updated code to generate vscode project * progress * fixes * updated into R string * more R strings * fixes * fix for GlobalOp debug info * fixed issue with wrong array info * progress of implementing debugger info * progress of implementing code to build default lib * fixed issue with index and literal int merge * fixes to print type * fixed issue with index of array view * fixes to vswhere * more experiments * progress of setting build script * update * updated some code * update * update some fixes * refactoring compileOptions * more refactoring * more fixes * more refactoring compileOptions * final fix
1 parent 1c7bac1 commit 719a444

72 files changed

Lines changed: 2267 additions & 720 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 16 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,22 @@
99
[![Test Build (Linux)](https://github.com/ASDAlexander77/TypeScriptCompiler/actions/workflows/cmake-test-release-linux.yml/badge.svg)](https://github.com/ASDAlexander77/TypeScriptCompiler/actions/workflows/cmake-test-release-linux.yml)
1010

1111
# What's new
12+
- Visual Studio Code project
13+
```cmd
14+
tsc --new Test1
15+
```
16+
17+
- Strict null checks
18+
```TypeScript
19+
let sn: string | null = null; // Ok
20+
let s: string = null; // error
21+
```
22+
23+
- improved `Template Literal Types`
24+
```TypeScript
25+
type Color = "red" | "green" | "blue";
26+
type HexColor<T extends Color> = `#${string}`;
27+
```
1228

1329
- Public, private, and protected modifiers
1430
```TypeScript
@@ -56,142 +72,12 @@ const v1 = gen<i32>(23); // result: int
5672
const v2 = gen<string[]>([]); // result: 0
5773
```
5874

59-
- indexes for classes and interfaces, properties for interfaces
60-
```TypeScript
61-
class Test {
62-
// declare index (to assigning get/set methods to it)
63-
[index1: number]: string;
64-
65-
get(index: number): string {
66-
return "index";
67-
}
68-
69-
set(index: number, value: string) {
70-
}
71-
72-
get val(): string {
73-
return "prop";
74-
}
75-
}
76-
77-
interface ITest {
78-
[index1: number]: string;
79-
80-
get val(): string;
81-
}
82-
83-
const t = new Test();
84-
print(t[10]);
85-
86-
const ti: ITest = t;
87-
print(ti[10]);
88-
print(ti.val);
89-
```
90-
91-
- no need to define 'main' function
92-
```TypeScript
93-
const arr = [1, 2, 3, 4, 5];
94-
for (const b of arr)
95-
print(b);
96-
```
97-
98-
- Accessor for object fields
99-
```TypeScript
100-
let obj = {
101-
p: 1.0,
102-
get value() { return this.p; },
103-
set value(v: number) { this.p = v; },
104-
}
105-
```
106-
107-
- Class static block
108-
```TypeScript
109-
class C {
110-
static x: number;
111-
static {
112-
C.x = 1;
113-
}
114-
}
115-
```
116-
11775
- Migrated to LLVM 19.1.3
11876

11977
- improved ```generating debug information``` more info here: [Wiki:How-To](https://github.com/ASDAlexander77/TypeScriptCompiler/wiki/How-To#compile-and-debug-with-visual-studio-code)
12078
```cmd
12179
tsc --di --opt_level=0 --emit=exe example.ts
12280
```
123-
124-
- cast from Union Types
125-
```TypeScript
126-
let a: string | number = 5;
127-
let b: string = a; // b is "5"
128-
```
129-
130-
- All functions without types are generics
131-
```TypeScript
132-
static class Array {
133-
public of(...arg) {
134-
return arg;
135-
}
136-
137-
public from(arrayLike) {
138-
return [...arrayLike];
139-
}
140-
}
141-
```
142-
143-
- Native types aliases
144-
```TypeScript
145-
// byte, short, ushort, int, uint, long, ulong, char, i8, i16, i32, i64,
146-
// u8, u16, u32, u64, s8, s16, s32, s64, f16, f32, f64, f128, half, float, double, index
147-
148-
const s1: s8 = -1;
149-
const s2: u16 = 2;
150-
const s3: i32 = 3;
151-
const s4: f64 = 1.0;
152-
```
153-
- Reference types (aka pointers)
154-
```TypeScript
155-
let a = [1, 2, 3];
156-
const view: Reference<TypeOf<1>> = ReferenceOf(a[1]);
157-
const data = LoadReference(view);
158-
const data1 = LoadReference(view[1]);
159-
```
160-
- Accessor
161-
```TypeScript
162-
class Person {
163-
static accessor sname: string;
164-
accessor name = "no value";
165-
constructor(name: string) {
166-
this.name = name;
167-
}
168-
}
169-
```
170-
171-
- Explicit Resource Management
172-
```TypeScript
173-
function main()
174-
{
175-
using file = new TempFile(".some_temp_file");
176-
print("done.");
177-
}
178-
179-
class TempFile {
180-
#path: string;
181-
#handle: number;
182-
constructor(path: string) {
183-
this.#path = path;
184-
this.#handle = 1;
185-
}
186-
// other methods
187-
[Symbol.dispose]() {
188-
// Close the file and delete it.
189-
this.#handle = 0;
190-
print("dispose");
191-
}
192-
}
193-
```
194-
19581
- [more...](https://github.com/ASDAlexander77/TypeScriptCompiler/wiki/What's-new)
19682

19783
# Planning

0 commit comments

Comments
 (0)