chore: run clang-format on code base.
This fixes several minor indentation issues (instanceof precendence, type declaration specificity, template string length calculation). This should also fix some flip-flop situations with template strings.
This commit is contained in:
parent
45994a53ce
commit
3bf8c18c56
|
@ -122,8 +122,8 @@ export class PreGeneratedChangeDetection extends ChangeDetection {
|
|||
_dynamicChangeDetection: ChangeDetection;
|
||||
_protoChangeDetectorFactories: StringMap<string, Function>;
|
||||
|
||||
constructor(@Inject(PROTO_CHANGE_DETECTOR_KEY) @Optional()
|
||||
protoChangeDetectorsForTest?: StringMap<string, Function>) {
|
||||
constructor(@Inject(PROTO_CHANGE_DETECTOR_KEY) @Optional() protoChangeDetectorsForTest?:
|
||||
StringMap<string, Function>) {
|
||||
super();
|
||||
this._dynamicChangeDetection = new DynamicChangeDetection();
|
||||
this._protoChangeDetectorFactories = isPresent(protoChangeDetectorsForTest) ?
|
||||
|
|
|
@ -82,7 +82,7 @@ export class AccessMember extends AST {
|
|||
|
||||
eval(context, locals: Locals): any {
|
||||
if (this.receiver instanceof ImplicitReceiver && isPresent(locals) &&
|
||||
locals.contains(this.name)) {
|
||||
locals.contains(this.name)) {
|
||||
return locals.get(this.name);
|
||||
} else {
|
||||
var evaluatedReceiver = this.receiver.eval(context, locals);
|
||||
|
@ -96,7 +96,7 @@ export class AccessMember extends AST {
|
|||
var evaluatedContext = this.receiver.eval(context, locals);
|
||||
|
||||
if (this.receiver instanceof ImplicitReceiver && isPresent(locals) &&
|
||||
locals.contains(this.name)) {
|
||||
locals.contains(this.name)) {
|
||||
throw new BaseException(`Cannot reassign a variable binding ${this.name}`);
|
||||
} else {
|
||||
return this.setter(evaluatedContext, value);
|
||||
|
@ -267,7 +267,7 @@ export class MethodCall extends AST {
|
|||
eval(context, locals: Locals): any {
|
||||
var evaluatedArgs = evalList(context, locals, this.args);
|
||||
if (this.receiver instanceof ImplicitReceiver && isPresent(locals) &&
|
||||
locals.contains(this.name)) {
|
||||
locals.contains(this.name)) {
|
||||
var fn = locals.get(this.name);
|
||||
return FunctionWrapper.apply(fn, evaluatedArgs);
|
||||
} else {
|
||||
|
|
|
@ -108,8 +108,7 @@ class _ConvertAstIntoProtoRecords implements AstVisitor {
|
|||
visitAccessMember(ast: AccessMember): number {
|
||||
var receiver = ast.receiver.visit(this);
|
||||
if (isPresent(this._variableNames) && ListWrapper.contains(this._variableNames, ast.name) &&
|
||||
ast.receiver instanceof
|
||||
ImplicitReceiver) {
|
||||
ast.receiver instanceof ImplicitReceiver) {
|
||||
return this._addRecord(RecordType.LOCAL, ast.name, ast.name, [], null, receiver);
|
||||
} else {
|
||||
return this._addRecord(RecordType.PROPERTY, ast.name, ast.getter, [], null, receiver);
|
||||
|
|
|
@ -241,12 +241,12 @@ export class DirectiveBinding extends ResolvedBinding {
|
|||
var resolvedHostInjectables =
|
||||
isPresent(ann.hostInjector) ? Injector.resolve(ann.hostInjector) : [];
|
||||
var resolvedViewInjectables = ann instanceof Component && isPresent(ann.viewInjector) ?
|
||||
Injector.resolve(ann.viewInjector) :
|
||||
[];
|
||||
Injector.resolve(ann.viewInjector) :
|
||||
[];
|
||||
var metadata = DirectiveMetadata.create({
|
||||
id: stringify(rb.key.token),
|
||||
type: ann instanceof
|
||||
Component ? DirectiveMetadata.COMPONENT_TYPE : DirectiveMetadata.DIRECTIVE_TYPE,
|
||||
type: ann instanceof Component ? DirectiveMetadata.COMPONENT_TYPE :
|
||||
DirectiveMetadata.DIRECTIVE_TYPE,
|
||||
selector: ann.selector,
|
||||
compileChildren: ann.compileChildren,
|
||||
events: ann.events,
|
||||
|
@ -260,8 +260,7 @@ export class DirectiveBinding extends ResolvedBinding {
|
|||
callOnInit: hasLifecycleHook(onInit, rb.key.token, ann),
|
||||
callOnAllChangesDone: hasLifecycleHook(onAllChangesDone, rb.key.token, ann),
|
||||
|
||||
changeDetection: ann instanceof
|
||||
Component ? ann.changeDetection : null,
|
||||
changeDetection: ann instanceof Component ? ann.changeDetection : null,
|
||||
|
||||
exportAs: ann.exportAs
|
||||
});
|
||||
|
@ -452,10 +451,8 @@ export class ElementInjector extends TreeNode<ElementInjector> implements Depend
|
|||
// we couple ourselves to the injector strategy to avoid polymoprhic calls
|
||||
var injectorStrategy = <any>this._injector.internalStrategy;
|
||||
this._strategy = injectorStrategy instanceof InjectorInlineStrategy ?
|
||||
new ElementInjectorInlineStrategy(
|
||||
injectorStrategy, this) :
|
||||
new ElementInjectorDynamicStrategy(
|
||||
injectorStrategy, this);
|
||||
new ElementInjectorInlineStrategy(injectorStrategy, this) :
|
||||
new ElementInjectorDynamicStrategy(injectorStrategy, this);
|
||||
|
||||
this.hydrated = false;
|
||||
|
||||
|
@ -961,7 +958,7 @@ class ElementInjectorDynamicStrategy implements _ElementInjectorStrategy {
|
|||
|
||||
for (var i = 0; i < p.bindings.length; i++) {
|
||||
if (p.bindings[i] instanceof DirectiveBinding &&
|
||||
(<DirectiveBinding>p.bindings[i]).callOnDestroy) {
|
||||
(<DirectiveBinding>p.bindings[i]).callOnDestroy) {
|
||||
ist.objs[i].onDestroy();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,9 +39,9 @@ class BindingRecordsCreator {
|
|||
return bindings;
|
||||
}
|
||||
|
||||
getDirectiveRecords(
|
||||
elementBinders: List<renderApi.ElementBinder>,
|
||||
allDirectiveMetadatas: List<renderApi.DirectiveMetadata>): List<DirectiveRecord> {
|
||||
getDirectiveRecords(elementBinders: List<renderApi.ElementBinder>,
|
||||
allDirectiveMetadatas:
|
||||
List<renderApi.DirectiveMetadata>): List<DirectiveRecord> {
|
||||
var directiveRecords = [];
|
||||
|
||||
for (var elementIndex = 0; elementIndex < elementBinders.length; ++elementIndex) {
|
||||
|
@ -277,8 +277,8 @@ function _createVariableBindings(renderProtoView): Map<string, string> {
|
|||
return variableBindings;
|
||||
}
|
||||
|
||||
function _collectNestedProtoViewsVariableNames(
|
||||
nestedPvsWithIndex: List<RenderProtoViewWithIndex>): List<List<string>> {
|
||||
function _collectNestedProtoViewsVariableNames(nestedPvsWithIndex: List<RenderProtoViewWithIndex>):
|
||||
List<List<string>> {
|
||||
var nestedPvVariableNames = ListWrapper.createFixedSize(nestedPvsWithIndex.length);
|
||||
ListWrapper.forEach(nestedPvsWithIndex, (pvWithIndex) => {
|
||||
var parentVariableNames =
|
||||
|
@ -301,8 +301,8 @@ function _createVariableNames(parentVariableNames: List<string>, renderProtoView
|
|||
return res;
|
||||
}
|
||||
|
||||
export function createVariableLocations(
|
||||
elementBinders: List<renderApi.ElementBinder>): Map<string, number> {
|
||||
export function createVariableLocations(elementBinders: List<renderApi.ElementBinder>):
|
||||
Map<string, number> {
|
||||
var variableLocations = new Map();
|
||||
for (var i = 0; i < elementBinders.length; i++) {
|
||||
var binder = elementBinders[i];
|
||||
|
@ -374,8 +374,8 @@ function _createProtoElementInjector(binderIndex, parentPeiWithDistance, renderE
|
|||
}
|
||||
|
||||
function _createElementBinder(protoView: AppProtoView, boundElementIndex, renderElementBinder,
|
||||
protoElementInjector, componentDirectiveBinding,
|
||||
directiveBindings): ElementBinder {
|
||||
protoElementInjector, componentDirectiveBinding, directiveBindings):
|
||||
ElementBinder {
|
||||
var parent = null;
|
||||
if (renderElementBinder.parentIndex !== -1) {
|
||||
parent = protoView.elementBinders[renderElementBinder.parentIndex];
|
||||
|
@ -393,9 +393,9 @@ function _createElementBinder(protoView: AppProtoView, boundElementIndex, render
|
|||
return elBinder;
|
||||
}
|
||||
|
||||
export function createDirectiveVariableBindings(
|
||||
renderElementBinder: renderApi.ElementBinder,
|
||||
directiveBindings: List<DirectiveBinding>): Map<string, number> {
|
||||
export function createDirectiveVariableBindings(renderElementBinder: renderApi.ElementBinder,
|
||||
directiveBindings: List<DirectiveBinding>):
|
||||
Map<string, number> {
|
||||
var directiveVariableBindings = new Map();
|
||||
MapWrapper.forEach(renderElementBinder.variableBindings, (templateName, exportAs) => {
|
||||
var dirIndex = _findDirectiveIndexByExportAs(renderElementBinder, directiveBindings, exportAs);
|
||||
|
|
|
@ -177,13 +177,10 @@ export class Binding {
|
|||
*/
|
||||
dependencies: List<any>;
|
||||
|
||||
constructor(token, {toClass, toValue, toAlias, toFactory, deps}: {
|
||||
toClass?: Type,
|
||||
toValue?: any,
|
||||
toAlias?: any,
|
||||
toFactory?: Function,
|
||||
deps?: List<any>
|
||||
}) {
|
||||
constructor(
|
||||
token,
|
||||
{toClass, toValue, toAlias, toFactory, deps}:
|
||||
{toClass?: Type, toValue?: any, toAlias?: any, toFactory?: Function, deps?: List<any>}) {
|
||||
this.token = token;
|
||||
this.toClass = toClass;
|
||||
this.toValue = toValue;
|
||||
|
@ -374,8 +371,8 @@ export class BindingBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
function _constructDependencies(factoryFunction: Function,
|
||||
dependencies: List<any>): List<Dependency> {
|
||||
function _constructDependencies(factoryFunction: Function, dependencies: List<any>):
|
||||
List<Dependency> {
|
||||
if (isBlank(dependencies)) {
|
||||
return _dependenciesFor(factoryFunction);
|
||||
} else {
|
||||
|
@ -393,8 +390,8 @@ function _dependenciesFor(typeOrFunc): List<Dependency> {
|
|||
return ListWrapper.map(params, (p: List<any>) => _extractToken(typeOrFunc, p, params));
|
||||
}
|
||||
|
||||
function _extractToken(typeOrFunc, annotations /*List<any> | any*/,
|
||||
params: List<List<any>>): Dependency {
|
||||
function _extractToken(typeOrFunc, annotations /*List<any> | any*/, params: List<List<any>>):
|
||||
Dependency {
|
||||
var depProps = [];
|
||||
var token = null;
|
||||
var optional = false;
|
||||
|
|
|
@ -135,8 +135,7 @@ export class InstantiationError extends AbstractBindingError {
|
|||
super(key, function(keys: List<any>) {
|
||||
var first = stringify(ListWrapper.first(keys).token);
|
||||
return `Error during instantiation of ${first}!${constructResolvingPath(keys)}.` +
|
||||
` ORIGINAL ERROR: ${originalException}` +
|
||||
`\n\n ORIGINAL STACK: ${originalStack}`;
|
||||
` ORIGINAL ERROR: ${originalException}` + `\n\n ORIGINAL STACK: ${originalStack}`;
|
||||
}, originalException, originalStack);
|
||||
|
||||
this.causeKey = key;
|
||||
|
|
|
@ -786,8 +786,8 @@ function _resolveBindings(bindings: List<Type | Binding | List<any>>): List<Reso
|
|||
return resolvedList;
|
||||
}
|
||||
|
||||
function _createListOfBindings(
|
||||
flattenedBindings: Map<number, ResolvedBinding>): List<ResolvedBinding> {
|
||||
function _createListOfBindings(flattenedBindings: Map<number, ResolvedBinding>):
|
||||
List<ResolvedBinding> {
|
||||
return MapWrapper.values(flattenedBindings);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,9 +10,8 @@ export var StringMap = global.Object;
|
|||
var createMapFromPairs: {(pairs: List<any>): Map<any, any>} = (function() {
|
||||
try {
|
||||
if (new Map([1, 2]).size === 2) {
|
||||
return function createMapFromPairs(pairs: List<any>): Map<any, any> {
|
||||
return new Map(pairs);
|
||||
};
|
||||
return function createMapFromPairs(pairs: List<any>):
|
||||
Map<any, any> { return new Map(pairs); };
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
|
|
|
@ -107,9 +107,9 @@ export class FormBuilder {
|
|||
}
|
||||
|
||||
_createControl(controlConfig: any): modelModule.AbstractControl {
|
||||
if (controlConfig instanceof modelModule.Control || controlConfig instanceof
|
||||
modelModule.ControlGroup || controlConfig instanceof
|
||||
modelModule.ControlArray) {
|
||||
if (controlConfig instanceof modelModule.Control ||
|
||||
controlConfig instanceof modelModule.ControlGroup ||
|
||||
controlConfig instanceof modelModule.ControlArray) {
|
||||
return controlConfig;
|
||||
|
||||
} else if (isArray(controlConfig)) {
|
||||
|
|
|
@ -98,8 +98,8 @@ export class AbstractControl {
|
|||
}
|
||||
}
|
||||
|
||||
updateValueAndValidity({onlySelf, emitEvent}: {onlySelf?: boolean,
|
||||
emitEvent?: boolean} = {}): void {
|
||||
updateValueAndValidity({onlySelf, emitEvent}: {onlySelf?: boolean, emitEvent?: boolean} = {}):
|
||||
void {
|
||||
onlySelf = isPresent(onlySelf) ? onlySelf : false;
|
||||
emitEvent = isPresent(emitEvent) ? emitEvent : true;
|
||||
|
||||
|
@ -151,8 +151,8 @@ export class Control extends AbstractControl {
|
|||
this._valueChanges = new EventEmitter();
|
||||
}
|
||||
|
||||
updateValue(value: any,
|
||||
{onlySelf, emitEvent}: {onlySelf?: boolean, emitEvent?: boolean} = {}): void {
|
||||
updateValue(value: any, {onlySelf, emitEvent}: {onlySelf?: boolean, emitEvent?: boolean} = {}):
|
||||
void {
|
||||
this._value = value;
|
||||
if (isPresent(this._onChange)) this._onChange(this._value);
|
||||
this.updateValueAndValidity({onlySelf: onlySelf, emitEvent: emitEvent});
|
||||
|
|
|
@ -188,8 +188,8 @@ export class DomRenderer extends Renderer {
|
|||
view.setElementProperty(location.boundElementIndex, propertyName, propertyValue);
|
||||
}
|
||||
|
||||
setElementAttribute(location: RenderElementRef, attributeName: string,
|
||||
attributeValue: string): void {
|
||||
setElementAttribute(location: RenderElementRef, attributeName: string, attributeValue: string):
|
||||
void {
|
||||
var view = resolveInternalDomView(location.renderView);
|
||||
view.setElementAttribute(location.boundElementIndex, attributeName, attributeValue);
|
||||
}
|
||||
|
|
|
@ -89,8 +89,8 @@ export class KeyEventsPlugin extends EventManagerPlugin {
|
|||
return fullKey;
|
||||
}
|
||||
|
||||
static eventCallback(element, shouldSupportBubble, fullKey, handler,
|
||||
zone): (event: Event) => void {
|
||||
static eventCallback(element, shouldSupportBubble, fullKey, handler, zone):
|
||||
(event: Event) => void {
|
||||
return (event) => {
|
||||
var correctElement = shouldSupportBubble || event.target === element;
|
||||
if (correctElement && StringWrapper.equals(KeyEventsPlugin.getEventFullKey(event), fullKey)) {
|
||||
|
|
|
@ -343,10 +343,10 @@ const ATTRIBUTE_PREFIX = 'attr';
|
|||
const CLASS_PREFIX = 'class';
|
||||
const STYLE_PREFIX = 'style';
|
||||
|
||||
function buildElementPropertyBindings(
|
||||
protoElement: /*element*/ any, isNgComponent: boolean,
|
||||
bindingsInTemplate: Map<string, ASTWithSource>,
|
||||
directiveTempaltePropertyNames: Set<string>): List<api.ElementPropertyBinding> {
|
||||
function buildElementPropertyBindings(protoElement: /*element*/ any, isNgComponent: boolean,
|
||||
bindingsInTemplate: Map<string, ASTWithSource>,
|
||||
directiveTempaltePropertyNames: Set<string>):
|
||||
List<api.ElementPropertyBinding> {
|
||||
var propertyBindings = [];
|
||||
MapWrapper.forEach(bindingsInTemplate, (ast, propertyNameInTemplate) => {
|
||||
var propertyBinding = createElementPropertyBinding(ast, propertyNameInTemplate);
|
||||
|
@ -376,8 +376,8 @@ function isValidElementPropertyBinding(protoElement: /*element*/ any, isNgCompon
|
|||
return true;
|
||||
}
|
||||
|
||||
function createElementPropertyBinding(ast: ASTWithSource,
|
||||
propertyNameInTemplate: string): api.ElementPropertyBinding {
|
||||
function createElementPropertyBinding(ast: ASTWithSource, propertyNameInTemplate: string):
|
||||
api.ElementPropertyBinding {
|
||||
var parts = StringWrapper.split(propertyNameInTemplate, PROPERTY_PARTS_SEPARATOR);
|
||||
if (parts.length === 1) {
|
||||
var propName = parts[0];
|
||||
|
|
|
@ -38,7 +38,7 @@ export function fakeAsync(fn: Function): Function {
|
|||
_inFakeAsyncZone: true
|
||||
});
|
||||
|
||||
return function(... args) {
|
||||
return function(...args) {
|
||||
// TODO(tbosch): This class should already be part of the jasmine typings but it is not...
|
||||
_scheduler = new (<any>jasmine).DelayedFunctionScheduler();
|
||||
ListWrapper.clear(_microtasks);
|
||||
|
@ -46,7 +46,7 @@ export function fakeAsync(fn: Function): Function {
|
|||
ListWrapper.clear(_pendingTimers);
|
||||
|
||||
let res = fakeAsyncZone.run(() => {
|
||||
let res = fn(... args);
|
||||
let res = fn(...args);
|
||||
flushMicrotasks();
|
||||
return res;
|
||||
});
|
||||
|
@ -92,7 +92,7 @@ export function flushMicrotasks(): void {
|
|||
}
|
||||
}
|
||||
|
||||
function _setTimeout(fn: Function, delay: number, ... args): number {
|
||||
function _setTimeout(fn: Function, delay: number, ...args): number {
|
||||
var cb = _fnAndFlush(fn);
|
||||
var id = _scheduler.scheduleFunction(cb, delay, args);
|
||||
_pendingTimers.push(id);
|
||||
|
@ -105,7 +105,7 @@ function _clearTimeout(id: number) {
|
|||
return _scheduler.removeFunctionWithId(id);
|
||||
}
|
||||
|
||||
function _setInterval(fn: Function, interval: number, ... args) {
|
||||
function _setInterval(fn: Function, interval: number, ...args) {
|
||||
var cb = _fnAndFlush(fn);
|
||||
var id = _scheduler.scheduleFunction(cb, interval, args, true);
|
||||
_pendingPeriodicTimers.push(id);
|
||||
|
@ -118,9 +118,10 @@ function _clearInterval(id: number) {
|
|||
}
|
||||
|
||||
function _fnAndFlush(fn: Function): Function {
|
||||
return (... args) => { fn.apply(global, args);
|
||||
flushMicrotasks();
|
||||
}
|
||||
return (...args) => {
|
||||
fn.apply(global, args);
|
||||
flushMicrotasks();
|
||||
}
|
||||
}
|
||||
|
||||
function _scheduleMicrotask(microtask: Function): void {
|
||||
|
|
|
@ -242,9 +242,8 @@ export function makeDecorator(annotationCls, chainFn: (fn: Function) => void = n
|
|||
if (this instanceof annotationCls) {
|
||||
return annotationInstance;
|
||||
} else {
|
||||
var chainAnnotation = isFunction(this) && this.annotations instanceof Array ?
|
||||
this.annotations :
|
||||
[];
|
||||
var chainAnnotation =
|
||||
isFunction(this) && this.annotations instanceof Array ? this.annotations : [];
|
||||
chainAnnotation.push(annotationInstance);
|
||||
var TypeDecorator: TypeDecorator = <TypeDecorator>function TypeDecorator(cls) {
|
||||
var annotations = Reflect.getMetadata('annotations', cls);
|
||||
|
|
|
@ -213,45 +213,48 @@ class _DirectiveUpdating {
|
|||
* Map from test id to _DirectiveUpdating.
|
||||
* Definitions in this map define definitions which allow testing directive updating.
|
||||
*/
|
||||
static availableDefinitions: StringMap<string, _DirectiveUpdating> = {
|
||||
'directNoDispatcher': new _DirectiveUpdating(
|
||||
[_DirectiveUpdating.updateA('42', _DirectiveUpdating.basicRecords[0])],
|
||||
[_DirectiveUpdating.basicRecords[0]]),
|
||||
'groupChanges': new _DirectiveUpdating(
|
||||
[
|
||||
_DirectiveUpdating.updateA('1', _DirectiveUpdating.basicRecords[0]),
|
||||
_DirectiveUpdating.updateB('2', _DirectiveUpdating.basicRecords[0]),
|
||||
BindingRecord.createDirectiveOnChange(_DirectiveUpdating.basicRecords[0]),
|
||||
_DirectiveUpdating.updateA('3', _DirectiveUpdating.basicRecords[1]),
|
||||
BindingRecord.createDirectiveOnChange(_DirectiveUpdating.basicRecords[1])
|
||||
],
|
||||
[_DirectiveUpdating.basicRecords[0], _DirectiveUpdating.basicRecords[1]]),
|
||||
'directiveOnCheck': new _DirectiveUpdating(
|
||||
[BindingRecord.createDirectiveOnCheck(_DirectiveUpdating.basicRecords[0])],
|
||||
[_DirectiveUpdating.basicRecords[0]]),
|
||||
'directiveOnInit': new _DirectiveUpdating(
|
||||
[BindingRecord.createDirectiveOnInit(_DirectiveUpdating.basicRecords[0])],
|
||||
[_DirectiveUpdating.basicRecords[0]]),
|
||||
'emptyWithDirectiveRecords': new _DirectiveUpdating(
|
||||
[], [_DirectiveUpdating.basicRecords[0], _DirectiveUpdating.basicRecords[1]]),
|
||||
'noCallbacks': new _DirectiveUpdating(
|
||||
[_DirectiveUpdating.updateA('1', _DirectiveUpdating.recordNoCallbacks)],
|
||||
[_DirectiveUpdating.recordNoCallbacks]),
|
||||
'readingDirectives':
|
||||
new _DirectiveUpdating(
|
||||
[
|
||||
BindingRecord.createForHostProperty(
|
||||
new DirectiveIndex(0, 0), _getParser().parseBinding('a', 'location'), PROP_NAME)
|
||||
],
|
||||
static availableDefinitions:
|
||||
StringMap<string, _DirectiveUpdating> = {
|
||||
'directNoDispatcher': new _DirectiveUpdating(
|
||||
[_DirectiveUpdating.updateA('42', _DirectiveUpdating.basicRecords[0])],
|
||||
[_DirectiveUpdating.basicRecords[0]]),
|
||||
'interpolation':
|
||||
new _DirectiveUpdating(
|
||||
[
|
||||
BindingRecord.createForElementProperty(
|
||||
_getParser().parseInterpolation('B{{a}}A', 'location'), 0, PROP_NAME)
|
||||
],
|
||||
[])
|
||||
};
|
||||
'groupChanges':
|
||||
new _DirectiveUpdating(
|
||||
[
|
||||
_DirectiveUpdating.updateA('1', _DirectiveUpdating.basicRecords[0]),
|
||||
_DirectiveUpdating.updateB('2', _DirectiveUpdating.basicRecords[0]),
|
||||
BindingRecord.createDirectiveOnChange(_DirectiveUpdating.basicRecords[0]),
|
||||
_DirectiveUpdating.updateA('3', _DirectiveUpdating.basicRecords[1]),
|
||||
BindingRecord.createDirectiveOnChange(_DirectiveUpdating.basicRecords[1])
|
||||
],
|
||||
[_DirectiveUpdating.basicRecords[0], _DirectiveUpdating.basicRecords[1]]),
|
||||
'directiveOnCheck': new _DirectiveUpdating(
|
||||
[BindingRecord.createDirectiveOnCheck(_DirectiveUpdating.basicRecords[0])],
|
||||
[_DirectiveUpdating.basicRecords[0]]),
|
||||
'directiveOnInit': new _DirectiveUpdating(
|
||||
[BindingRecord.createDirectiveOnInit(_DirectiveUpdating.basicRecords[0])],
|
||||
[_DirectiveUpdating.basicRecords[0]]),
|
||||
'emptyWithDirectiveRecords': new _DirectiveUpdating(
|
||||
[], [_DirectiveUpdating.basicRecords[0], _DirectiveUpdating.basicRecords[1]]),
|
||||
'noCallbacks': new _DirectiveUpdating(
|
||||
[_DirectiveUpdating.updateA('1', _DirectiveUpdating.recordNoCallbacks)],
|
||||
[_DirectiveUpdating.recordNoCallbacks]),
|
||||
'readingDirectives':
|
||||
new _DirectiveUpdating(
|
||||
[
|
||||
BindingRecord.createForHostProperty(new DirectiveIndex(0, 0),
|
||||
_getParser().parseBinding('a', 'location'),
|
||||
PROP_NAME)
|
||||
],
|
||||
[_DirectiveUpdating.basicRecords[0]]),
|
||||
'interpolation':
|
||||
new _DirectiveUpdating(
|
||||
[
|
||||
BindingRecord.createForElementProperty(
|
||||
_getParser().parseInterpolation('B{{a}}A', 'location'), 0, PROP_NAME)
|
||||
],
|
||||
[])
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,10 +6,9 @@ import {RecordType, ProtoRecord} from 'angular2/src/change_detection/proto_recor
|
|||
import {DirectiveIndex} from 'angular2/src/change_detection/directive_record';
|
||||
|
||||
export function main() {
|
||||
function r(
|
||||
funcOrValue, args, contextIndex, selfIndex,
|
||||
{lastInBinding, mode, name,
|
||||
directiveIndex}: {lastInBinding?: any, mode?: any, name?: any, directiveIndex?: any} = {}) {
|
||||
function r(funcOrValue, args, contextIndex, selfIndex,
|
||||
{lastInBinding, mode, name, directiveIndex}:
|
||||
{lastInBinding?: any, mode?: any, name?: any, directiveIndex?: any} = {}) {
|
||||
if (isBlank(lastInBinding)) lastInBinding = false;
|
||||
if (isBlank(mode)) mode = RecordType.PROPERTY;
|
||||
if (isBlank(name)) name = "name";
|
||||
|
|
|
@ -158,8 +158,7 @@ export class Unparser implements AstVisitor {
|
|||
|
||||
visitMethodCall(ast: MethodCall) {
|
||||
this._visit(ast.receiver);
|
||||
this._expression += ast.receiver instanceof ImplicitReceiver ? `${ast.name}(` :
|
||||
`.${ast.name}(`;
|
||||
this._expression += ast.receiver instanceof ImplicitReceiver ? `${ast.name}(` : `.${ast.name}(`;
|
||||
var isFirst = true;
|
||||
ast.args.forEach(arg => {
|
||||
if (!isFirst) this._expression += ', ';
|
||||
|
|
|
@ -58,9 +58,9 @@ export function main() {
|
|||
rootProtoView = createRootProtoView(directiveResolver, MainComponent);
|
||||
});
|
||||
|
||||
function createCompiler(
|
||||
renderCompileResults: List<renderApi.ProtoViewDto | Promise<renderApi.ProtoViewDto>>,
|
||||
protoViewFactoryResults: List<List<AppProtoView>>) {
|
||||
function createCompiler(renderCompileResults:
|
||||
List<renderApi.ProtoViewDto | Promise<renderApi.ProtoViewDto>>,
|
||||
protoViewFactoryResults: List<List<AppProtoView>>) {
|
||||
var urlResolver = new UrlResolver();
|
||||
renderCompileRequests = [];
|
||||
renderCompiler.spy('compile').andCallFake((view) => {
|
||||
|
@ -510,8 +510,8 @@ function createViewportElementBinder(nestedProtoView): ElementBinder {
|
|||
return elBinder;
|
||||
}
|
||||
|
||||
function createRenderProtoView(elementBinders = null,
|
||||
type: renderApi.ViewType = null): renderApi.ProtoViewDto {
|
||||
function createRenderProtoView(elementBinders = null, type: renderApi.ViewType = null):
|
||||
renderApi.ProtoViewDto {
|
||||
if (isBlank(type)) {
|
||||
type = renderApi.ViewType.COMPONENT;
|
||||
}
|
||||
|
|
|
@ -67,8 +67,8 @@ export class DomTestbed {
|
|||
DOM.appendChild(DOM.querySelector(document, 'body'), this.rootEl);
|
||||
}
|
||||
|
||||
compileAll(directivesOrViewDefinitions: List<DirectiveMetadata |
|
||||
ViewDefinition>): Promise<List<ProtoViewDto>> {
|
||||
compileAll(directivesOrViewDefinitions:
|
||||
List<DirectiveMetadata | ViewDefinition>): Promise<List<ProtoViewDto>> {
|
||||
return PromiseWrapper.all(ListWrapper.map(directivesOrViewDefinitions, (entry) => {
|
||||
if (entry instanceof DirectiveMetadata) {
|
||||
return this.compiler.compileHost(entry);
|
||||
|
|
|
@ -69,10 +69,8 @@ export class PerfLogFeatures {
|
|||
gc: boolean;
|
||||
frameCapture: boolean;
|
||||
|
||||
constructor({render = false, gc = false,
|
||||
frameCapture = false}: {render?: boolean,
|
||||
gc?: boolean,
|
||||
frameCapture?: boolean} = {}) {
|
||||
constructor({render = false, gc = false, frameCapture = false}:
|
||||
{render?: boolean, gc?: boolean, frameCapture?: boolean} = {}) {
|
||||
this.render = render;
|
||||
this.gc = gc;
|
||||
this.frameCapture = frameCapture;
|
||||
|
|
|
@ -141,8 +141,8 @@ export class ChromeDriverExtension extends WebDriverExtension {
|
|||
}
|
||||
}
|
||||
|
||||
function normalizeEvent(chromeEvent: StringMap<string, any>,
|
||||
data: StringMap<string, any>): StringMap<string, any> {
|
||||
function normalizeEvent(chromeEvent: StringMap<string, any>, data: StringMap<string, any>):
|
||||
StringMap<string, any> {
|
||||
var ph = chromeEvent['ph'];
|
||||
if (StringWrapper.equals(ph, 'S')) {
|
||||
ph = 'b';
|
||||
|
|
|
@ -81,8 +81,8 @@ export function main() {
|
|||
createExtension()
|
||||
.timeEnd('name1', 'name2')
|
||||
.then((_) => {
|
||||
expect(log).toEqual(
|
||||
[['executeScript', `console.timeEnd('name1');console.time('name2');`]]);
|
||||
expect(log)
|
||||
.toEqual([['executeScript', `console.timeEnd('name1');console.time('name2');`]]);
|
||||
async.done();
|
||||
});
|
||||
}));
|
||||
|
|
|
@ -71,8 +71,8 @@ export function main() {
|
|||
createExtension()
|
||||
.timeEnd('name1', 'name2')
|
||||
.then((_) => {
|
||||
expect(log).toEqual(
|
||||
[['executeScript', `console.timeEnd('name1');console.time('name2');`]]);
|
||||
expect(log)
|
||||
.toEqual([['executeScript', `console.timeEnd('name1');console.time('name2');`]]);
|
||||
async.done();
|
||||
});
|
||||
}));
|
||||
|
|
|
@ -155,8 +155,8 @@ class DirtyCheckingDiffResult extends DiffResult {
|
|||
.concat(this.changedPaths.map(p => `* ${p}`))
|
||||
.concat(this.removedPaths.map(p => `- ${p}`));
|
||||
console.log(`Tree diff: ${this}` + ((verbose && prefixedPaths.length) ?
|
||||
` [\n ${prefixedPaths.join('\n ')}\n]` :
|
||||
''));
|
||||
` [\n ${prefixedPaths.join('\n ')}\n]` :
|
||||
''));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue