Skip to content

Commit 83b27ba

Browse files
mheveryIgorMinar
authored andcommitted
style: fix formatting errors (#20855)
PR Close #20855
1 parent b462f49 commit 83b27ba

File tree

8 files changed

+59
-37
lines changed

8 files changed

+59
-37
lines changed

packages/core/src/render3/component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
*/
88

99
import {ComponentRef, EmbeddedViewRef, Injector} from '../core';
10+
1011
import {assertNotNull} from './assert';
1112
import {NG_HOST_SYMBOL, createError, createViewState, directiveCreate, elementHost, enterView, leaveView} from './instructions';
1213
import {LElement} from './l_node';
1314
import {ComponentDef, ComponentType} from './public_interfaces';
1415
import {RElement, Renderer3, RendererFactory3} from './renderer';
15-
import {stringify, notImplemented} from './util';
16+
import {notImplemented, stringify} from './util';
1617

1718

1819

packages/core/src/render3/di.ts

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@
99
// We are temporarily importing the existing viewEngine from core so we can be sure we are
1010
// correctly implementing its interfaces for backwards compatibility.
1111
import * as viewEngine from '../core';
12+
1213
import {BLOOM_SIZE, NG_ELEMENT_ID, getOrCreateNodeInjector} from './instructions';
1314
import {LContainer, LNodeFlags, LNodeInjector} from './l_node';
1415
import {ComponentTemplate, DirectiveDef} from './public_interfaces';
15-
import {stringify, notImplemented} from './util';
16+
import {notImplemented, stringify} from './util';
17+
1618

1719
/** Injection flags for DI. */
1820
export const enum InjectFlags {
19-
/** Dependency is not required. Null will be injected if there is no provider for the dependency. */
21+
/** Dependency is not required. Null will be injected if there is no provider for the dependency.
22+
*/
2023
Optional = 1 << 0,
2124
/** When resolving a dependency, include the node that is requesting injection. */
2225
CheckSelf = 1 << 1,
@@ -86,7 +89,9 @@ export function inject<T>(token: viewEngine.Type<T>, flags?: InjectFlags): T {
8689

8790
// If no injector is found, we *know* that there is no ancestor injector that contains the
8891
// token, so we abort.
89-
if (!injector) { break; }
92+
if (!injector) {
93+
break;
94+
}
9095

9196
// At this point, we have an injector which *may* contain the token, so we step through the
9297
// directives associated with the injector's corresponding node to get the directive instance.
@@ -160,8 +165,8 @@ function bloomHashBit(type: viewEngine.Type<any>): number|null {
160165
* @param bloomBit The bit to check in each injector's bloom filter
161166
* @returns An injector that might have the directive
162167
*/
163-
export function bloomFindPossibleInjector(startInjector: LNodeInjector, bloomBit: number): LNodeInjector|
164-
null {
168+
export function bloomFindPossibleInjector(
169+
startInjector: LNodeInjector, bloomBit: number): LNodeInjector|null {
165170
// Create a mask that targets the specific bit associated with the directive we're looking for.
166171
// This will be a number between 0 and 31, corresponding to a bit position in a 32 bit integer.
167172
const mask = 1 << bloomBit;
@@ -173,8 +178,8 @@ export function bloomFindPossibleInjector(startInjector: LNodeInjector, bloomBit
173178
// Our bloom filter size is 128 bits, which is four 32-bit bloom filter buckets:
174179
// bf0 = [0 - 31], bf1 = [32 - 63], bf2 = [64 - 95], bf3 = [96 - 127]
175180
// Get the bloom filter value from the appropriate bucket based on the directive's bloomBit.
176-
let value: number =
177-
bloomBit < 64 ? (bloomBit < 32 ? injector.bf0 : injector.bf1) : (bloomBit < 96 ? injector.bf2 : injector.bf3);
181+
let value: number = bloomBit < 64 ? (bloomBit < 32 ? injector.bf0 : injector.bf1) :
182+
(bloomBit < 96 ? injector.bf2 : injector.bf3);
178183

179184
// If the bloom filter value has the bit corresponding to the directive's bloomBit flipped on,
180185
// this injector is a potential match.
@@ -184,8 +189,8 @@ export function bloomFindPossibleInjector(startInjector: LNodeInjector, bloomBit
184189

185190
// If the current injector does not have the directive, check the bloom filters for the ancestor
186191
// injectors (cbf0 - cbf3). These filters capture *all* ancestor injectors.
187-
value =
188-
bloomBit < 64 ? (bloomBit < 32 ? injector.cbf0 : injector.cbf1) : (bloomBit < 96 ? injector.cbf2 : injector.cbf3);
192+
value = bloomBit < 64 ? (bloomBit < 32 ? injector.cbf0 : injector.cbf1) :
193+
(bloomBit < 96 ? injector.cbf2 : injector.cbf3);
189194

190195
// If the ancestor bloom filter value has the bit corresponding to the directive, traverse up to
191196
// find the specific injector. If the ancestor bloom filter does not have the bit, we can abort.
@@ -264,8 +269,8 @@ class ViewContainerRef implements viewEngine.ViewContainerRef {
264269
get(index: number): viewEngine.ViewRef|null { throw notImplemented(); }
265270
length: number;
266271
createEmbeddedView<C>(
267-
templateRef: viewEngine.TemplateRef<C>, context?: C|undefined,
268-
index?: number|undefined): viewEngine.EmbeddedViewRef<C> {
272+
templateRef: viewEngine.TemplateRef<C>, context?: C|undefined,
273+
index?: number|undefined): viewEngine.EmbeddedViewRef<C> {
269274
throw notImplemented();
270275
}
271276
createComponent<C>(
@@ -274,8 +279,12 @@ class ViewContainerRef implements viewEngine.ViewContainerRef {
274279
ngModule?: viewEngine.NgModuleRef<any>|undefined): viewEngine.ComponentRef<C> {
275280
throw notImplemented();
276281
}
277-
insert(viewRef: viewEngine.ViewRef, index?: number|undefined): viewEngine.ViewRef { throw notImplemented(); }
278-
move(viewRef: viewEngine.ViewRef, currentIndex: number): viewEngine.ViewRef { throw notImplemented(); }
282+
insert(viewRef: viewEngine.ViewRef, index?: number|undefined): viewEngine.ViewRef {
283+
throw notImplemented();
284+
}
285+
move(viewRef: viewEngine.ViewRef, currentIndex: number): viewEngine.ViewRef {
286+
throw notImplemented();
287+
}
279288
indexOf(viewRef: viewEngine.ViewRef): number { throw notImplemented(); }
280289
remove(index?: number|undefined): void { throw notImplemented(); }
281290
detach(index?: number|undefined): viewEngine.ViewRef|null { throw notImplemented(); }

packages/core/src/render3/instructions.ts

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@
99
import './ng_dev_mode';
1010

1111
import {Type} from '../core';
12+
1213
import {assertEqual, assertLessThan, assertNotEqual, assertNotNull} from './assert';
13-
import {CssSelector, ContainerState, ProjectionState, QueryState, ViewState} from './interfaces';
14-
import {LText, LView, LElement, LNode, LNodeFlags, LNodeInjector, LContainer, LProjection} from './l_node';
14+
import {ContainerState, CssSelector, ProjectionState, QueryState, ViewState} from './interfaces';
15+
import {LContainer, LElement, LNode, LNodeFlags, LNodeInjector, LProjection, LText, LView} from './l_node';
16+
1517
import {NgStaticData, LNodeStatic, LContainerStatic, InitialInputData, InitialInputs, PropertyAliases, PropertyAliasValue,} from './l_node_static';
1618
import {assertNodeType} from './node_assert';
1719
import {appendChild, insertChild, insertView, processProjectedNode, removeView} from './node_manipulation';
@@ -129,7 +131,8 @@ export function enterView(newViewState: ViewState, host: LElement | LView | null
129131

130132
export const leaveView: (newViewState: ViewState) => void = enterView as any;
131133

132-
export function createViewState(viewId: number, renderer: Renderer3, ngStaticData: NgStaticData): ViewState {
134+
export function createViewState(
135+
viewId: number, renderer: Renderer3, ngStaticData: NgStaticData): ViewState {
133136
const newView = {
134137
parent: currentView,
135138
id: viewId, // -1 for component views
@@ -336,7 +339,7 @@ export function elementCreate(
336339
} else {
337340
native = renderer.createElement(name);
338341

339-
let componentView: ViewState | null = null;
342+
let componentView: ViewState|null = null;
340343
if (isHostElement) {
341344
const ngStaticData = getTemplateStatic((nameOrComponentDef as ComponentDef<any>).template);
342345
componentView = addToViewTree(createViewState(-1, renderer, ngStaticData));
@@ -402,7 +405,8 @@ export function elementHost(elementOrSelector: RElement | string, def: Component
402405
throw createError('Host node is required:', elementOrSelector);
403406
}
404407
}
405-
createLNode(0, LNodeFlags.Element, rNode, createViewState(-1, renderer, getTemplateStatic(def.template)));
408+
createLNode(
409+
0, LNodeFlags.Element, rNode, createViewState(-1, renderer, getTemplateStatic(def.template)));
406410
}
407411

408412

@@ -454,8 +458,7 @@ export function listenerCreate(
454458
function outputCreate(outputs: (number | string)[], listener: Function): void {
455459
for (let i = 0; i < outputs.length; i += 2) {
456460
ngDevMode && assertDataInRange(outputs[i] as number);
457-
const subscription =
458-
data[outputs[i] as number][outputs[i | 1]].subscribe(listener);
461+
const subscription = data[outputs[i] as number][outputs[i | 1]].subscribe(listener);
459462
cleanup !.push(subscription.unsubscribe, subscription);
460463
}
461464
}
@@ -570,7 +573,8 @@ function setInputsForProperty(inputs: (number | string)[], value: any): void {
570573
*
571574
* @param index Index where data should be stored in ngStaticData
572575
*/
573-
function generatePropertyAliases(flags: number, data: LNodeStatic, isInputData = false): LNodeStatic {
576+
function generatePropertyAliases(
577+
flags: number, data: LNodeStatic, isInputData = false): LNodeStatic {
574578
const start = flags >> LNodeFlags.INDX_SHIFT;
575579
const size = (flags & LNodeFlags.SIZE_MASK) >> LNodeFlags.SIZE_SHIFT;
576580

@@ -582,7 +586,7 @@ function generatePropertyAliases(flags: number, data: LNodeStatic, isInputData =
582586
if (propertyAliasMap.hasOwnProperty(publicName)) {
583587
const internalName = propertyAliasMap[publicName];
584588
const staticDirData: PropertyAliases = isInputData ? (data.inputs || (data.inputs = {})) :
585-
(data.outputs || (data.outputs = {}));
589+
(data.outputs || (data.outputs = {}));
586590
const hasProperty: boolean = staticDirData.hasOwnProperty(publicName);
587591
hasProperty ? staticDirData[publicName].push(i, internalName) :
588592
(staticDirData[publicName] = [i, internalName]);
@@ -938,8 +942,8 @@ export function viewCreate(viewBlockId: number): boolean {
938942
const containerState = container.data;
939943
const views = containerState.views;
940944

941-
const existingView: LView|false = !creationMode && containerState.nextIndex < views.length &&
942-
views[containerState.nextIndex];
945+
const existingView: LView|false =
946+
!creationMode && containerState.nextIndex < views.length && views[containerState.nextIndex];
943947
let viewUpdateMode = existingView && viewBlockId === (existingView as LView).data.id;
944948

945949
if (viewUpdateMode) {
@@ -949,7 +953,8 @@ export function viewCreate(viewBlockId: number): boolean {
949953
enterView((existingView as LView).data, previousOrParentNode as LView);
950954
} else {
951955
// When we create a new View, we always reset the state of the instructions.
952-
const newViewState = createViewState(viewBlockId, renderer, initViewStaticData(viewBlockId, container));
956+
const newViewState =
957+
createViewState(viewBlockId, renderer, initViewStaticData(viewBlockId, container));
953958
enterView(newViewState, createLNode(null, LNodeFlags.View, null, newViewState));
954959
containerState.nextIndex++;
955960
}
@@ -1571,7 +1576,7 @@ function valueInData<T>(data: any[], index: number, value?: T): T {
15711576
// We don't store any static data for local variables, so the first time
15721577
// we see the template, we should store as null to avoid a sparse array
15731578
if (index >= ngStaticData.length) {
1574-
ngStaticData[index] = null;
1579+
ngStaticData[index] = null;
15751580
}
15761581
data[index] = value;
15771582
}
@@ -1600,4 +1605,3 @@ function assertDataInRange(index: number, arr?: any[]) {
16001605
if (arr == null) arr = data;
16011606
assertLessThan(arr ? arr.length : 0, index, 'data.length');
16021607
}
1603-

packages/core/src/render3/interfaces.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
*/
88

99
import {QueryList, Type} from '../core';
10+
11+
import {LContainer, LElement, LNode, LText, LView} from './l_node';
12+
import {LNodeStatic} from './l_node_static';
1013
import {ComponentTemplate, DirectiveDef} from './public_interfaces';
1114
import {Renderer3} from './renderer';
12-
import {LNode, LView, LElement, LContainer, LText} from './l_node';
13-
import {LNodeStatic} from './l_node_static';
1415

1516
declare global {
1617
const ngDevMode: boolean;

packages/core/src/render3/l_node.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
*/
88

99
import {ElementRef, Injector, TemplateRef, ViewContainerRef} from '../core';
10-
import {RComment, RElement, RText} from './renderer';
11-
import {ViewState, ContainerState, ProjectionState, QueryState} from './interfaces';
10+
11+
import {ContainerState, ProjectionState, QueryState, ViewState} from './interfaces';
1212
import {LNodeStatic} from './l_node_static';
13+
import {RComment, RElement, RText} from './renderer';
14+
1315

1416
/**
1517
* LNodeFlags corresponds to the LNode.flags property. It contains information

packages/core/src/render3/l_node_static.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import {DirectiveDef} from './public_interfaces';
1010

1111
/** The type of the global ngStaticData array. */
12-
export type NgStaticData = (LNodeStatic | DirectiveDef<any> | null)[];
12+
export type NgStaticData = (LNodeStatic | DirectiveDef<any>| null)[];
1313

1414
/**
1515
* LNode binding data (flywiehgt) for a particular node that is shared between all templates

packages/core/src/render3/query.ts

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

9-
import * as viewEngine from '../core';
9+
import {DirectiveDef} from '@angular/core/src/render3/public_interfaces';
1010
import {Observable} from 'rxjs/Observable';
11+
12+
import * as viewEngine from '../core';
13+
1114
import {assertNotNull} from './assert';
1215
import {QueryState} from './interfaces';
13-
import {DirectiveDef} from '@angular/core/src/render3/public_interfaces';
1416
import {LContainer, LNode, LNodeFlags, LView} from './l_node';
1517

1618

@@ -60,7 +62,9 @@ export class QueryState_ implements QueryState {
6062

6163
constructor(deep?: QueryPredicate<any>) { this.deep = deep == null ? null : deep; }
6264

63-
track<T>(queryList: viewEngine.QueryList<T>, predicate: viewEngine.Type<T>|any[], descend?: boolean): void {
65+
track<T>(
66+
queryList: viewEngine.QueryList<T>, predicate: viewEngine.Type<T>|any[],
67+
descend?: boolean): void {
6468
// TODO(misko): This is not right. In case of inherited state, a calling track will incorrectly
6569
// mutate parent.
6670
if (descend) {

packages/core/test/render3/render_util.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ export function resetDOM() {
3737
requestAnimationFrame.queue = [];
3838
containerEl = document.createElement('div');
3939
containerEl.setAttribute('host', '');
40-
host = createLNode(null, LNodeFlags.Element, containerEl, createViewState(-1, activeRenderer, null !));
40+
host = createLNode(
41+
null, LNodeFlags.Element, containerEl, createViewState(-1, activeRenderer, null !));
4142
// TODO: assert that the global state is clean (e.g. ngData, previousOrParentNode, etc)
4243
}
4344

0 commit comments

Comments
 (0)