mirror of
https://github.com/cincheo/jsweet.git
synced 2025-12-15 15:29:22 +00:00
fixed #239
This commit is contained in:
parent
7cb8e6f043
commit
daadbc1b5a
@ -1466,16 +1466,16 @@ public class Java2TypeScriptTranslator extends AbstractTreePrinter {
|
||||
if (!globals) {
|
||||
endIndent().printIndent().print("}");
|
||||
if (getContext().options.isSupportGetClass() && !getScope().interfaceScope && !getScope().declareClassScope
|
||||
&& !getScope().enumScope && !classdecl.sym.isAnonymous()) {
|
||||
println().printIndent().print(classdecl.sym.getSimpleName().toString())
|
||||
.print("[\"" + CLASS_NAME_IN_CONSTRUCTOR + "\"] = ")
|
||||
.print("\"" + context.getRootRelativeName(null, classdecl.sym) + "\";");
|
||||
|
||||
&& !getScope().enumScope) {
|
||||
if (!classdecl.sym.isAnonymous()) {
|
||||
println().printIndent().print(classdecl.sym.getSimpleName().toString())
|
||||
.print("[\"" + CLASS_NAME_IN_CONSTRUCTOR + "\"] = ")
|
||||
.print("\"" + context.getRootRelativeName(null, classdecl.sym) + "\";");
|
||||
}
|
||||
Set<String> interfaces = new HashSet<>();
|
||||
context.grabSupportedInterfaceNames(interfaces, classdecl.sym);
|
||||
if (!interfaces.isEmpty()) {
|
||||
println().printIndent().print(classdecl.sym.getSimpleName().toString())
|
||||
.print("[\"" + INTERFACES_FIELD_NAME + "\"] = ");
|
||||
println().printIndent().print(name).print("[\"" + INTERFACES_FIELD_NAME + "\"] = ");
|
||||
print("[");
|
||||
for (String itf : interfaces) {
|
||||
print("\"").print(itf).print("\",");
|
||||
|
||||
@ -43,11 +43,20 @@ public class InstanceOf {
|
||||
}
|
||||
};
|
||||
Interface3 i3 = new Interface3() {
|
||||
{
|
||||
@Override
|
||||
public String m1() {
|
||||
return "m1";
|
||||
}
|
||||
};
|
||||
Interface4 i4 = new Interface4() {
|
||||
{
|
||||
@Override
|
||||
public String m1() {
|
||||
return "m12";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String m2() {
|
||||
return "m2";
|
||||
}
|
||||
};
|
||||
|
||||
@ -73,7 +82,10 @@ public class InstanceOf {
|
||||
assert i1 instanceof Interface1;
|
||||
assert i2 instanceof Interface2;
|
||||
assert i3 instanceof Interface3;
|
||||
assert i3.m1().equals("m1");
|
||||
assert i4 instanceof Interface4;
|
||||
assert i4.m1().equals("m12");
|
||||
assert i4.m2().equals("m2");
|
||||
}
|
||||
|
||||
}
|
||||
@ -95,7 +107,9 @@ abstract class Interface2 extends Interface1 {
|
||||
}
|
||||
|
||||
interface Interface3 {
|
||||
String m1();
|
||||
}
|
||||
|
||||
interface Interface4 extends Interface3 {
|
||||
String m2();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user