Skip to content

Commit ded5288

Browse files
committed
Fix failing tests
1 parent acd35ca commit ded5288

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Core/src/main/java/prompto/declaration/ConcreteCategoryDeclaration.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,9 +1148,10 @@ private void transpileConstructor(Transpiler transpiler) {
11481148
transpiler.append("this.$mutable = mutable;").newLine();
11491149
transpiler.append("return this;").dedent().append("}").newLine();
11501150
List<Identifier> parents = (derivedFrom!=null && derivedFrom.size()>0) ? derivedFrom : Collections.singletonList(new Identifier("$Root"));
1151+
transpiler.append(getName()).append(".prototype = Object.create(").append(parents.get(0).toString()).append(".prototype);").newLine();
11511152
parents = parents.subList(0, parents.size());
1152-
Collections.reverse(parents);
1153-
transpiler.append(getName()).append(".prototype = Object.assign({}");
1153+
Collections.reverse(parents); // fulfill MRO
1154+
transpiler.append(getName()).append(".prototype = Object.assign(").append(getName()).append(".prototype");
11541155
parents.forEach(p -> transpiler.append(", ").append(p.toString()).append(".prototype"));
11551156
transpiler.append(");").newLine();
11561157
transpiler.append(getName()).append(".prototype.constructor = ").append(getName()).append(";").newLine();

0 commit comments

Comments
 (0)