Skip to content

Commit c11527f

Browse files
crisbetothePunderWoman
authored andcommitted
refactor(compiler): remove unused code (angular#61668)
Removes the following unused code from the compiler: * The ICU expander appears to be some really old code converting ICUs into legacy-style control flow directives. It's annoying to keep this one since we need to update it any time the AST changes. * The `PipeCollector` class wasn't used anywhere. * The `partitionArray` function wasn't used anywhere. * The `newArray` function was used only in one test and it can be easily replaced with `new Array().fill`. PR Close angular#61668
1 parent ca26b23 commit c11527f

File tree

6 files changed

+7
-480
lines changed

6 files changed

+7
-480
lines changed

packages/compiler/src/ml_parser/icu_ast_expander.ts

Lines changed: 0 additions & 270 deletions
This file was deleted.

packages/compiler/src/template_parser/binding_parser.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import {
2626
ParsedVariable,
2727
ParserError,
2828
PropertyRead,
29-
RecursiveAstVisitor,
3029
TemplateBinding,
3130
ThisReceiver,
3231
VariableBinding,
@@ -838,16 +837,6 @@ export class BindingParser {
838837
}
839838
}
840839

841-
export class PipeCollector extends RecursiveAstVisitor {
842-
pipes = new Map<string, BindingPipe>();
843-
override visitPipe(ast: BindingPipe, context: any): any {
844-
this.pipes.set(ast.name, ast);
845-
ast.exp.visit(this);
846-
this.visitAll(ast.args, context);
847-
return null;
848-
}
849-
}
850-
851840
function isAnimationLabel(name: string): boolean {
852841
return name[0] == '@';
853842
}

packages/compiler/src/util.ts

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -138,36 +138,6 @@ export interface Console {
138138
const _global: {[name: string]: any} = globalThis;
139139
export {_global as global};
140140

141-
export function newArray<T = any>(size: number): T[];
142-
export function newArray<T>(size: number, value: T): T[];
143-
export function newArray<T>(size: number, value?: T): T[] {
144-
const list: T[] = [];
145-
for (let i = 0; i < size; i++) {
146-
list.push(value!);
147-
}
148-
return list;
149-
}
150-
151-
/**
152-
* Partitions a given array into 2 arrays, based on a boolean value returned by the condition
153-
* function.
154-
*
155-
* @param arr Input array that should be partitioned
156-
* @param conditionFn Condition function that is called for each item in a given array and returns a
157-
* boolean value.
158-
*/
159-
export function partitionArray<T, F = T>(
160-
arr: (T | F)[],
161-
conditionFn: (value: T | F) => boolean,
162-
): [T[], F[]] {
163-
const truthy: T[] = [];
164-
const falsy: F[] = [];
165-
for (const item of arr) {
166-
(conditionFn(item) ? truthy : falsy).push(item as any);
167-
}
168-
return [truthy, falsy];
169-
}
170-
171141
const V1_TO_18 = /^([1-9]|1[0-8])\./;
172142

173143
export function getJitStandaloneDefaultForVersion(version: string): boolean {

0 commit comments

Comments
 (0)