зеркало из https://github.com/mozilla/pluotsorbet.git
Don't try to call static constructors if there aren't any.
This commit is contained in:
Родитель
c63990a0fe
Коммит
bd748126d7
24
context.ts
24
context.ts
|
@ -472,10 +472,32 @@ module J2ME {
|
||||||
}
|
}
|
||||||
|
|
||||||
pushClassInitFrame(classInfo: ClassInfo) {
|
pushClassInitFrame(classInfo: ClassInfo) {
|
||||||
if (this.runtime.initialized[classInfo.className]) {
|
if (this.runtime.initialized[classInfo.className] ||
|
||||||
|
this.runtime.pending[classInfo.className]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
var needsInitialization = true;
|
||||||
|
if (!classInfo.staticInitializer) {
|
||||||
|
needsInitialization = false;
|
||||||
|
// Special case Isolate.
|
||||||
|
if (classInfo.className === "com/sun/cldc/isolate/Isolate") {
|
||||||
|
needsInitialization = true;
|
||||||
|
}
|
||||||
|
var superClass = classInfo.superClass;
|
||||||
|
while (superClass) {
|
||||||
|
if (!this.runtime.initialized[superClass.className] &&
|
||||||
|
superClass.staticInitializer) {
|
||||||
|
needsInitialization = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
superClass = superClass.superClass;
|
||||||
|
}
|
||||||
|
}
|
||||||
linkKlass(classInfo);
|
linkKlass(classInfo);
|
||||||
|
if (!needsInitialization) {
|
||||||
|
this.runtime.initialized[classInfo.className] = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
var classInitFrame = this.getClassInitFrame(classInfo);
|
var classInitFrame = this.getClassInitFrame(classInfo);
|
||||||
this.executeFrames([classInitFrame]);
|
this.executeFrames([classInitFrame]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1691,7 +1691,7 @@ module J2ME {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function classInitCheck(classInfo: ClassInfo, pc: number) {
|
export function classInitCheck(classInfo: ClassInfo, pc: number) {
|
||||||
if (classInfo.isArrayClass || $.initialized[classInfo.className]) {
|
if (classInfo.isArrayClass) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$.ctx.pushClassInitFrame(classInfo);
|
$.ctx.pushClassInitFrame(classInfo);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче