style: fix formatting errors (#20855)

PR Close #20855
This commit is contained in:
Miško Hevery 2017-12-14 15:03:46 -08:00 committed by Igor Minar
parent 09e3839994
commit 1f5049f30c
15 changed files with 47 additions and 43 deletions

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
import {C, E, T, V, s, b, c, defineComponent, detectChanges, e, rC, rc, t, v} from '@angular/core/src/render3/index'; import {C, E, T, V, b, c, defineComponent, detectChanges, e, rC, rc, s, t, v} from '@angular/core/src/render3/index';
import {ComponentDef} from '@angular/core/src/render3/public_interfaces'; import {ComponentDef} from '@angular/core/src/render3/public_interfaces';
import {TableCell, buildTable, emptyTable} from '../util'; import {TableCell, buildTable, emptyTable} from '../util';

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
import {C, D, E, T, V, s, b, b1, c, defineComponent, detectChanges as _detectChanges, e, p, rC, rc, t, v} from '@angular/core/src/render3/index'; import {C, D, E, T, V, b, b1, c, defineComponent, detectChanges as _detectChanges, e, p, rC, rc, s, t, v} from '@angular/core/src/render3/index';
import {ComponentDef} from '@angular/core/src/render3/public_interfaces'; import {ComponentDef} from '@angular/core/src/render3/public_interfaces';
import {TreeNode, buildTree, emptyTree} from '../util'; import {TreeNode, buildTree, emptyTree} from '../util';

View File

@ -63,7 +63,8 @@ let nextNgElementId = 0;
* - ObjectedOrientedRenderer3 * - ObjectedOrientedRenderer3
* *
* This is the native browser API style, e.g. operations are methods on individual objects * This is the native browser API style, e.g. operations are methods on individual objects
* like HTMLElement. With this style, no additional code is needed as a facade (reducing payload size). * like HTMLElement. With this style, no additional code is needed as a facade (reducing payload
* size).
* *
* - ProceduralRenderer3 * - ProceduralRenderer3
* *
@ -437,8 +438,9 @@ function setUpAttributes(native: RElement, attrs: string[]): void {
ngDevMode && assertEqual(attrs.length % 2, 0, 'attrs.length % 2'); ngDevMode && assertEqual(attrs.length % 2, 0, 'attrs.length % 2');
const isProceduralRenderer = (renderer as ProceduralRenderer3).setAttribute; const isProceduralRenderer = (renderer as ProceduralRenderer3).setAttribute;
for (let i = 0; i < attrs.length; i += 2) { for (let i = 0; i < attrs.length; i += 2) {
isProceduralRenderer ? (renderer as ProceduralRenderer3).setAttribute !(native, attrs[i], attrs[i | 1]) : isProceduralRenderer ?
native.setAttribute(attrs[i], attrs[i | 1]); (renderer as ProceduralRenderer3).setAttribute !(native, attrs[i], attrs[i | 1]) :
native.setAttribute(attrs[i], attrs[i | 1]);
} }
} }
@ -481,8 +483,7 @@ export function elementHost(elementOrSelector: RElement | string, def: Component
* @param listener The function to be called when event emits * @param listener The function to be called when event emits
* @param useCapture Whether or not to use capture in event listener. * @param useCapture Whether or not to use capture in event listener.
*/ */
export function listener( export function listener(eventName: string, listener: EventListener, useCapture = false): void {
eventName: string, listener: EventListener, useCapture = false): void {
ngDevMode && assertPreviousIsParent(); ngDevMode && assertPreviousIsParent();
const node = previousOrParentNode; const node = previousOrParentNode;
const native = node.native as RElement; const native = node.native as RElement;
@ -789,8 +790,7 @@ export function textBinding<T>(index: number, value: T | NO_CHANGE): void {
*/ */
export function directive<T>(index: number): T; export function directive<T>(index: number): T;
export function directive<T>(index: number, directive: T, directiveDef: DirectiveDef<T>): T; export function directive<T>(index: number, directive: T, directiveDef: DirectiveDef<T>): T;
export function directive<T>( export function directive<T>(index: number, directive?: T, directiveDef?: DirectiveDef<T>): T {
index: number, directive?: T, directiveDef?: DirectiveDef<T>): T {
let instance; let instance;
if (directive == null) { if (directive == null) {
// return existing // return existing
@ -920,11 +920,9 @@ export function diPublic(def: DirectiveDef<any>): void {
* @param self * @param self
* @param method * @param method
*/ */
export function lifecycle( export function lifecycle(lifeCycle: LifecycleHook.ON_DESTROY, self: any, method: Function): void;
lifeCycle: LifecycleHook.ON_DESTROY, self: any, method: Function): void;
export function lifecycle(lifeCycle: LifecycleHook): boolean; export function lifecycle(lifeCycle: LifecycleHook): boolean;
export function lifecycle( export function lifecycle(lifeCycle: LifecycleHook, self?: any, method?: Function): boolean {
lifeCycle: LifecycleHook, self?: any, method?: Function): boolean {
if (lifeCycle === LifecycleHook.ON_INIT) { if (lifeCycle === LifecycleHook.ON_INIT) {
return creationMode; return creationMode;
} else if (lifeCycle === LifecycleHook.ON_DESTROY) { } else if (lifeCycle === LifecycleHook.ON_DESTROY) {
@ -1195,8 +1193,7 @@ export function projectionDef(selectors?: CssSelector[]): LNode[][] {
* @param {number} localIndex - index under which distribution of projected nodes was memorized * @param {number} localIndex - index under which distribution of projected nodes was memorized
* @param {number} selectorIndex - 0 means <ng-content> without any selector * @param {number} selectorIndex - 0 means <ng-content> without any selector
*/ */
export function projection( export function projection(nodeIndex: number, localIndex: number, selectorIndex: number = 0): void {
nodeIndex: number, localIndex: number, selectorIndex: number = 0): void {
const projectedNodes: ProjectionState = []; const projectedNodes: ProjectionState = [];
const node = createLNode(nodeIndex, LNodeFlags.Projection, null, projectedNodes); const node = createLNode(nodeIndex, LNodeFlags.Projection, null, projectedNodes);
isParent = false; // self closing isParent = false; // self closing

View File

@ -10,7 +10,8 @@ import {assertNotNull} from './assert';
import {ContainerState, ProjectionState, ViewOrContainerState, ViewState} from './interfaces'; import {ContainerState, ProjectionState, ViewOrContainerState, ViewState} from './interfaces';
import {LContainer, LElement, LNode, LNodeFlags, LProjection, LText, LView} from './l_node'; import {LContainer, LElement, LNode, LNodeFlags, LProjection, LText, LView} from './l_node';
import {assertNodeType} from './node_assert'; import {assertNodeType} from './node_assert';
import {RComment, RElement, RNode, RText, ProceduralRenderer3} from './renderer'; import {ProceduralRenderer3, RComment, RElement, RNode, RText} from './renderer';
/** /**
* Finds the closest DOM node above a given container in the hierarchy. * Finds the closest DOM node above a given container in the hierarchy.
@ -93,26 +94,27 @@ export function addRemoveViewFromContainer(
const renderer = container.view.renderer; const renderer = container.view.renderer;
const isFnRenderer = (renderer as ProceduralRenderer3).listen; const isFnRenderer = (renderer as ProceduralRenderer3).listen;
if (type === LNodeFlags.Element) { if (type === LNodeFlags.Element) {
insertMode ? insertMode ? (isFnRenderer ?
(isFnRenderer ? (renderer as ProceduralRenderer3)
(renderer as ProceduralRenderer3) .insertBefore !(parent, node.native !, beforeNode as RNode | null) :
.insertBefore !(parent, node.native !, beforeNode as RNode | null) : parent.insertBefore(node.native !, beforeNode as RNode | null, true)) :
parent.insertBefore(node.native !, beforeNode as RNode | null, true)) : (isFnRenderer ?
(isFnRenderer ? (renderer as ProceduralRenderer3)
(renderer as ProceduralRenderer3).removeChild !(parent as RElement, node.native !) : .removeChild !(parent as RElement, node.native !) :
parent.removeChild(node.native !)); parent.removeChild(node.native !));
nextNode = node.next; nextNode = node.next;
} else if (type === LNodeFlags.Container) { } else if (type === LNodeFlags.Container) {
// if we get to a container, it must be a root node of a view because we are only // if we get to a container, it must be a root node of a view because we are only
// propagating down into child views / containers and not child elements // propagating down into child views / containers and not child elements
const childContainerData: ContainerState = (node as LContainer).data; const childContainerData: ContainerState = (node as LContainer).data;
insertMode ? insertMode ? (isFnRenderer ?
(isFnRenderer ? (renderer as ProceduralRenderer3)
(renderer as ProceduralRenderer3).appendChild !(parent as RElement, node.native !) : .appendChild !(parent as RElement, node.native !) :
parent.appendChild(node.native !)) : parent.appendChild(node.native !)) :
(isFnRenderer ? (isFnRenderer ?
(renderer as ProceduralRenderer3).removeChild !(parent as RElement, node.native !) : (renderer as ProceduralRenderer3)
parent.removeChild(node.native !)); .removeChild !(parent as RElement, node.native !) :
parent.removeChild(node.native !));
nextNode = childContainerData.views.length ? childContainerData.views[0].child : null; nextNode = childContainerData.views.length ? childContainerData.views[0].child : null;
} else if (type === LNodeFlags.Projection) { } else if (type === LNodeFlags.Projection) {
nextNode = (node as LProjection).data[0]; nextNode = (node as LProjection).data[0];
@ -374,7 +376,8 @@ export function insertChild(node: LNode, currentView: ViewState): void {
} }
const renderer = currentView.renderer; const renderer = currentView.renderer;
(renderer as ProceduralRenderer3).listen ? (renderer as ProceduralRenderer3).listen ?
(renderer as ProceduralRenderer3).insertBefore !(parent.native !, node.native !, nativeSibling) : (renderer as ProceduralRenderer3)
.insertBefore !(parent.native !, node.native !, nativeSibling) :
parent.native !.insertBefore(node.native !, nativeSibling, false); parent.native !.insertBefore(node.native !, nativeSibling, false);
} }
} }

View File

@ -7,7 +7,9 @@
*/ */
import {Type} from '../core'; import {Type} from '../core';
import {diPublic, componentRefresh} from './instructions';
import {componentRefresh, diPublic} from './instructions';
/** /**

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
import {C, E, T, V, c, defineComponent, e, cR, cr, v} from '../../src/render3/index'; import {C, E, T, V, c, cR, cr, defineComponent, e, v} from '../../src/render3/index';
import {document, renderComponent} from './render_util'; import {document, renderComponent} from './render_util';

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
import {C, D, E, P, T, V, c, pD, detectChanges, e, m, cR, cr, v} from '../../src/render3/index'; import {C, D, E, P, T, V, c, cR, cr, detectChanges, e, m, pD, v} from '../../src/render3/index';
import {createComponent, renderComponent, toHtml} from './render_util'; import {createComponent, renderComponent, toHtml} from './render_util';

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
import {C, E, T, V, b, c, e, cR, cr, t, v} from '../../src/render3/index'; import {C, E, T, V, b, c, cR, cr, e, t, v} from '../../src/render3/index';
import {renderToHtml} from './render_util'; import {renderToHtml} from './render_util';

View File

@ -9,7 +9,7 @@
import {ElementRef, TemplateRef, ViewContainerRef} from '@angular/core'; import {ElementRef, TemplateRef, ViewContainerRef} from '@angular/core';
import {bloomFindPossibleInjector} from '../../src/render3/di'; import {bloomFindPossibleInjector} from '../../src/render3/di';
import {C, D, E, PublicFeature, T, V, b, b2, c, defineDirective, e, inject, injectElementRef, injectTemplateRef, injectViewContainerRef, cR, cr, t, v} from '../../src/render3/index'; import {C, D, E, PublicFeature, T, V, b, b2, c, cR, cr, defineDirective, e, inject, injectElementRef, injectTemplateRef, injectViewContainerRef, t, v} from '../../src/render3/index';
import {bloomAdd, createLNode, createViewState, enterView, getOrCreateNodeInjector, leaveView} from '../../src/render3/instructions'; import {bloomAdd, createLNode, createViewState, enterView, getOrCreateNodeInjector, leaveView} from '../../src/render3/instructions';
import {LNodeFlags, LNodeInjector} from '../../src/render3/l_node'; import {LNodeFlags, LNodeInjector} from '../../src/render3/l_node';

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
import {C, D, E, T, V, a, b, c, defineComponent, defineDirective, e, k, p, cR, cr, t, v} from '../../src/render3/index'; import {C, D, E, T, V, a, b, c, cR, cr, defineComponent, defineDirective, e, k, p, t, v} from '../../src/render3/index';
import {renderToHtml} from './render_util'; import {renderToHtml} from './render_util';

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
import {C, D, E, NC, T, V, a, b, b1, b2, b3, b4, b5, b6, b7, b8, bV, c, defineComponent, e, k, p, r, cR, cr, s, t, v} from '../../src/render3/index'; import {C, D, E, NC, T, V, a, b, b1, b2, b3, b4, b5, b6, b7, b8, bV, c, cR, cr, defineComponent, e, k, p, r, s, t, v} from '../../src/render3/index';
import {NO_CHANGE} from '../../src/render3/instructions'; import {NO_CHANGE} from '../../src/render3/instructions';
import {containerEl, renderToHtml} from './render_util'; import {containerEl, renderToHtml} from './render_util';

View File

@ -6,7 +6,8 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
import {C, ComponentTemplate, D, E, L, LifecycleHook, T, V, b, c, defineComponent, e, l, p, cR, cr, v} from '../../src/render3/index'; import {C, ComponentTemplate, D, E, L, LifecycleHook, T, V, b, c, cR, cr, defineComponent, e, l, p, v} from '../../src/render3/index';
import {containerEl, renderToHtml} from './render_util'; import {containerEl, renderToHtml} from './render_util';
describe('lifecycles', () => { describe('lifecycles', () => {

View File

@ -6,7 +6,8 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
import {C, D, E, L, T, V, c, defineComponent, e, cR, cr, v} from '../../src/render3/index'; import {C, D, E, L, T, V, c, cR, cr, defineComponent, e, v} from '../../src/render3/index';
import {containerEl, renderComponent, renderToHtml} from './render_util'; import {containerEl, renderComponent, renderToHtml} from './render_util';

View File

@ -8,7 +8,7 @@
import {EventEmitter} from '@angular/core'; import {EventEmitter} from '@angular/core';
import {C, D, E, L, LifecycleHook, T, V, b, c, defineComponent, defineDirective, e, l, p, cR, cr, v} from '../../src/render3/index'; import {C, D, E, L, LifecycleHook, T, V, b, c, cR, cr, defineComponent, defineDirective, e, l, p, v} from '../../src/render3/index';
import {containerEl, renderToHtml} from './render_util'; import {containerEl, renderToHtml} from './render_util';

View File

@ -8,7 +8,7 @@
import {EventEmitter} from '@angular/core'; import {EventEmitter} from '@angular/core';
import {C, D, E, L, T, V, b, b1, c, defineComponent, defineDirective, e, p, cR, cr, t, v} from '../../src/render3/index'; import {C, D, E, L, T, V, b, b1, c, cR, cr, defineComponent, defineDirective, e, p, t, v} from '../../src/render3/index';
import {NO_CHANGE} from '../../src/render3/instructions'; import {NO_CHANGE} from '../../src/render3/instructions';
import {renderToHtml} from './render_util'; import {renderToHtml} from './render_util';