Small fixes (#706)
* Small fixes * Debug-print name of rewrite even if it's a nop
This commit is contained in:
Родитель
dd8242d111
Коммит
5eadc280eb
10
src/Type.ts
10
src/Type.ts
|
@ -472,7 +472,7 @@ export abstract class SetOperationType extends Type {
|
|||
super(typeRef, kind);
|
||||
}
|
||||
|
||||
setMembers(memberRefs: OrderedSet<TypeRef>) {
|
||||
setMembers(memberRefs: OrderedSet<TypeRef>): void {
|
||||
if (this._memberRefs !== undefined) {
|
||||
return panic("Can only set map members once");
|
||||
}
|
||||
|
@ -533,6 +533,14 @@ export class UnionType extends SetOperationType {
|
|||
|
||||
constructor(typeRef: TypeRef, memberRefs?: OrderedSet<TypeRef>) {
|
||||
super(typeRef, "union", memberRefs);
|
||||
if (memberRefs !== undefined) {
|
||||
assert(!memberRefs.isEmpty(), "We can't have empty unions");
|
||||
}
|
||||
}
|
||||
|
||||
setMembers(memberRefs: OrderedSet<TypeRef>): void {
|
||||
assert(!memberRefs.isEmpty(), "We can't have empty unions");
|
||||
super.setMembers(memberRefs);
|
||||
}
|
||||
|
||||
get stringTypeMembers(): OrderedSet<Type> {
|
||||
|
|
|
@ -234,6 +234,10 @@ export class TypeGraph {
|
|||
replacer: (typesToReplace: Set<T>, builder: GraphRewriteBuilder<T>, forwardingRef: TypeRef) => TypeRef,
|
||||
force: boolean = false
|
||||
): TypeGraph {
|
||||
if (this._printOnRewrite) {
|
||||
console.log(`\n# ${title}`);
|
||||
}
|
||||
|
||||
if (!force && replacementGroups.length === 0) return this;
|
||||
|
||||
const builder = new GraphRewriteBuilder(
|
||||
|
@ -258,7 +262,6 @@ export class TypeGraph {
|
|||
|
||||
if (this._printOnRewrite) {
|
||||
newGraph.setPrintOnRewrite();
|
||||
console.log(`\n# ${title}`);
|
||||
newGraph.printGraph();
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче