diff --git a/compiler/types/AnyType.ts b/compiler/types/AnyType.ts index e59db9b3..521d6d0f 100644 --- a/compiler/types/AnyType.ts +++ b/compiler/types/AnyType.ts @@ -1,12 +1,13 @@ import { Type } from "./Type" export class AnyType implements Type { + static instance = new AnyType() kind = "any" constructor() {} toConstructor() { - return "new AnyType()" + return "AnyType.instance" } toString() { diff --git a/compiler/types/BooleanType.ts b/compiler/types/BooleanType.ts index f30f0e6e..759a3358 100644 --- a/compiler/types/BooleanType.ts +++ b/compiler/types/BooleanType.ts @@ -1,12 +1,13 @@ import { Type } from "./Type" export class BooleanType implements Type { + static instance = new BooleanType() kind = "boolean" constructor() {} toConstructor() { - return "new BooleanType()" + return "BooleanType.instance" } toString() { diff --git a/compiler/types/NumberType.ts b/compiler/types/NumberType.ts index be0363a8..db2b5200 100644 --- a/compiler/types/NumberType.ts +++ b/compiler/types/NumberType.ts @@ -1,12 +1,13 @@ import { Type } from "./Type" export class NumberType implements Type { + static instance = new NumberType() kind = "number" constructor() {} toConstructor() { - return "new NumberType()" + return "NumberType.instance" } toString() { diff --git a/compiler/types/StringType.ts b/compiler/types/StringType.ts index 21c5624e..57fe8c83 100644 --- a/compiler/types/StringType.ts +++ b/compiler/types/StringType.ts @@ -1,12 +1,13 @@ import { Type } from "./Type" export class StringType implements Type { + static instance = new StringType() kind = "string" constructor() {} toConstructor() { - return "new StringType()" + return "StringType.instance" } toString() { diff --git a/compiler/types/VoidType.ts b/compiler/types/VoidType.ts index 82ebb089..4d110a4f 100644 --- a/compiler/types/VoidType.ts +++ b/compiler/types/VoidType.ts @@ -1,12 +1,13 @@ import { Type } from "./Type" export class VoidType implements Type { + static instance = new VoidType() kind = "void" constructor() {} toConstructor() { - return "new VoidType()" + return "VoidType.instance" } toString() {