Skip to content

Commit 663d477

Browse files
mmaterowskithePunderWoman
authored andcommitted
refactor(core): remove duplicated code in change_detection_util (angular#45599)
Removes duplicated code in change_detection_util and reorganizes imports to use utils module. PR Close angular#45599
1 parent 820077d commit 663d477

11 files changed

+12
-75
lines changed

packages/core/src/change_detection/change_detection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {IterableDifferFactory, IterableDiffers} from './differs/iterable_differs
1212
import {KeyValueDifferFactory, KeyValueDiffers} from './differs/keyvalue_differs';
1313

1414
export {SimpleChange, SimpleChanges} from '../interface/simple_change';
15-
export {devModeEqual} from './change_detection_util';
15+
export {devModeEqual} from '../util/comparison';
1616
export {ChangeDetectorRef} from './change_detector_ref';
1717
export {ChangeDetectionStrategy, ChangeDetectorStatus, isDefaultChangeDetectionStrategy} from './constants';
1818
export {DefaultIterableDiffer, DefaultIterableDifferFactory} from './differs/default_iterable_differ';

packages/core/src/change_detection/change_detection_util.ts

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

packages/core/src/change_detection/differs/default_iterable_differ.ts

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

99
import {RuntimeError, RuntimeErrorCode} from '../../errors';
10+
import {isListLikeIterable, iterateListLike} from '../../util/iterable';
1011
import {stringify} from '../../util/stringify';
11-
import {isListLikeIterable, iterateListLike} from '../change_detection_util';
1212

1313
import {IterableChangeRecord, IterableChanges, IterableDiffer, IterableDifferFactory, NgIterable, TrackByFunction} from './iterable_differs';
1414

packages/core/src/change_detection/differs/default_keyvalue_differ.ts

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

99
import {RuntimeError, RuntimeErrorCode} from '../../errors';
10+
import {isJsObject} from '../../util/iterable';
1011
import {stringify} from '../../util/stringify';
11-
import {isJsObject} from '../change_detection_util';
1212

1313
import {KeyValueChangeRecord, KeyValueChanges, KeyValueDiffer, KeyValueDifferFactory} from './keyvalue_differs';
1414

packages/core/src/core_private_export.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
export {ALLOW_MULTIPLE_PLATFORMS as ɵALLOW_MULTIPLE_PLATFORMS} from './application_ref';
1010
export {APP_ID_RANDOM_PROVIDER as ɵAPP_ID_RANDOM_PROVIDER} from './application_tokens';
1111
export {defaultIterableDiffers as ɵdefaultIterableDiffers, defaultKeyValueDiffers as ɵdefaultKeyValueDiffers} from './change_detection/change_detection';
12-
export {devModeEqual as ɵdevModeEqual, isListLikeIterable as ɵisListLikeIterable} from './change_detection/change_detection_util';
1312
export {ChangeDetectorStatus as ɵChangeDetectorStatus, isDefaultChangeDetectionStrategy as ɵisDefaultChangeDetectionStrategy} from './change_detection/constants';
1413
export {Console as ɵConsole} from './console';
1514
export {getDebugNodeR2 as ɵgetDebugNodeR2} from './debug/debug_node';
@@ -26,8 +25,10 @@ export {allowSanitizationBypassAndThrow as ɵallowSanitizationBypassAndThrow, By
2625
export {_sanitizeHtml as ɵ_sanitizeHtml} from './sanitization/html_sanitizer';
2726
export {_sanitizeUrl as ɵ_sanitizeUrl} from './sanitization/url_sanitizer';
2827
export {coerceToBoolean as ɵcoerceToBoolean} from './util/coercion';
28+
export {devModeEqual as ɵdevModeEqual} from './util/comparison';
2929
export {makeDecorator as ɵmakeDecorator} from './util/decorators';
3030
export {global as ɵglobal} from './util/global';
31+
export {isListLikeIterable as ɵisListLikeIterable} from './util/iterable';
3132
export {isObservable as ɵisObservable, isPromise as ɵisPromise, isSubscribable as ɵisSubscribable} from './util/lang';
3233
export {stringify as ɵstringify} from './util/stringify';
3334
export {NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR as ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR} from './view/provider_flags';

packages/core/src/render3/bindings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {devModeEqual} from '../change_detection/change_detection_util';
109
import {assertIndexInRange, assertLessThan, assertNotSame} from '../util/assert';
10+
import {devModeEqual} from '../util/comparison';
1111

1212
import {getExpressionChangedErrorDetails, throwErrorIfNoChangesMode} from './errors';
1313
import {LView} from './interfaces/view';

packages/core/test/change_detection/differs/default_iterable_differ_spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
import {DefaultIterableDiffer, DefaultIterableDifferFactory} from '@angular/core/src/change_detection/differs/default_iterable_differ';
1010

11-
import {TestIterable} from '../../change_detection/iterable';
12-
import {iterableChangesAsString, iterableDifferToString} from '../../change_detection/util';
11+
import {TestIterable} from '../../util/iterable';
12+
import {iterableChangesAsString, iterableDifferToString} from '../util';
1313

1414
class ItemWithId {
1515
constructor(private id: string) {}

packages/core/test/change_detection/differs/default_keyvalue_differ_spec.ts

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

99
import {DefaultKeyValueDiffer, DefaultKeyValueDifferFactory} from '@angular/core/src/change_detection/differs/default_keyvalue_differ';
1010

11-
import {kvChangesAsString, testChangesAsString} from '../../change_detection/util';
11+
import {kvChangesAsString, testChangesAsString} from '../util';
1212

1313

1414
// TODO(vicb): Update the code & tests for object equality

packages/core/test/linker/query_list_spec.ts

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

99
import {ɵgetDOM as getDOM} from '@angular/common';
10-
import {iterateListLike} from '@angular/core/src/change_detection/change_detection_util';
1110
import {QueryList} from '@angular/core/src/linker/query_list';
11+
import {iterateListLike} from '@angular/core/src/util/iterable';
1212
import {fakeAsync, tick} from '@angular/core/testing';
1313

1414
{

packages/core/test/change_detection/change_detector_util_spec.ts renamed to packages/core/test/util/comparison.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {devModeEqual} from '@angular/core/src/change_detection/change_detection_util';
9+
import {devModeEqual} from '@angular/core/src/util/comparison';
1010

1111
{
12-
describe('ChangeDetectionUtil', () => {
12+
describe('Comparison util', () => {
1313
describe('devModeEqual', () => {
1414
it('should do the deep comparison of iterables', () => {
1515
expect(devModeEqual([['one']], [['one']])).toBe(true);

0 commit comments

Comments
 (0)