Skip to content

Commit ac82d9b

Browse files
JesseCodeBoneschen ruixiang
and
chen ruixiang
authored
Fix: remove dead code for compiler.ts (#2403)
Co-authored-by: chen ruixiang <[email protected]>
1 parent f9de611 commit ac82d9b

File tree

1 file changed

+1
-133
lines changed

1 file changed

+1
-133
lines changed

Diff for: src/compiler.ts

+1-133
Original file line numberDiff line numberDiff line change
@@ -921,58 +921,7 @@ export class Compiler extends DiagnosticEmitter {
921921
element.identifierNode.range
922922
);
923923
}
924-
925-
// === Elements =================================================================================
926-
927-
/** Compiles any element. */
928-
compileElement(element: Element, compileMembers: bool = true): void {
929-
switch (element.kind) {
930-
case ElementKind.GLOBAL: {
931-
this.compileGlobal(<Global>element);
932-
break;
933-
}
934-
case ElementKind.ENUM: {
935-
this.compileEnum(<Enum>element);
936-
break;
937-
}
938-
case ElementKind.FUNCTION_PROTOTYPE: {
939-
if (!element.is(CommonFlags.GENERIC)) {
940-
let functionInstance = this.resolver.resolveFunction(<FunctionPrototype>element, null);
941-
if (functionInstance) this.compileFunction(functionInstance);
942-
}
943-
break;
944-
}
945-
case ElementKind.CLASS_PROTOTYPE: {
946-
if (!element.is(CommonFlags.GENERIC)) {
947-
let classInstance = this.resolver.resolveClass(<ClassPrototype>element, null);
948-
if (classInstance) this.compileClass(classInstance);
949-
}
950-
break;
951-
}
952-
case ElementKind.PROPERTY_PROTOTYPE: {
953-
let propertyInstance = this.resolver.resolveProperty(<PropertyPrototype>element);
954-
if (propertyInstance) this.compileProperty(propertyInstance);
955-
break;
956-
}
957-
case ElementKind.INTERFACE_PROTOTYPE:
958-
case ElementKind.NAMESPACE:
959-
case ElementKind.TYPEDEFINITION:
960-
case ElementKind.ENUMVALUE:
961-
case ElementKind.INDEXSIGNATURE: break;
962-
default: assert(false);
963-
}
964-
if (compileMembers) {
965-
let members = element.members;
966-
if (members) {
967-
// TODO: for (let element of members.values()) {
968-
for (let _values = Map_values(members), i = 0, k = _values.length; i < k; ++i) {
969-
let element = unchecked(_values[i]);
970-
this.compileElement(element);
971-
}
972-
}
973-
}
974-
}
975-
924+
976925
// files
977926

978927
/** Compiles the file matching the specified path. */
@@ -1631,87 +1580,6 @@ export class Compiler extends DiagnosticEmitter {
16311580
return true;
16321581
}
16331582

1634-
// === Classes ==================================================================================
1635-
1636-
/** Compiles a priorly resolved class. */
1637-
compileClass(instance: Class): bool {
1638-
if (instance.is(CommonFlags.COMPILED)) return true;
1639-
instance.set(CommonFlags.COMPILED);
1640-
var prototype = instance.prototype;
1641-
var staticMembers = (<ClassPrototype>prototype).members;
1642-
if (staticMembers) {
1643-
// TODO: for (let element of staticMembers.values()) {
1644-
for (let _values = Map_values(staticMembers), i = 0, k = _values.length; i < k; ++i) {
1645-
let element = unchecked(_values[i]);
1646-
switch (element.kind) {
1647-
case ElementKind.GLOBAL: {
1648-
this.compileGlobal(<Global>element);
1649-
break;
1650-
}
1651-
case ElementKind.FUNCTION_PROTOTYPE: {
1652-
if (element.is(CommonFlags.GENERIC)) break;
1653-
let functionInstance = this.resolver.resolveFunction(<FunctionPrototype>element, null);
1654-
if (!functionInstance) break;
1655-
element = functionInstance;
1656-
// fall-through
1657-
}
1658-
case ElementKind.FUNCTION: {
1659-
this.compileFunction(<Function>element);
1660-
break;
1661-
}
1662-
case ElementKind.PROPERTY_PROTOTYPE: {
1663-
let propertyInstance = this.resolver.resolveProperty(<PropertyPrototype>element);
1664-
if (!propertyInstance) break;
1665-
element = propertyInstance;
1666-
// fall-through
1667-
}
1668-
case ElementKind.PROPERTY: {
1669-
this.compileProperty(<Property>element);
1670-
break;
1671-
}
1672-
}
1673-
}
1674-
}
1675-
this.ensureConstructor(instance, instance.identifierNode);
1676-
this.checkFieldInitialization(instance);
1677-
1678-
var instanceMembers = instance.members;
1679-
if (instanceMembers) {
1680-
// TODO: for (let element of instanceMembers.values()) {
1681-
for (let _values = Map_values(instanceMembers), i = 0, k = _values.length; i < k; ++i) {
1682-
let element = unchecked(_values[i]);
1683-
switch (element.kind) {
1684-
case ElementKind.FUNCTION_PROTOTYPE: {
1685-
if (element.is(CommonFlags.GENERIC)) break;
1686-
let functionInstance = this.resolver.resolveFunction(<FunctionPrototype>element, null);
1687-
if (!functionInstance) break;
1688-
element = functionInstance;
1689-
// fall-through
1690-
}
1691-
case ElementKind.FUNCTION: {
1692-
this.compileFunction(<Function>element);
1693-
break;
1694-
}
1695-
case ElementKind.FIELD: {
1696-
this.compileField(<Field>element);
1697-
break;
1698-
}
1699-
case ElementKind.PROPERTY_PROTOTYPE: {
1700-
let propertyInstance = this.resolver.resolveProperty(<PropertyPrototype>element);
1701-
if (!propertyInstance) break;
1702-
element = propertyInstance;
1703-
// fall-through
1704-
}
1705-
case ElementKind.PROPERTY: {
1706-
this.compileProperty(<Property>element);
1707-
break;
1708-
}
1709-
}
1710-
}
1711-
}
1712-
return true;
1713-
}
1714-
17151583
/** Compiles an instance field to a getter and a setter. */
17161584
compileField(instance: Field): bool {
17171585
this.compileFieldGetter(instance);

0 commit comments

Comments
 (0)