diff --git a/src/compiler.ts b/src/compiler.ts index 618d4636e3..9d2c3ca6f7 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -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(element); - break; - } - case ElementKind.ENUM: { - this.compileEnum(element); - break; - } - case ElementKind.FUNCTION_PROTOTYPE: { - if (!element.is(CommonFlags.GENERIC)) { - let functionInstance = this.resolver.resolveFunction(element, null); - if (functionInstance) this.compileFunction(functionInstance); - } - break; - } - case ElementKind.CLASS_PROTOTYPE: { - if (!element.is(CommonFlags.GENERIC)) { - let classInstance = this.resolver.resolveClass(element, null); - if (classInstance) this.compileClass(classInstance); - } - break; - } - case ElementKind.PROPERTY_PROTOTYPE: { - let propertyInstance = this.resolver.resolveProperty(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. */ @@ -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 = (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(element); - break; - } - case ElementKind.FUNCTION_PROTOTYPE: { - if (element.is(CommonFlags.GENERIC)) break; - let functionInstance = this.resolver.resolveFunction(element, null); - if (!functionInstance) break; - element = functionInstance; - // fall-through - } - case ElementKind.FUNCTION: { - this.compileFunction(element); - break; - } - case ElementKind.PROPERTY_PROTOTYPE: { - let propertyInstance = this.resolver.resolveProperty(element); - if (!propertyInstance) break; - element = propertyInstance; - // fall-through - } - case ElementKind.PROPERTY: { - this.compileProperty(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(element, null); - if (!functionInstance) break; - element = functionInstance; - // fall-through - } - case ElementKind.FUNCTION: { - this.compileFunction(element); - break; - } - case ElementKind.FIELD: { - this.compileField(element); - break; - } - case ElementKind.PROPERTY_PROTOTYPE: { - let propertyInstance = this.resolver.resolveProperty(element); - if (!propertyInstance) break; - element = propertyInstance; - // fall-through - } - case ElementKind.PROPERTY: { - this.compileProperty(element); - break; - } - } - } - } - return true; - } - /** Compiles an instance field to a getter and a setter. */ compileField(instance: Field): bool { this.compileFieldGetter(instance);