refactor(ivy): move get functions next to their underlying variable (#22268)
PR Close #22268
This commit is contained in:
parent
31c5c1060a
commit
d40263447d
|
@ -50,9 +50,19 @@ export const NG_HOST_SYMBOL = '__ngHostLNode__';
|
|||
let renderer: Renderer3;
|
||||
let rendererFactory: RendererFactory3;
|
||||
|
||||
export function getRenderer(): Renderer3 {
|
||||
// top level variables should not be exported for performance reason (PERF_NOTES.md)
|
||||
return renderer;
|
||||
}
|
||||
|
||||
/** Used to set the parent property when nodes are created. */
|
||||
let previousOrParentNode: LNode;
|
||||
|
||||
export function getPreviousOrParentNode(): LNode {
|
||||
// top level variables should not be exported for performance reason (PERF_NOTES.md)
|
||||
return previousOrParentNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* If `isParent` is:
|
||||
* - `true`: then `previousOrParentNode` points to a parent node.
|
||||
|
@ -82,11 +92,21 @@ let currentView: LView = null !;
|
|||
|
||||
let currentQueries: LQueries|null;
|
||||
|
||||
export function getCurrentQueries(QueryType: {new (): LQueries}): LQueries {
|
||||
// top level variables should not be exported for performance reason (PERF_NOTES.md)
|
||||
return currentQueries || (currentQueries = new QueryType());
|
||||
}
|
||||
|
||||
/**
|
||||
* This property gets set before entering a template.
|
||||
*/
|
||||
let creationMode: boolean;
|
||||
|
||||
export function getCreationMode(): boolean {
|
||||
// top level variables should not be exported for performance reason (PERF_NOTES.md)
|
||||
return creationMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* An array of nodes (text, element, container, etc), their bindings, and
|
||||
* any local variables that need to be stored between invocations.
|
||||
|
@ -1752,14 +1772,6 @@ export function load<T>(index: number): T {
|
|||
return data[index];
|
||||
}
|
||||
|
||||
export function getCurrentQueries(QueryType: {new (): LQueries}): LQueries {
|
||||
return currentQueries || (currentQueries = new QueryType());
|
||||
}
|
||||
|
||||
export function getCreationMode(): boolean {
|
||||
return creationMode;
|
||||
}
|
||||
|
||||
/** Gets the current binding value and increments the binding index. */
|
||||
export function consumeBinding(): any {
|
||||
ngDevMode && assertDataInRange(bindingIndex);
|
||||
|
@ -1800,14 +1812,6 @@ export function bindingUpdated4(exp1: any, exp2: any, exp3: any, exp4: any): boo
|
|||
return bindingUpdated2(exp3, exp4) || different;
|
||||
}
|
||||
|
||||
export function getPreviousOrParentNode(): LNode {
|
||||
return previousOrParentNode;
|
||||
}
|
||||
|
||||
export function getRenderer(): Renderer3 {
|
||||
return renderer;
|
||||
}
|
||||
|
||||
export function getDirectiveInstance<T>(instanceOrArray: T | [T]): T {
|
||||
// Directives with content queries store an array in data[directiveIndex]
|
||||
// with the instance as the first index
|
||||
|
|
Loading…
Reference in New Issue