Skip to content

Remove dead code for compiler.ts #2403

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 1 addition & 133 deletions src/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -921,58 +921,7 @@ export class Compiler extends DiagnosticEmitter {
element.identifierNode.range
);
}

// === Elements =================================================================================

/** Compiles any element. */
compileElement(element: Element, compileMembers: bool = true): void {
switch (element.kind) {
case ElementKind.GLOBAL: {
this.compileGlobal(<Global>element);
break;
}
case ElementKind.ENUM: {
this.compileEnum(<Enum>element);
break;
}
case ElementKind.FUNCTION_PROTOTYPE: {
if (!element.is(CommonFlags.GENERIC)) {
let functionInstance = this.resolver.resolveFunction(<FunctionPrototype>element, null);
if (functionInstance) this.compileFunction(functionInstance);
}
break;
}
case ElementKind.CLASS_PROTOTYPE: {
if (!element.is(CommonFlags.GENERIC)) {
let classInstance = this.resolver.resolveClass(<ClassPrototype>element, null);
if (classInstance) this.compileClass(classInstance);
}
break;
}
case ElementKind.PROPERTY_PROTOTYPE: {
let propertyInstance = this.resolver.resolveProperty(<PropertyPrototype>element);
if (propertyInstance) this.compileProperty(propertyInstance);
break;
}
case ElementKind.INTERFACE_PROTOTYPE:
case ElementKind.NAMESPACE:
case ElementKind.TYPEDEFINITION:
case ElementKind.ENUMVALUE:
case ElementKind.INDEXSIGNATURE: break;
default: assert(false);
}
if (compileMembers) {
let members = element.members;
if (members) {
// TODO: for (let element of members.values()) {
for (let _values = Map_values(members), i = 0, k = _values.length; i < k; ++i) {
let element = unchecked(_values[i]);
this.compileElement(element);
}
}
}
}


// files

/** Compiles the file matching the specified path. */
Expand Down Expand Up @@ -1631,87 +1580,6 @@ export class Compiler extends DiagnosticEmitter {
return true;
}

// === Classes ==================================================================================

/** Compiles a priorly resolved class. */
compileClass(instance: Class): bool {
if (instance.is(CommonFlags.COMPILED)) return true;
instance.set(CommonFlags.COMPILED);
var prototype = instance.prototype;
var staticMembers = (<ClassPrototype>prototype).members;
if (staticMembers) {
// TODO: for (let element of staticMembers.values()) {
for (let _values = Map_values(staticMembers), i = 0, k = _values.length; i < k; ++i) {
let element = unchecked(_values[i]);
switch (element.kind) {
case ElementKind.GLOBAL: {
this.compileGlobal(<Global>element);
break;
}
case ElementKind.FUNCTION_PROTOTYPE: {
if (element.is(CommonFlags.GENERIC)) break;
let functionInstance = this.resolver.resolveFunction(<FunctionPrototype>element, null);
if (!functionInstance) break;
element = functionInstance;
// fall-through
}
case ElementKind.FUNCTION: {
this.compileFunction(<Function>element);
break;
}
case ElementKind.PROPERTY_PROTOTYPE: {
let propertyInstance = this.resolver.resolveProperty(<PropertyPrototype>element);
if (!propertyInstance) break;
element = propertyInstance;
// fall-through
}
case ElementKind.PROPERTY: {
this.compileProperty(<Property>element);
break;
}
}
}
}
this.ensureConstructor(instance, instance.identifierNode);
this.checkFieldInitialization(instance);

var instanceMembers = instance.members;
if (instanceMembers) {
// TODO: for (let element of instanceMembers.values()) {
for (let _values = Map_values(instanceMembers), i = 0, k = _values.length; i < k; ++i) {
let element = unchecked(_values[i]);
switch (element.kind) {
case ElementKind.FUNCTION_PROTOTYPE: {
if (element.is(CommonFlags.GENERIC)) break;
let functionInstance = this.resolver.resolveFunction(<FunctionPrototype>element, null);
if (!functionInstance) break;
element = functionInstance;
// fall-through
}
case ElementKind.FUNCTION: {
this.compileFunction(<Function>element);
break;
}
case ElementKind.FIELD: {
this.compileField(<Field>element);
break;
}
case ElementKind.PROPERTY_PROTOTYPE: {
let propertyInstance = this.resolver.resolveProperty(<PropertyPrototype>element);
if (!propertyInstance) break;
element = propertyInstance;
// fall-through
}
case ElementKind.PROPERTY: {
this.compileProperty(<Property>element);
break;
}
}
}
}
return true;
}

/** Compiles an instance field to a getter and a setter. */
compileField(instance: Field): bool {
this.compileFieldGetter(instance);
Expand Down