Skip to content

Commit 26a1337

Browse files
cexbrayatAndrewKushnir
authored andcommitted
fix(core): remove duplicated noop function (#39761)
The codebase currently contains several `noop` functions, and they can end up in the bundle of an application. A recent commit 6fbe219 tipped us off as it introduced several `noop` occurrences in the golden symbol files. After investigating with @petebacondarwin, we decided to remove the duplicated functions. This probably shaves only a few bytes, but this commit removes the duplicated functions, by always using the one in `core/src/utils/noop`. PR Close #39761
1 parent 33639db commit 26a1337

File tree

5 files changed

+2
-10
lines changed

5 files changed

+2
-10
lines changed

packages/compiler/src/render3/view/util.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,6 @@ export function getQueryPredicate(
142142
}
143143
}
144144

145-
export function noop() {}
146-
147145
export class DefinitionMap {
148146
values: {key: string, quoted: boolean, value: o.Expression}[] = [];
149147

packages/core/src/zone/ng_zone.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import {EventEmitter} from '../event_emitter';
1010
import {global} from '../util/global';
11+
import {noop} from '../util/noop';
1112
import {getNativeRequestAnimationFrame} from '../util/raf';
1213

1314

@@ -224,7 +225,6 @@ export class NgZone {
224225
}
225226
}
226227

227-
function noop() {}
228228
const EMPTY_PAYLOAD = {};
229229

230230
interface NgZonePrivate extends NgZone {

packages/core/test/bundling/forms/bundle.golden_symbols.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,9 +1397,6 @@
13971397
{
13981398
"name": "noop"
13991399
},
1400-
{
1401-
"name": "noop"
1402-
},
14031400
{
14041401
"name": "normalizeValidators"
14051402
},

packages/core/test/bundling/router/bundle.golden_symbols.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1721,9 +1721,6 @@
17211721
{
17221722
"name": "noop"
17231723
},
1724-
{
1725-
"name": "noop"
1726-
},
17271724
{
17281725
"name": "normalizeQueryParams"
17291726
},

packages/core/test/render3/render_util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {TConstants, TNodeType} from '@angular/core/src/render3/interfaces/node';
1818
import {RComment, RElement, RNode, RText} from '@angular/core/src/render3/interfaces/renderer_dom';
1919
import {enterView, getLView} from '@angular/core/src/render3/state';
2020
import {EMPTY_ARRAY} from '@angular/core/src/util/empty';
21+
import {noop} from '@angular/core/src/util/noop';
2122
import {stringifyElement} from '@angular/platform-browser/testing/src/browser_util';
2223

2324
import {SWITCH_CHANGE_DETECTOR_REF_FACTORY__POST_R3__ as R3_CHANGE_DETECTOR_REF_FACTORY} from '../../src/change_detection/change_detector_ref';
@@ -85,7 +86,6 @@ export abstract class BaseFixture {
8586
}
8687
}
8788

88-
function noop() {}
8989
/**
9090
* Fixture for testing template functions in a convenient way.
9191
*

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy