diff --git a/packages/core/src/render3/instructions.ts b/packages/core/src/render3/instructions.ts index 5d75f292ea..5e0769251f 100644 --- a/packages/core/src/render3/instructions.ts +++ b/packages/core/src/render3/instructions.ts @@ -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(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(instanceOrArray: T | [T]): T { // Directives with content queries store an array in data[directiveIndex] // with the instance as the first index