refactor(ivy): make bind
an internal-only function (#31131)
The function `bind` has been internalized wherever it was needed, this PR makes sure that it is no longer publicly exported. FW-1385 #resolve PR Close #31131
This commit is contained in:

committed by
Kara Erickson

parent
3fb78aaacc
commit
7ff628f8d5
@ -69,7 +69,6 @@ export {
|
||||
ɵɵtextInterpolateV,
|
||||
ɵɵembeddedViewStart,
|
||||
ɵɵprojection,
|
||||
ɵɵbind,
|
||||
ɵɵinterpolation1,
|
||||
ɵɵinterpolation2,
|
||||
ɵɵinterpolation3,
|
||||
|
@ -7,16 +7,14 @@
|
||||
*/
|
||||
|
||||
import '../util/ng_i18n_closure_mode';
|
||||
|
||||
import {getPluralCase} from '../i18n/localization';
|
||||
import {SRCSET_ATTRS, URI_ATTRS, VALID_ATTRS, VALID_ELEMENTS, getTemplateContent} from '../sanitization/html_sanitizer';
|
||||
import {InertBodyHelper} from '../sanitization/inert_body';
|
||||
import {_sanitizeUrl, sanitizeSrcset} from '../sanitization/url_sanitizer';
|
||||
import {addAllToArray} from '../util/array_utils';
|
||||
import {assertDataInRange, assertDefined, assertEqual, assertGreaterThan} from '../util/assert';
|
||||
|
||||
import {attachPatchData} from './context_discovery';
|
||||
import {setDelayProjection, ɵɵbind, ɵɵload} from './instructions/all';
|
||||
import {bind, setDelayProjection, ɵɵload} from './instructions/all';
|
||||
import {attachI18nOpCodesDebug} from './instructions/lview_debug';
|
||||
import {allocExpando, elementAttributeInternal, elementPropertyInternal, getOrCreateTNode, setInputsForProperty, textBindingInternal} from './instructions/shared';
|
||||
import {LContainer, NATIVE} from './interfaces/container';
|
||||
@ -1018,7 +1016,8 @@ let shiftsCounter = 0;
|
||||
* @codeGenApi
|
||||
*/
|
||||
export function ɵɵi18nExp<T>(value: T): void {
|
||||
const expression = ɵɵbind(value);
|
||||
const lView = getLView();
|
||||
const expression = bind(lView, value);
|
||||
if (expression !== NO_CHANGE) {
|
||||
changeMask = changeMask | (1 << shiftsCounter);
|
||||
}
|
||||
|
@ -35,7 +35,6 @@ export {
|
||||
ɵɵattributeInterpolate8,
|
||||
ɵɵattributeInterpolateV,
|
||||
|
||||
ɵɵbind,
|
||||
ɵɵclassMap,
|
||||
ɵɵclassProp,
|
||||
ɵɵcomponentHostSyntheticListener,
|
||||
|
@ -9,7 +9,7 @@ import {SanitizerFn} from '../interfaces/sanitization';
|
||||
import {getLView, getSelectedIndex} from '../state';
|
||||
import {NO_CHANGE} from '../tokens';
|
||||
|
||||
import {ɵɵbind} from './property';
|
||||
import {bind} from './property';
|
||||
import {elementAttributeInternal} from './shared';
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ export function ɵɵattribute(
|
||||
const index = getSelectedIndex();
|
||||
const lView = getLView();
|
||||
// TODO(FW-1340): Refactor to remove the use of other instructions here.
|
||||
const bound = ɵɵbind(value);
|
||||
const bound = bind(lView, value);
|
||||
if (bound !== NO_CHANGE) {
|
||||
return elementAttributeInternal(index, name, bound, lView, sanitizer, namespace);
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
import {assertNotEqual} from '../../util/assert';
|
||||
import {bindingUpdated} from '../bindings';
|
||||
import {SanitizerFn} from '../interfaces/sanitization';
|
||||
import {BINDING_INDEX} from '../interfaces/view';
|
||||
import {BINDING_INDEX, LView} from '../interfaces/view';
|
||||
import {getLView, getSelectedIndex} from '../state';
|
||||
import {NO_CHANGE} from '../tokens';
|
||||
|
||||
@ -40,7 +40,8 @@ export function ɵɵproperty<T>(
|
||||
nativeOnly?: boolean): TsickleIssue1009 {
|
||||
const index = getSelectedIndex();
|
||||
ngDevMode && assertNotEqual(index, -1, 'selected index cannot be -1');
|
||||
const bindReconciledValue = ɵɵbind(value);
|
||||
const lView = getLView();
|
||||
const bindReconciledValue = bind(lView, value);
|
||||
if (bindReconciledValue !== NO_CHANGE) {
|
||||
elementPropertyInternal(index, propName, bindReconciledValue, sanitizer, nativeOnly);
|
||||
}
|
||||
@ -50,12 +51,10 @@ export function ɵɵproperty<T>(
|
||||
/**
|
||||
* Creates a single value binding.
|
||||
*
|
||||
* @param lView Current view
|
||||
* @param value Value to diff
|
||||
*
|
||||
* @codeGenApi
|
||||
*/
|
||||
export function ɵɵbind<T>(value: T): T|NO_CHANGE {
|
||||
const lView = getLView();
|
||||
export function bind<T>(lView: LView, value: T): T|NO_CHANGE {
|
||||
const bindingIndex = lView[BINDING_INDEX]++;
|
||||
storeBindingMetadata(lView);
|
||||
return bindingUpdated(lView, bindingIndex, value) ? value : NO_CHANGE;
|
||||
@ -87,8 +86,9 @@ export function ɵɵbind<T>(value: T): T|NO_CHANGE {
|
||||
export function ɵɵupdateSyntheticHostBinding<T>(
|
||||
propName: string, value: T | NO_CHANGE, sanitizer?: SanitizerFn | null, nativeOnly?: boolean) {
|
||||
const index = getSelectedIndex();
|
||||
const lView = getLView();
|
||||
// TODO(benlesh): remove bind call here.
|
||||
const bound = ɵɵbind(value);
|
||||
const bound = bind(lView, value);
|
||||
if (bound !== NO_CHANGE) {
|
||||
elementPropertyInternal(index, propName, bound, sanitizer, nativeOnly, loadComponentRenderer);
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ import {NO_CHANGE} from '../tokens';
|
||||
import {renderStringify} from '../util/misc_utils';
|
||||
import {getNativeByIndex} from '../util/view_utils';
|
||||
|
||||
import {ɵɵbind} from './property';
|
||||
import {bind} from './property';
|
||||
import {getOrCreateTNode, textBindingInternal} from './shared';
|
||||
|
||||
|
||||
@ -55,7 +55,7 @@ export function ɵɵtext(index: number, value?: any): void {
|
||||
export function ɵɵtextBinding<T>(value: T | NO_CHANGE): void {
|
||||
const lView = getLView();
|
||||
const index = getSelectedIndex();
|
||||
const bound = ɵɵbind(value);
|
||||
const bound = bind(lView, value);
|
||||
if (bound !== NO_CHANGE) {
|
||||
textBindingInternal(lView, index, renderStringify(bound));
|
||||
}
|
||||
|
@ -46,7 +46,6 @@ export const angularCoreEnv: {[name: string]: Function} =
|
||||
'ɵɵNgOnChangesFeature': r3.ɵɵNgOnChangesFeature,
|
||||
'ɵɵProvidersFeature': r3.ɵɵProvidersFeature,
|
||||
'ɵɵInheritDefinitionFeature': r3.ɵɵInheritDefinitionFeature,
|
||||
'ɵɵbind': r3.ɵɵbind,
|
||||
'ɵɵcontainer': r3.ɵɵcontainer,
|
||||
'ɵɵnextContext': r3.ɵɵnextContext,
|
||||
'ɵɵcontainerRefreshStart': r3.ɵɵcontainerRefreshStart,
|
||||
|
Reference in New Issue
Block a user