-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
minor (#663): simplified generation and added built in runtime types …
…in the compiler
- Loading branch information
1 parent
83a8cb6
commit 9694c40
Showing
6 changed files
with
70 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
kipper/core/src/compiler/semantics/types/built-in/object.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { BuiltInType, type CompilableType } from "../index"; | ||
|
||
/** | ||
* Represents the built-in type `void`. | ||
* @since 0.12.0 | ||
*/ | ||
export class BuiltInTypeObject extends BuiltInType implements CompilableType { | ||
constructor() { | ||
super("obj"); | ||
} | ||
|
||
/** | ||
* Returns whether the type is a compilable type. | ||
* | ||
* This is always true for the built-in type `void`. | ||
* @since 0.12.0 | ||
*/ | ||
public get isCompilable(): true { | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export class BuiltInRuntimeType { | ||
name: string; | ||
value: string; | ||
|
||
constructor(name: string, value: string) { | ||
this.name = name; | ||
this.value = value; | ||
} | ||
} | ||
|
||
export const builtInTypes: Array<BuiltInRuntimeType> = [ | ||
new BuiltInRuntimeType("num", 'new Type("num", undefined, undefined)'), | ||
new BuiltInRuntimeType("str", 'new Type("str", undefined, undefined)'), | ||
new BuiltInRuntimeType("bool", 'new Type("bool", undefined, undefined)'), | ||
new BuiltInRuntimeType("void", 'new Type("void", undefined, undefined)'), | ||
new BuiltInRuntimeType("undefined", 'new Type("undefined", undefined, undefined)'), | ||
new BuiltInRuntimeType("null", 'new Type("null", undefined, undefined)'), | ||
new BuiltInRuntimeType("obj", 'new Type("obj", undefined, undefined)'), | ||
new BuiltInRuntimeType("array", 'new Type("array", undefined, undefined)'), | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters