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 6fbe21941d 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
This commit is contained in:
cexbrayat 2020-11-19 15:19:08 +01:00 committed by Andrew Kushnir
parent 935cf433ed
commit 066126ae2f
5 changed files with 2 additions and 10 deletions

View File

@ -142,8 +142,6 @@ export function getQueryPredicate(
}
}
export function noop() {}
export class DefinitionMap {
values: {key: string, quoted: boolean, value: o.Expression}[] = [];

View File

@ -8,6 +8,7 @@
import {EventEmitter} from '../event_emitter';
import {global} from '../util/global';
import {noop} from '../util/noop';
import {getNativeRequestAnimationFrame} from '../util/raf';
@ -231,7 +232,6 @@ export class NgZone {
}
}
function noop() {}
const EMPTY_PAYLOAD = {};
interface NgZonePrivate extends NgZone {

View File

@ -1397,9 +1397,6 @@
{
"name": "noop"
},
{
"name": "noop"
},
{
"name": "normalizeValidators"
},

View File

@ -1721,9 +1721,6 @@
{
"name": "noop"
},
{
"name": "noop"
},
{
"name": "normalizeQueryParams"
},

View File

@ -18,6 +18,7 @@ import {TConstants, TNodeType} from '@angular/core/src/render3/interfaces/node';
import {RComment, RElement, RNode, RText} from '@angular/core/src/render3/interfaces/renderer_dom';
import {enterView, getLView} from '@angular/core/src/render3/state';
import {EMPTY_ARRAY} from '@angular/core/src/util/empty';
import {noop} from '@angular/core/src/util/noop';
import {stringifyElement} from '@angular/platform-browser/testing/src/browser_util';
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 {
}
}
function noop() {}
/**
* Fixture for testing template functions in a convenient way.
*