Merge pull request #1187 from glacambre/singleton_types

Metadata Types: Use a single type instance where it makes sense
This commit is contained in:
Oliver Blanthorn 2018-11-21 13:06:56 +00:00 committed by GitHub
commit 2a520a3b2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 5 deletions

View file

@ -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() {

View file

@ -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() {

View file

@ -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() {

View file

@ -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() {

View file

@ -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() {