@awayfl/avm2
Version:
Virtual machine for executing AS3 code
67 lines (66 loc) • 2.74 kB
JavaScript
import { __extends } from "tslib";
import { Info } from './Info';
var InstanceInfo = /** @class */ (function (_super) {
__extends(InstanceInfo, _super);
function InstanceInfo(abc, multiname, superName, flags, protectedNs, interfaceNames, methodInfo, traits) {
var _this = _super.call(this, traits) || this;
_this.abc = abc;
_this.multiname = multiname;
_this.superName = superName;
_this.flags = flags;
_this.protectedNs = protectedNs;
_this.interfaceNames = interfaceNames;
_this.methodInfo = methodInfo;
_this.traits = traits;
_this.classInfo = null;
_this.runtimeTraits = null;
_this._interfaces = null;
_this.methodInfo.instanceInfo = _this;
_this.methodInfo.isConstructor = true;
return _this;
}
InstanceInfo.prototype.getClassName = function () {
var namespace = this.multiname.namespaces[0];
return namespace.uri ? namespace.uri + '.' + this.multiname.name : this.multiname.name;
};
InstanceInfo.prototype.getInterfaces = function (ownerClass) {
if (this._interfaces) {
return this._interfaces;
}
var superClassInterfaces;
var superClass = ownerClass.superClass;
if (superClass) {
superClassInterfaces = superClass.classInfo.instanceInfo.getInterfaces(superClass);
}
var SetCtor = Set;
var interfaces = this._interfaces = new SetCtor(superClassInterfaces);
for (var i = 0; i < this.interfaceNames.length; i++) {
var mn = this.interfaceNames[i];
var type = this.abc.applicationDomain.getClass(mn);
interfaces.add(type);
var implementedInterfaces = type.classInfo.instanceInfo.getInterfaces(type);
implementedInterfaces.forEach(function (iface) { return interfaces.add(iface); });
}
return interfaces;
};
InstanceInfo.prototype.toString = function () {
return 'InstanceInfo ' + this.multiname.name;
};
InstanceInfo.prototype.trace = function (writer) {
writer.enter('InstanceInfo: ' + this.multiname);
this.superName && writer.writeLn('Super: ' + this.superName);
this.traits.trace(writer);
writer.outdent();
};
InstanceInfo.prototype.isInterface = function () {
return !!(this.flags & 4 /* CONSTANT.ClassInterface */);
};
InstanceInfo.prototype.isSealed = function () {
return !!(this.flags & 1 /* CONSTANT.ClassSealed */);
};
InstanceInfo.prototype.isFinal = function () {
return !!(this.flags & 2 /* CONSTANT.ClassFinal */);
};
return InstanceInfo;
}(Info));
export { InstanceInfo };