refactor(ivy): Update @publicApi to @codeGenApi on ivy instructions (#29820)

- Removes `@publicApi` annotation from ivy instructions
- Adds new `@codeGenApi` annotation to ivy instructions
- Updates ts_api_guardian to support the new annotation properly

PR Close #29820
This commit is contained in:
Ben Lesh
2019-04-10 13:45:26 -07:00
committed by Igor Minar
parent def73a6728
commit ddadb8e22c
32 changed files with 142 additions and 127 deletions

View File

@ -17,7 +17,7 @@ import {NO_CHANGE} from '../tokens';
*
* @param count Amount of vars to be allocated
*
* @publicApi
* @codeGenApi
*/
export function ΔallocHostVars(count: number): void {
const lView = getLView();

View File

@ -28,7 +28,7 @@ import {addToViewTree, createDirectivesAndLocals, createLContainer, createNodeAt
*
* @param index The index of the container in the data array
*
* @publicApi
* @codeGenApi
*/
export function Δcontainer(index: number): void {
const tNode = containerInternal(index, null, null);
@ -57,7 +57,7 @@ export function Δcontainer(index: number): void {
* @param localRefExtractor A function which extracts local-refs values from the template.
* Defaults to the current element associated with the local-ref.
*
* @publicApi
* @codeGenApi
*/
export function Δtemplate(
index: number, templateFn: ComponentTemplate<any>| null, consts: number, vars: number,
@ -85,7 +85,7 @@ export function Δtemplate(
*
* @param index The index of the container in the data array
*
* @publicApi
* @codeGenApi
*/
export function ΔcontainerRefreshStart(index: number): void {
const lView = getLView();
@ -108,7 +108,7 @@ export function ΔcontainerRefreshStart(index: number): void {
*
* Marking the end of LContainer is the time when to child views get inserted or removed.
*
* @publicApi
* @codeGenApi
*/
export function ΔcontainerRefreshEnd(): void {
let previousOrParentTNode = getPreviousOrParentTNode();

View File

@ -33,7 +33,7 @@ import {getLView, getPreviousOrParentTNode} from '../state';
* @param flags Injection flags
* @returns the value from the injector or `null` when not found
*
* @publicApi
* @codeGenApi
*/
export function ΔdirectiveInject<T>(token: Type<T>| InjectionToken<T>): T;
export function ΔdirectiveInject<T>(token: Type<T>| InjectionToken<T>, flags: InjectFlags): T;
@ -48,7 +48,7 @@ export function ΔdirectiveInject<T>(
/**
* Facade for the attribute injection from DI.
*
* @publicApi
* @codeGenApi
*/
export function ΔinjectAttribute(attrNameToInject: string): string|null {
return injectAttributeImpl(getPreviousOrParentTNode(), attrNameToInject);

View File

@ -42,7 +42,7 @@ import {getActiveDirectiveStylingIndex} from './styling';
* hold an attribute name and elements with an odd index hold an attribute value, ex.:
* ['id', 'warning5', 'class', 'alert']
*
* @publicApi
* @codeGenApi
*/
export function ΔelementStart(
index: number, name: string, attrs?: TAttributes | null, localRefs?: string[] | null): void {
@ -127,7 +127,7 @@ export function ΔelementStart(
/**
* Mark the end of the element.
*
* @publicApi
* @codeGenApi
*/
export function ΔelementEnd(): void {
let previousOrParentTNode = getPreviousOrParentTNode();
@ -179,7 +179,7 @@ export function ΔelementEnd(): void {
* element on creation. Use [AttributeMarker] to denote the meaning of this array.
* @param localRefs A set of local reference bindings on the element.
*
* @publicApi
* @codeGenApi
*/
export function Δelement(
index: number, name: string, attrs?: TAttributes | null, localRefs?: string[] | null): void {
@ -198,7 +198,7 @@ export function Δelement(
* @param sanitizer An optional function used to sanitize the value.
* @param namespace Optional namespace to use when setting the attribute.
*
* @publicApi
* @codeGenApi
*/
export function ΔelementAttribute(
index: number, name: string, value: any, sanitizer?: SanitizerFn | null,
@ -266,7 +266,7 @@ export function ΔelementAttribute(
* @param attrs An array of static values (attributes, classes and styles) with the correct marker
* values.
*
* @publicApi
* @codeGenApi
*/
export function ΔelementHostAttrs(attrs: TAttributes) {
const hostElementIndex = getSelectedIndex();

View File

@ -29,7 +29,7 @@ import {createDirectivesAndLocals, createNodeAtIndex, executeContentQueries, set
* the DOM (as a comment node can't have attributes). Attributes are here only for directive
* matching purposes and setting initial inputs of directives.
*
* @publicApi
* @codeGenApi
*/
export function ΔelementContainerStart(
index: number, attrs?: TAttributes | null, localRefs?: string[] | null): void {
@ -70,7 +70,7 @@ export function ΔelementContainerStart(
/**
* Mark the end of the <ng-container>.
*
* @publicApi
* @codeGenApi
*/
export function ΔelementContainerEnd(): void {
let previousOrParentTNode = getPreviousOrParentTNode();

View File

@ -23,8 +23,8 @@ import {assignTViewNodeToLView, createLView, createTView, refreshDescendantViews
*
* @param viewBlockId The ID of this view
* @return boolean Whether or not this view is in creation mode
*
* @publicApi
*
* @codeGenApi
*/
export function ΔembeddedViewStart(viewBlockId: number, consts: number, vars: number): RenderFlags {
const lView = getLView();
@ -127,7 +127,7 @@ function scanForView(lContainer: LContainer, startIdx: number, viewBlockId: numb
/**
* Marks the end of an embedded view.
*
* @publicApi
* @codeGenApi
*/
export function ΔembeddedViewEnd(): void {
const lView = getLView();

View File

@ -15,7 +15,7 @@ import {getLView} from '../state';
* of the current view and restore it when listeners are invoked. This allows
* walking the declaration view tree in listeners to get vars from parent views.
*
* @publicApi
* @codeGenApi
*/
export function ΔgetCurrentView(): OpaqueViewState {
return getLView() as any as OpaqueViewState;

View File

@ -29,7 +29,7 @@ import {BindingDirection, generatePropertyAliases, getCleanup, handleError, load
* @param eventTargetResolver Function that returns global target information in case this listener
* should be attached to a global object like window, document or body
*
* @publicApi
* @codeGenApi
*/
export function Δlistener(
eventName: string, listenerFn: (e?: any) => any, useCapture = false,
@ -56,7 +56,7 @@ export function Δlistener(
* @param eventTargetResolver Function that returns global target information in case this listener
* should be attached to a global object like window, document or body
*
* @publicApi
* @codeGenApi
*/
export function ΔcomponentHostSyntheticListener<T>(
eventName: string, listenerFn: (e?: any) => any, useCapture = false,

View File

@ -17,7 +17,7 @@ import {nextContextImpl} from '../state';
* @param level The relative level of the view from which to grab context compared to contextVewData
* @returns context
*
* @publicApi
* @codeGenApi
*/
export function ΔnextContext<T = any>(level: number = 1): T {
return nextContextImpl(level);

View File

@ -37,7 +37,7 @@ import {createNodeAtIndex} from './shared';
* @param selectors A collection of parsed CSS selectors
* @param rawSelectors A collection of CSS selectors in the raw, un-parsed form
*
* @publicApi
* @codeGenApi
*/
export function ΔprojectionDef(selectors?: CssSelectorList[]): void {
const componentNode = findComponentView(getLView())[T_HOST] as TElementNode;
@ -76,7 +76,7 @@ export function ΔprojectionDef(selectors?: CssSelectorList[]): void {
* - 0 when the selector is `*` (or unspecified as this is the default value),
* - 1 based index of the selector from the {@link projectionDef}
*
* @publicApi
* @codeGenApi
*/
export function Δprojection(
nodeIndex: number, selectorIndex: number = 0, attrs?: TAttributes): void {

View File

@ -32,7 +32,7 @@ import {TsickleIssue1009, elementPropertyInternal, loadComponentRenderer, storeB
* @returns This function returns itself so that it may be chained
* (e.g. `property('name', ctx.name)('title', ctx.title)`)
*
* @publicApi
* @codeGenApi
*/
export function Δproperty<T>(
propName: string, value: T, sanitizer?: SanitizerFn | null,
@ -48,7 +48,7 @@ export function Δproperty<T>(
*
* @param value Value to diff
*
* @publicApi
* @codeGenApi
*/
export function Δbind<T>(value: T): T|NO_CHANGE {
const lView = getLView();
@ -73,7 +73,7 @@ export function Δbind<T>(value: T): T|NO_CHANGE {
* @param nativeOnly Whether or not we should only set native properties and skip input check
* (this is necessary for host property bindings)
*
* @publicApi
* @codeGenApi
*/
export function ΔelementProperty<T>(
index: number, propName: string, value: T | NO_CHANGE, sanitizer?: SanitizerFn | null,
@ -102,7 +102,7 @@ export function ΔelementProperty<T>(
* @param nativeOnly Whether or not we should only set native properties and skip input check
* (this is necessary for host property bindings)
*
* @publicApi
* @codeGenApi
*/
export function ΔcomponentHostSyntheticProperty<T>(
index: number, propName: string, value: T | NO_CHANGE, sanitizer?: SanitizerFn | null,

View File

@ -27,7 +27,7 @@ import {TsickleIssue1009, elementPropertyInternal, storeBindingMetadata} from '.
*
* Returns the concatenated string when any of the arguments changes, `NO_CHANGE` otherwise.
*
* @publicApi
* @codeGenApi
*/
export function ΔinterpolationV(values: any[]): string|NO_CHANGE {
ngDevMode && assertLessThan(2, values.length, 'should have at least 3 values');
@ -72,7 +72,7 @@ export function ΔinterpolationV(values: any[]): string|NO_CHANGE {
* @param v0 value checked for change.
* @param suffix static value used for concatenation only.
*
* @publicApi
* @codeGenApi
*/
export function Δinterpolation1(prefix: string, v0: any, suffix: string): string|NO_CHANGE {
const lView = getLView();
@ -84,7 +84,7 @@ export function Δinterpolation1(prefix: string, v0: any, suffix: string): strin
/**
* Creates an interpolation binding with 2 expressions.
*
* @publicApi
* @codeGenApi
*/
export function Δinterpolation2(
prefix: string, v0: any, i0: string, v1: any, suffix: string): string|NO_CHANGE {
@ -105,7 +105,7 @@ export function Δinterpolation2(
/**
* Creates an interpolation binding with 3 expressions.
*
* @publicApi
* @codeGenApi
*/
export function Δinterpolation3(
prefix: string, v0: any, i0: string, v1: any, i1: string, v2: any, suffix: string): string|
@ -131,7 +131,7 @@ export function Δinterpolation3(
/**
* Create an interpolation binding with 4 expressions.
*
* @publicApi
* @codeGenApi
*/
export function Δinterpolation4(
prefix: string, v0: any, i0: string, v1: any, i1: string, v2: any, i2: string, v3: any,
@ -159,7 +159,7 @@ export function Δinterpolation4(
/**
* Creates an interpolation binding with 5 expressions.
*
* @publicApi
* @codeGenApi
*/
export function Δinterpolation5(
prefix: string, v0: any, i0: string, v1: any, i1: string, v2: any, i2: string, v3: any,
@ -189,7 +189,7 @@ export function Δinterpolation5(
/**
* Creates an interpolation binding with 6 expressions.
*
* @publicApi
* @codeGenApi
*/
export function Δinterpolation6(
prefix: string, v0: any, i0: string, v1: any, i1: string, v2: any, i2: string, v3: any,
@ -220,7 +220,7 @@ export function Δinterpolation6(
/**
* Creates an interpolation binding with 7 expressions.
*
* @publicApi
* @codeGenApi
*/
export function Δinterpolation7(
prefix: string, v0: any, i0: string, v1: any, i1: string, v2: any, i2: string, v3: any,
@ -254,7 +254,7 @@ export function Δinterpolation7(
/**
* Creates an interpolation binding with 8 expressions.
*
* @publicApi
* @codeGenApi
*/
export function Δinterpolation8(
prefix: string, v0: any, i0: string, v1: any, i1: string, v2: any, i2: string, v3: any,

View File

@ -29,7 +29,7 @@ import {getCheckNoChangesMode, getLView, setSelectedIndex} from '../state';
* ```
* @param index the index of the item to act on with the following instructions
*
* @publicApi
* @codeGenApi
*/
export function Δselect(index: number): void {
ngDevMode && assertGreaterThan(index, -1, 'Invalid index');

View File

@ -31,7 +31,7 @@ export function store<T>(index: number, value: T): void {
*
* @param index The index of the local ref in contextViewData.
*
* @publicApi
* @codeGenApi
*/
export function Δreference<T>(index: number) {
const contextLView = getContextLView();
@ -41,7 +41,7 @@ export function Δreference<T>(index: number) {
/**
* Retrieves a value from current `viewData`.
*
* @publicApi
* @codeGenApi
*/
export function Δload<T>(index: number): T {
return loadInternal<T>(getLView(), index);

View File

@ -62,7 +62,7 @@ import {scheduleTick, setInputsForProperty} from './shared';
* @param styleSanitizer An optional sanitizer function that will be used to sanitize any CSS
* style values that are applied to the element (during rendering).
*
* @publicApi
* @codeGenApi
*/
export function ΔelementStyling(
classBindingNames?: string[] | null, styleBindingNames?: string[] | null,
@ -104,7 +104,7 @@ export function ΔelementStyling(
* will not be used if the same property is assigned in another directive or
* on the element directly.
*
* @publicApi
* @codeGenApi
*/
export function ΔelementHostStyling(
classBindingNames?: string[] | null, styleBindingNames?: string[] | null,
@ -164,7 +164,7 @@ function initElementStyling(
* @param forceOverride Whether or not to update the styling value immediately
* (despite the other bindings possibly having priority)
*
* @publicApi
* @codeGenApi
*/
export function ΔelementStyleProp(
index: number, styleIndex: number, value: string | number | String | PlayerFactory | null,
@ -198,7 +198,7 @@ export function ΔelementStyleProp(
* @param forceOverride Whether or not to update the styling value immediately
* (despite the other bindings possibly having priority)
*
* @publicApi
* @codeGenApi
*/
export function ΔelementHostStyleProp(
styleIndex: number, value: string | number | String | PlayerFactory | null,
@ -251,7 +251,7 @@ function resolveStylePropValue(
* @param forceOverride Whether or not this value will be applied regardless
* of where it is being set within the styling priority structure.
*
* @publicApi
* @codeGenApi
*/
export function ΔelementClassProp(
index: number, classIndex: number, value: boolean | PlayerFactory,
@ -281,7 +281,7 @@ export function ΔelementClassProp(
* @param forceOverride Whether or not this value will be applied regardless
* of where it is being set within the stylings priority structure.
*
* @publicApi
* @codeGenApi
*/
export function ΔelementHostClassProp(
classIndex: number, value: boolean | PlayerFactory, forceOverride?: boolean): void {
@ -324,7 +324,7 @@ function booleanOrNull(value: any): boolean|null {
* Any missing styles (that have already been applied to the element beforehand) will be
* removed (unset) from the element's styling.
*
* @publicApi
* @codeGenApi
*/
export function ΔelementStylingMap(
index: number, classes: {[key: string]: any} | string | NO_CHANGE | null,
@ -377,7 +377,7 @@ export function ΔelementStylingMap(
* Any missing styles (that have already been applied to the element beforehand) will be
* removed (unset) from the element's styling.
*
* @publicApi
* @codeGenApi
*/
export function ΔelementHostStylingMap(
classes: {[key: string]: any} | string | NO_CHANGE | null,
@ -403,7 +403,7 @@ export function ΔelementHostStylingMap(
*
* @param index Index of the element's with which styling is associated.
*
* @publicApi
* @codeGenApi
*/
export function ΔelementStylingApply(index: number): void {
elementStylingApplyInternal(DEFAULT_TEMPLATE_DIRECTIVE_INDEX, index);
@ -417,7 +417,7 @@ export function ΔelementStylingApply(index: number): void {
* been run and will only apply styling to the host element if any
* styling bindings have been updated.
*
* @publicApi
* @codeGenApi
*/
export function ΔelementHostStylingApply(): void {
elementStylingApplyInternal(getActiveDirectiveStylingIndex(), getSelectedIndex());

View File

@ -22,7 +22,7 @@ import {createNodeAtIndex} from './shared';
* @param index Index of the node in the data array
* @param value Value to write. This value will be stringified.
*
* @publicApi
* @codeGenApi
*/
export function Δtext(index: number, value?: any): void {
const lView = getLView();
@ -45,7 +45,7 @@ export function Δtext(index: number, value?: any): void {
* @param index Index of the node in the data array.
* @param value Stringified value to write.
*
* @publicApi
* @codeGenApi
*/
export function ΔtextBinding<T>(index: number, value: T | NO_CHANGE): void {
if (value !== NO_CHANGE) {