First check object type for subclass (#870)

This commit is contained in:
jberg 2019-08-19 10:20:51 -07:00 committed by Jordan Eldredge
parent 0297eb726a
commit 19b3132ade

View file

@ -155,15 +155,7 @@ function readVariables({ makiFile, classes }) {
const global = makiFile.readUInt8();
makiFile.readUInt8(); // system
if (object) {
const klass = classes[typeOffset];
if (klass == null) {
throw new Error("Invalid type");
}
variables.push(
new Variable({ type: klass, typeName: "OBJECT", global: !!global })
);
} else if (subClass) {
if (subClass) {
const variable = variables[typeOffset];
if (variable == null) {
throw new Error("Invalid type");
@ -171,6 +163,14 @@ function readVariables({ makiFile, classes }) {
variables.push(
new Variable({ type: variable, typeName: "SUBCLASS", global: !!global })
);
} else if (object) {
const klass = classes[typeOffset];
if (klass == null) {
throw new Error("Invalid type");
}
variables.push(
new Variable({ type: klass, typeName: "OBJECT", global: !!global })
);
} else {
const typeName = PRIMITIVE_TYPES[typeOffset];
if (typeName == null) {