parent
4ed642f921
commit
aee176115b
|
@ -221,7 +221,7 @@ export class RecursiveAstVisitor implements AstVisitor {
|
||||||
return this.visitAll(ast.args);
|
return this.visitAll(ast.args);
|
||||||
}
|
}
|
||||||
visitAll(asts: AST[]): any {
|
visitAll(asts: AST[]): any {
|
||||||
ListWrapper.forEach(asts, (ast) => { ast.visit(this); });
|
asts.forEach(ast => ast.visit(this));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,8 +139,7 @@ export class CssSelector {
|
||||||
res += ']';
|
res += ']';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ListWrapper.forEach(this.notSelectors,
|
this.notSelectors.forEach(notSelector => res += `:not(${notSelector})`);
|
||||||
(notSelector) => { res += ":not(" + notSelector.toString() + ")"; });
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,7 +213,7 @@ function _removeDotSegments(path: string): string {
|
||||||
var trailingSlash = path[path.length - 1] === '/' ? '/' : '';
|
var trailingSlash = path[path.length - 1] === '/' ? '/' : '';
|
||||||
var segments = path.split('/');
|
var segments = path.split('/');
|
||||||
|
|
||||||
var out = [];
|
var out: string[] = [];
|
||||||
var up = 0;
|
var up = 0;
|
||||||
for (var pos = 0; pos < segments.length; pos++) {
|
for (var pos = 0; pos < segments.length; pos++) {
|
||||||
var segment = segments[pos];
|
var segment = segments[pos];
|
||||||
|
@ -223,7 +223,7 @@ function _removeDotSegments(path: string): string {
|
||||||
break;
|
break;
|
||||||
case '..':
|
case '..':
|
||||||
if (out.length > 0) {
|
if (out.length > 0) {
|
||||||
ListWrapper.removeAt(out, out.length - 1);
|
out.pop();
|
||||||
} else {
|
} else {
|
||||||
up++;
|
up++;
|
||||||
}
|
}
|
||||||
|
@ -235,7 +235,7 @@ function _removeDotSegments(path: string): string {
|
||||||
|
|
||||||
if (leadingSlash == '') {
|
if (leadingSlash == '') {
|
||||||
while (up-- > 0) {
|
while (up-- > 0) {
|
||||||
ListWrapper.insert(out, 0, '..');
|
out.unshift('..');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (out.length === 0) out.push('.');
|
if (out.length === 0) out.push('.');
|
||||||
|
|
|
@ -28,8 +28,7 @@ export class MockXHR extends XHR {
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
var request = ListWrapper.removeAt(this._requests, 0);
|
this._processRequest(this._requests.shift());
|
||||||
this._processRequest(request);
|
|
||||||
} while (this._requests.length > 0);
|
} while (this._requests.length > 0);
|
||||||
|
|
||||||
this.verifyNoOustandingExpectations();
|
this.verifyNoOustandingExpectations();
|
||||||
|
|
|
@ -126,9 +126,8 @@ export class DebugElement {
|
||||||
|
|
||||||
var views = view.viewContainers[view.elementOffset + i];
|
var views = view.viewContainers[view.elementOffset + i];
|
||||||
if (isPresent(views)) {
|
if (isPresent(views)) {
|
||||||
ListWrapper.forEach(views.views, (nextView) => {
|
views.views.forEach(
|
||||||
els = els.concat(this._getChildElements(nextView, null));
|
(nextView) => { els = els.concat(this._getChildElements(nextView, null)); });
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -155,17 +154,15 @@ export class Scope {
|
||||||
var scope = [];
|
var scope = [];
|
||||||
scope.push(debugElement);
|
scope.push(debugElement);
|
||||||
|
|
||||||
ListWrapper.forEach(debugElement.children,
|
debugElement.children.forEach(child => scope = scope.concat(Scope.all(child)));
|
||||||
(child) => { scope = scope.concat(Scope.all(child)); });
|
|
||||||
|
|
||||||
ListWrapper.forEach(debugElement.componentViewChildren,
|
debugElement.componentViewChildren.forEach(child => scope = scope.concat(Scope.all(child)));
|
||||||
(child) => { scope = scope.concat(Scope.all(child)); });
|
|
||||||
|
|
||||||
return scope;
|
return scope;
|
||||||
}
|
}
|
||||||
static light(debugElement: DebugElement): DebugElement[] {
|
static light(debugElement: DebugElement): DebugElement[] {
|
||||||
var scope = [];
|
var scope = [];
|
||||||
ListWrapper.forEach(debugElement.children, (child) => {
|
debugElement.children.forEach(child => {
|
||||||
scope.push(child);
|
scope.push(child);
|
||||||
scope = scope.concat(Scope.light(child));
|
scope = scope.concat(Scope.light(child));
|
||||||
});
|
});
|
||||||
|
@ -175,7 +172,7 @@ export class Scope {
|
||||||
static view(debugElement: DebugElement): DebugElement[] {
|
static view(debugElement: DebugElement): DebugElement[] {
|
||||||
var scope = [];
|
var scope = [];
|
||||||
|
|
||||||
ListWrapper.forEach(debugElement.componentViewChildren, (child) => {
|
debugElement.componentViewChildren.forEach(child => {
|
||||||
scope.push(child);
|
scope.push(child);
|
||||||
scope = scope.concat(Scope.light(child));
|
scope = scope.concat(Scope.light(child));
|
||||||
});
|
});
|
||||||
|
|
|
@ -498,10 +498,10 @@ function _createListOfBindings(flattenedBindings: Map<number, any>): any[] {
|
||||||
return MapWrapper.values(flattenedBindings);
|
return MapWrapper.values(flattenedBindings);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _normalizeBindings(bindings: Array<Type | Binding | any[]>,
|
function _normalizeBindings(bindings: Array<Type | Binding | BindingBuilder | any[]>,
|
||||||
res: Map<number, _NormalizedBinding | _NormalizedBinding[]>):
|
res: Map<number, _NormalizedBinding | _NormalizedBinding[]>):
|
||||||
Map<number, _NormalizedBinding | _NormalizedBinding[]> {
|
Map<number, _NormalizedBinding | _NormalizedBinding[]> {
|
||||||
ListWrapper.forEach(bindings, (b) => {
|
bindings.forEach(b => {
|
||||||
if (b instanceof Type) {
|
if (b instanceof Type) {
|
||||||
_normalizeBinding(bind(b).toClass(b), res);
|
_normalizeBinding(bind(b).toClass(b), res);
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,7 @@ import {
|
||||||
KeyValueDiffers
|
KeyValueDiffers
|
||||||
} from 'angular2/src/core/change_detection';
|
} from 'angular2/src/core/change_detection';
|
||||||
import {Renderer} from 'angular2/src/core/render';
|
import {Renderer} from 'angular2/src/core/render';
|
||||||
import {
|
import {StringMapWrapper, isListLikeIterable} from 'angular2/src/core/facade/collection';
|
||||||
ListWrapper,
|
|
||||||
StringMapWrapper,
|
|
||||||
isListLikeIterable
|
|
||||||
} from 'angular2/src/core/facade/collection';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds and removes CSS classes based on an {expression} value.
|
* Adds and removes CSS classes based on an {expression} value.
|
||||||
|
@ -109,14 +105,13 @@ export class NgClass implements DoCheck, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
private _applyInitialClasses(isCleanup: boolean) {
|
private _applyInitialClasses(isCleanup: boolean) {
|
||||||
ListWrapper.forEach(this._initialClasses,
|
this._initialClasses.forEach(className => this._toggleClass(className, !isCleanup));
|
||||||
(className) => { this._toggleClass(className, !isCleanup); });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private _applyClasses(rawClassVal, isCleanup: boolean) {
|
private _applyClasses(rawClassVal, isCleanup: boolean) {
|
||||||
if (isPresent(rawClassVal)) {
|
if (isPresent(rawClassVal)) {
|
||||||
if (isListLikeIterable(rawClassVal)) {
|
if (isListLikeIterable(rawClassVal)) {
|
||||||
ListWrapper.forEach(rawClassVal, (className) => this._toggleClass(className, !isCleanup));
|
(<string[]>rawClassVal).forEach(className => this._toggleClass(className, !isCleanup));
|
||||||
} else {
|
} else {
|
||||||
StringMapWrapper.forEach(rawClassVal, (expVal, className) => {
|
StringMapWrapper.forEach(rawClassVal, (expVal, className) => {
|
||||||
if (expVal) this._toggleClass(className, !isCleanup);
|
if (expVal) this._toggleClass(className, !isCleanup);
|
||||||
|
|
|
@ -165,9 +165,7 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter {
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
insertBefore(el, node) { el.parentNode.insertBefore(node, el); }
|
insertBefore(el, node) { el.parentNode.insertBefore(node, el); }
|
||||||
insertAllBefore(el, nodes) {
|
insertAllBefore(el, nodes) { nodes.forEach(n => el.parentNode.insertBefore(n, el)); }
|
||||||
ListWrapper.forEach(nodes, (n) => { el.parentNode.insertBefore(n, el); });
|
|
||||||
}
|
|
||||||
insertAfter(el, node) { el.parentNode.insertBefore(node, el.nextSibling); }
|
insertAfter(el, node) { el.parentNode.insertBefore(node, el.nextSibling); }
|
||||||
setInnerHTML(el, value) { el.innerHTML = value; }
|
setInnerHTML(el, value) { el.innerHTML = value; }
|
||||||
getText(el): string { return el.textContent; }
|
getText(el): string { return el.textContent; }
|
||||||
|
|
|
@ -222,9 +222,7 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||||
this.remove(node);
|
this.remove(node);
|
||||||
treeAdapter.insertBefore(el.parent, node, el);
|
treeAdapter.insertBefore(el.parent, node, el);
|
||||||
}
|
}
|
||||||
insertAllBefore(el, nodes) {
|
insertAllBefore(el, nodes) { nodes.forEach(n => this.insertBefore(el, n)); }
|
||||||
ListWrapper.forEach(nodes, (n) => { this.insertBefore(el, n); });
|
|
||||||
}
|
|
||||||
insertAfter(el, node) {
|
insertAfter(el, node) {
|
||||||
if (el.nextSibling) {
|
if (el.nextSibling) {
|
||||||
this.insertBefore(el.nextSibling, node);
|
this.insertBefore(el.nextSibling, node);
|
||||||
|
|
|
@ -125,9 +125,6 @@ class ListWrapper {
|
||||||
static find(List list, bool fn(item)) =>
|
static find(List list, bool fn(item)) =>
|
||||||
list.firstWhere(fn, orElse: () => null);
|
list.firstWhere(fn, orElse: () => null);
|
||||||
static bool any(List list, bool fn(item)) => list.any(fn);
|
static bool any(List list, bool fn(item)) => list.any(fn);
|
||||||
static void forEach(Iterable list, fn(item)) {
|
|
||||||
list.forEach(fn);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void forEachWithIndex(List list, fn(item, index)) {
|
static void forEachWithIndex(List list, fn(item, index)) {
|
||||||
for (var i = 0; i < list.length; ++i) {
|
for (var i = 0; i < list.length; ++i) {
|
||||||
|
@ -160,7 +157,6 @@ class ListWrapper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static removeLast(List list) => list.removeLast();
|
|
||||||
static bool remove(List list, item) => list.remove(item);
|
static bool remove(List list, item) => list.remove(item);
|
||||||
static void clear(List l) {
|
static void clear(List l) {
|
||||||
l.clear();
|
l.clear();
|
||||||
|
|
|
@ -177,11 +177,6 @@ export class ListWrapper {
|
||||||
static createFixedSize(size: number): any[] { return new Array(size); }
|
static createFixedSize(size: number): any[] { return new Array(size); }
|
||||||
static createGrowableSize(size: number): any[] { return new Array(size); }
|
static createGrowableSize(size: number): any[] { return new Array(size); }
|
||||||
static clone<T>(array: T[]): T[] { return array.slice(0); }
|
static clone<T>(array: T[]): T[] { return array.slice(0); }
|
||||||
static forEach<T>(array: T[], fn: (T) => void) {
|
|
||||||
for (var i = 0; i < array.length; i++) {
|
|
||||||
fn(array[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
static forEachWithIndex<T>(array: T[], fn: (T, number) => void) {
|
static forEachWithIndex<T>(array: T[], fn: (T, number) => void) {
|
||||||
for (var i = 0; i < array.length; i++) {
|
for (var i = 0; i < array.length; i++) {
|
||||||
fn(array[i], i);
|
fn(array[i], i);
|
||||||
|
@ -234,7 +229,6 @@ export class ListWrapper {
|
||||||
list.splice(index, 1);
|
list.splice(index, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static removeLast<T>(list: T[]): T { return list.pop(); }
|
|
||||||
static remove<T>(list: T[], el: T): boolean {
|
static remove<T>(list: T[], el: T): boolean {
|
||||||
var index = list.indexOf(el);
|
var index = list.indexOf(el);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
|
|
|
@ -158,7 +158,7 @@ export class NgForm extends ControlContainer implements Form {
|
||||||
}
|
}
|
||||||
|
|
||||||
_findContainer(path: string[]): ControlGroup {
|
_findContainer(path: string[]): ControlGroup {
|
||||||
ListWrapper.removeLast(path);
|
path.pop();
|
||||||
return ListWrapper.isEmpty(path) ? this.form : <ControlGroup>this.form.find(path);
|
return ListWrapper.isEmpty(path) ? this.form : <ControlGroup>this.form.find(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,7 @@ export class NgFormModel extends ControlContainer implements Form,
|
||||||
}
|
}
|
||||||
|
|
||||||
_updateDomValue() {
|
_updateDomValue() {
|
||||||
ListWrapper.forEach(this.directives, dir => {
|
this.directives.forEach(dir => {
|
||||||
var ctrl: any = this.form.find(dir.path);
|
var ctrl: any = this.form.find(dir.path);
|
||||||
dir.valueAccessor.writeValue(ctrl.value);
|
dir.valueAccessor.writeValue(ctrl.value);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import {Inject, Injectable, OpaqueToken} from 'angular2/src/core/di';
|
import {Inject, Injectable, OpaqueToken} from 'angular2/src/core/di';
|
||||||
|
|
||||||
import {ListWrapper, MapWrapper, Map} from 'angular2/src/core/facade/collection';
|
import {MapWrapper, Map} from 'angular2/src/core/facade/collection';
|
||||||
import {isPresent, isBlank, CONST_EXPR} from 'angular2/src/core/facade/lang';
|
import {isPresent, isBlank, CONST_EXPR} from 'angular2/src/core/facade/lang';
|
||||||
|
|
||||||
import * as viewModule from './view';
|
import * as viewModule from './view';
|
||||||
|
@ -19,7 +19,7 @@ export class AppViewPool {
|
||||||
getView(protoView: viewModule.AppProtoView): viewModule.AppView {
|
getView(protoView: viewModule.AppProtoView): viewModule.AppView {
|
||||||
var pooledViews = this._pooledViewsPerProtoView.get(protoView);
|
var pooledViews = this._pooledViewsPerProtoView.get(protoView);
|
||||||
if (isPresent(pooledViews) && pooledViews.length > 0) {
|
if (isPresent(pooledViews) && pooledViews.length > 0) {
|
||||||
return ListWrapper.removeLast(pooledViews);
|
return pooledViews.pop();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,19 +39,19 @@ export class KeyEventsPlugin extends EventManagerPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
static parseEventName(eventName: string): {[key: string]: string} {
|
static parseEventName(eventName: string): {[key: string]: string} {
|
||||||
var parts = eventName.toLowerCase().split('.');
|
var parts: string[] = eventName.toLowerCase().split('.');
|
||||||
|
|
||||||
var domEventName = ListWrapper.removeAt(parts, 0);
|
var domEventName = parts.shift();
|
||||||
if ((parts.length === 0) ||
|
if ((parts.length === 0) ||
|
||||||
!(StringWrapper.equals(domEventName, 'keydown') ||
|
!(StringWrapper.equals(domEventName, 'keydown') ||
|
||||||
StringWrapper.equals(domEventName, 'keyup'))) {
|
StringWrapper.equals(domEventName, 'keyup'))) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var key = KeyEventsPlugin._normalizeKey(ListWrapper.removeLast(parts));
|
var key = KeyEventsPlugin._normalizeKey(parts.pop());
|
||||||
|
|
||||||
var fullKey = '';
|
var fullKey = '';
|
||||||
ListWrapper.forEach(modifierKeys, (modifierName) => {
|
modifierKeys.forEach(modifierName => {
|
||||||
if (ListWrapper.contains(parts, modifierName)) {
|
if (ListWrapper.contains(parts, modifierName)) {
|
||||||
ListWrapper.remove(parts, modifierName);
|
ListWrapper.remove(parts, modifierName);
|
||||||
fullKey += modifierName + '.';
|
fullKey += modifierName + '.';
|
||||||
|
@ -78,7 +78,7 @@ export class KeyEventsPlugin extends EventManagerPlugin {
|
||||||
} else if (StringWrapper.equals(key, '.')) {
|
} else if (StringWrapper.equals(key, '.')) {
|
||||||
key = 'dot'; // because '.' is used as a separator in event names
|
key = 'dot'; // because '.' is used as a separator in event names
|
||||||
}
|
}
|
||||||
ListWrapper.forEach(modifierKeys, (modifierName) => {
|
modifierKeys.forEach(modifierName => {
|
||||||
if (modifierName != key) {
|
if (modifierName != key) {
|
||||||
var modifierGetter = StringMapWrapper.get(modifierKeyGetters, modifierName);
|
var modifierGetter = StringMapWrapper.get(modifierKeyGetters, modifierName);
|
||||||
if (modifierGetter(event)) {
|
if (modifierGetter(event)) {
|
||||||
|
|
|
@ -10,7 +10,7 @@ function paramParser(rawParams: string = ''): Map<string, string[]> {
|
||||||
var map = new Map<string, string[]>();
|
var map = new Map<string, string[]>();
|
||||||
if (rawParams.length > 0) {
|
if (rawParams.length > 0) {
|
||||||
var params: string[] = StringWrapper.split(rawParams, new RegExp('&'));
|
var params: string[] = StringWrapper.split(rawParams, new RegExp('&'));
|
||||||
ListWrapper.forEach(params, (param: string) => {
|
params.forEach((param: string) => {
|
||||||
var split: string[] = StringWrapper.split(param, new RegExp('='));
|
var split: string[] = StringWrapper.split(param, new RegExp('='));
|
||||||
var key = split[0];
|
var key = split[0];
|
||||||
var val = split[1];
|
var val = split[1];
|
||||||
|
@ -127,9 +127,8 @@ export class URLSearchParams {
|
||||||
|
|
||||||
toString(): string {
|
toString(): string {
|
||||||
var paramsList = [];
|
var paramsList = [];
|
||||||
MapWrapper.forEach(this.paramsMap, (values, k) => {
|
MapWrapper.forEach(this.paramsMap,
|
||||||
ListWrapper.forEach(values, v => { paramsList.push(k + '=' + v); });
|
(values, k) => { values.forEach(v => paramsList.push(k + '=' + v)); });
|
||||||
});
|
|
||||||
return paramsList.join('&');
|
return paramsList.join('&');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import {
|
||||||
} from 'angular2/src/core/facade/lang';
|
} from 'angular2/src/core/facade/lang';
|
||||||
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
||||||
|
|
||||||
import {Map, MapWrapper, StringMapWrapper, ListWrapper} from 'angular2/src/core/facade/collection';
|
import {Map, MapWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection';
|
||||||
|
|
||||||
import {RouteHandler} from './route_handler';
|
import {RouteHandler} from './route_handler';
|
||||||
import {Url, RootUrl, serializeParams} from './url_parser';
|
import {Url, RootUrl, serializeParams} from './url_parser';
|
||||||
|
@ -35,7 +35,7 @@ class TouchMap {
|
||||||
getUnused(): {[key: string]: any} {
|
getUnused(): {[key: string]: any} {
|
||||||
var unused: {[key: string]: any} = StringMapWrapper.create();
|
var unused: {[key: string]: any} = StringMapWrapper.create();
|
||||||
var keys = StringMapWrapper.keys(this.keys);
|
var keys = StringMapWrapper.keys(this.keys);
|
||||||
ListWrapper.forEach(keys, (key) => { unused[key] = StringMapWrapper.get(this.map, key); });
|
keys.forEach(key => unused[key] = StringMapWrapper.get(this.map, key));
|
||||||
return unused;
|
return unused;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,8 @@ export class RouteRegistry {
|
||||||
var annotation = annotations[i];
|
var annotation = annotations[i];
|
||||||
|
|
||||||
if (annotation instanceof RouteConfig) {
|
if (annotation instanceof RouteConfig) {
|
||||||
ListWrapper.forEach(annotation.configs, (config) => this.config(component, config));
|
let routeCfgs: RouteDefinition[] = annotation.configs;
|
||||||
|
routeCfgs.forEach(config => this.config(component, config));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -427,7 +427,7 @@ export class Router {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rest[rest.length - 1] == '') {
|
if (rest[rest.length - 1] == '') {
|
||||||
ListWrapper.removeLast(rest);
|
rest.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rest.length < 1) {
|
if (rest.length < 1) {
|
||||||
|
|
|
@ -8,7 +8,7 @@ import {
|
||||||
ObservableWrapper,
|
ObservableWrapper,
|
||||||
EventEmitter
|
EventEmitter
|
||||||
} from "angular2/src/core/facade/async";
|
} from "angular2/src/core/facade/async";
|
||||||
import {ListWrapper, StringMapWrapper, MapWrapper} from "angular2/src/core/facade/collection";
|
import {StringMapWrapper, MapWrapper} from "angular2/src/core/facade/collection";
|
||||||
import {Serializer} from "angular2/src/web_workers/shared/serializer";
|
import {Serializer} from "angular2/src/web_workers/shared/serializer";
|
||||||
import {Injectable} from "angular2/src/core/di";
|
import {Injectable} from "angular2/src/core/di";
|
||||||
import {Type, StringWrapper} from "angular2/src/core/facade/lang";
|
import {Type, StringWrapper} from "angular2/src/core/facade/lang";
|
||||||
|
@ -58,7 +58,7 @@ export class ClientMessageBroker {
|
||||||
runOnService(args: UiArguments, returnType: Type): Promise<any> {
|
runOnService(args: UiArguments, returnType: Type): Promise<any> {
|
||||||
var fnArgs = [];
|
var fnArgs = [];
|
||||||
if (isPresent(args.args)) {
|
if (isPresent(args.args)) {
|
||||||
ListWrapper.forEach(args.args, (argument) => {
|
args.args.forEach(argument => {
|
||||||
if (argument.type != null) {
|
if (argument.type != null) {
|
||||||
fnArgs.push(this._serializer.serialize(argument.value, argument.type));
|
fnArgs.push(this._serializer.serialize(argument.value, argument.type));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -41,7 +41,7 @@ export class RenderViewWithFragmentsStore {
|
||||||
this._lookupByView.set(view.viewRef, startIndex);
|
this._lookupByView.set(view.viewRef, startIndex);
|
||||||
startIndex++;
|
startIndex++;
|
||||||
|
|
||||||
ListWrapper.forEach(view.fragmentRefs, (ref) => {
|
view.fragmentRefs.forEach(ref => {
|
||||||
this._lookupByIndex.set(startIndex, ref);
|
this._lookupByIndex.set(startIndex, ref);
|
||||||
this._lookupByView.set(ref, startIndex);
|
this._lookupByView.set(ref, startIndex);
|
||||||
startIndex++;
|
startIndex++;
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {
|
||||||
} from "angular2/src/core/facade/lang";
|
} from "angular2/src/core/facade/lang";
|
||||||
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
||||||
|
|
||||||
import {ListWrapper, Map, StringMapWrapper, MapWrapper} from "angular2/src/core/facade/collection";
|
import {Map, StringMapWrapper, MapWrapper} from "angular2/src/core/facade/collection";
|
||||||
import {
|
import {
|
||||||
RenderProtoViewRef,
|
RenderProtoViewRef,
|
||||||
RenderViewRef,
|
RenderViewRef,
|
||||||
|
@ -52,9 +52,7 @@ export class Serializer {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (isArray(obj)) {
|
if (isArray(obj)) {
|
||||||
var serializedObj = [];
|
return (<any[]>obj).map(v => this.serialize(v, type));
|
||||||
ListWrapper.forEach(obj, (val) => { serializedObj.push(this.serialize(val, type)); });
|
|
||||||
return serializedObj;
|
|
||||||
}
|
}
|
||||||
if (type == PRIMITIVE) {
|
if (type == PRIMITIVE) {
|
||||||
return obj;
|
return obj;
|
||||||
|
@ -80,7 +78,7 @@ export class Serializer {
|
||||||
}
|
}
|
||||||
if (isArray(map)) {
|
if (isArray(map)) {
|
||||||
var obj: any[] = [];
|
var obj: any[] = [];
|
||||||
ListWrapper.forEach(map, (val) => { obj.push(this.deserialize(val, type, data)); });
|
(<any[]>map).forEach(val => obj.push(this.deserialize(val, type, data)));
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
if (type == PRIMITIVE) {
|
if (type == PRIMITIVE) {
|
||||||
|
|
|
@ -22,7 +22,7 @@ import {
|
||||||
normalizeBool
|
normalizeBool
|
||||||
} from 'angular2/src/core/facade/lang';
|
} from 'angular2/src/core/facade/lang';
|
||||||
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
||||||
import {ListWrapper, MapWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection';
|
import {MapWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ChangeDispatcher,
|
ChangeDispatcher,
|
||||||
|
@ -67,7 +67,7 @@ const _DEFAULT_CONTEXT = CONST_EXPR(new Object());
|
||||||
* can be found in the generated/change_detector_classes library.
|
* can be found in the generated/change_detector_classes library.
|
||||||
*/
|
*/
|
||||||
export function main() {
|
export function main() {
|
||||||
ListWrapper.forEach(['dynamic', 'JIT', 'Pregen'], (cdType) => {
|
['dynamic', 'JIT', 'Pregen'].forEach(cdType => {
|
||||||
if (cdType == "JIT" && IS_DART) return;
|
if (cdType == "JIT" && IS_DART) return;
|
||||||
if (cdType == "Pregen" && !IS_DART) return;
|
if (cdType == "Pregen" && !IS_DART) return;
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@ import {
|
||||||
} from 'angular2/test_lib';
|
} from 'angular2/test_lib';
|
||||||
|
|
||||||
import {ObservableWrapper, EventEmitter, PromiseWrapper} from 'angular2/src/core/facade/async';
|
import {ObservableWrapper, EventEmitter, PromiseWrapper} from 'angular2/src/core/facade/async';
|
||||||
import {ListWrapper} from 'angular2/src/core/facade/collection';
|
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
describe('EventEmitter', () => {
|
describe('EventEmitter', () => {
|
||||||
|
@ -88,7 +87,7 @@ export function main() {
|
||||||
one.resolve('one');
|
one.resolve('one');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
ListWrapper.forEach([null, true, false, 10, 'thing', {}, []], (abruptCompletion) => {
|
[null, true, false, 10, 'thing', {}, []].forEach(abruptCompletion => {
|
||||||
it(`should treat "${abruptCompletion}" as an "abrupt completion"`,
|
it(`should treat "${abruptCompletion}" as an "abrupt completion"`,
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
var one = PromiseWrapper.completer();
|
var one = PromiseWrapper.completer();
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import {EventEmitter} from 'angular2/src/core/facade/async';
|
import {EventEmitter} from 'angular2/src/core/facade/async';
|
||||||
import {ListWrapper} from 'angular2/src/core/facade/collection';
|
|
||||||
|
|
||||||
export class MockEventEmitter extends EventEmitter {
|
export class MockEventEmitter extends EventEmitter {
|
||||||
private _nextFns: Function[] = [];
|
private _nextFns: Function[] = [];
|
||||||
|
@ -11,9 +10,7 @@ export class MockEventEmitter extends EventEmitter {
|
||||||
return new MockDisposable();
|
return new MockDisposable();
|
||||||
}
|
}
|
||||||
|
|
||||||
next(value: any) {
|
next(value: any) { this._nextFns.forEach(fn => fn(value)); }
|
||||||
ListWrapper.forEach(this._nextFns, (fn) => { fn(value); });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class MockDisposable {
|
class MockDisposable {
|
||||||
|
|
|
@ -12,7 +12,6 @@ import {
|
||||||
|
|
||||||
import {isPresent, StringWrapper, NumberWrapper} from 'angular2/src/core/facade/lang';
|
import {isPresent, StringWrapper, NumberWrapper} from 'angular2/src/core/facade/lang';
|
||||||
import {ObservableWrapper, EventEmitter} from 'angular2/src/core/facade/async';
|
import {ObservableWrapper, EventEmitter} from 'angular2/src/core/facade/async';
|
||||||
import {ListWrapper} from 'angular2/src/core/facade/collection';
|
|
||||||
import {Event, KeyboardEvent} from 'angular2/src/core/facade/browser';
|
import {Event, KeyboardEvent} from 'angular2/src/core/facade/browser';
|
||||||
|
|
||||||
import {MdRadioDispatcher} from 'angular2_material/src/components/radio/radio_dispatcher';
|
import {MdRadioDispatcher} from 'angular2_material/src/components/radio/radio_dispatcher';
|
||||||
|
@ -111,7 +110,7 @@ export class MdRadioGroup implements OnChanges {
|
||||||
// child radio buttons and select the one that has a corresponding value (if any).
|
// child radio buttons and select the one that has a corresponding value (if any).
|
||||||
if (isPresent(this.value) && this.value != '') {
|
if (isPresent(this.value) && this.value != '') {
|
||||||
this.radioDispatcher.notify(this.name_);
|
this.radioDispatcher.notify(this.name_);
|
||||||
ListWrapper.forEach(this.radios_, (radio) => {
|
this.radios_.forEach(radio => {
|
||||||
if (radio.value == this.value) {
|
if (radio.value == this.value) {
|
||||||
radio.checked = true;
|
radio.checked = true;
|
||||||
this.selectedRadioId = radio.id;
|
this.selectedRadioId = radio.id;
|
||||||
|
|
|
@ -69,7 +69,7 @@ class MultiplyViewResolver extends ViewResolver {
|
||||||
constructor(multiple: number, components: Type[]) {
|
constructor(multiple: number, components: Type[]) {
|
||||||
super();
|
super();
|
||||||
this._multiplyBy = multiple;
|
this._multiplyBy = multiple;
|
||||||
ListWrapper.forEach(components, (c) => this._fillCache(c));
|
components.forEach(c => this._fillCache(c));
|
||||||
}
|
}
|
||||||
|
|
||||||
_fillCache(component: Type) {
|
_fillCache(component: Type) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {bind, Binding, Injector, OpaqueToken} from 'angular2/src/core/di';
|
import {bind, Binding, Injector, OpaqueToken} from 'angular2/src/core/di';
|
||||||
import {ListWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection';
|
import {StringMapWrapper} from 'angular2/src/core/facade/collection';
|
||||||
import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async';
|
import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async';
|
||||||
|
|
||||||
import {Metric} from '../metric';
|
import {Metric} from '../metric';
|
||||||
|
@ -42,11 +42,10 @@ export class MultiMetric extends Metric {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function mergeStringMaps(maps): Object {
|
function mergeStringMaps(maps: any[]): Object {
|
||||||
var result = {};
|
var result = {};
|
||||||
ListWrapper.forEach(maps, (map) => {
|
maps.forEach(
|
||||||
StringMapWrapper.forEach(map, (value, prop) => { result[prop] = value; });
|
map => { StringMapWrapper.forEach(map, (value, prop) => { result[prop] = value; }); });
|
||||||
});
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -142,9 +142,9 @@ export class PerflogMetric extends Metric {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_addEvents(events) {
|
_addEvents(events: any[]) {
|
||||||
var needSort = false;
|
var needSort = false;
|
||||||
ListWrapper.forEach(events, (event) => {
|
events.forEach(event => {
|
||||||
if (StringWrapper.equals(event['ph'], 'X')) {
|
if (StringWrapper.equals(event['ph'], 'X')) {
|
||||||
needSort = true;
|
needSort = true;
|
||||||
var startEvent = {};
|
var startEvent = {};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {StringMapWrapper, ListWrapper} from 'angular2/src/core/facade/collection';
|
import {StringMapWrapper} from 'angular2/src/core/facade/collection';
|
||||||
import {bind, Binding, OpaqueToken} from 'angular2/src/core/di';
|
import {bind, Binding, OpaqueToken} from 'angular2/src/core/di';
|
||||||
import {Validator} from './validator';
|
import {Validator} from './validator';
|
||||||
import {Metric} from './metric';
|
import {Metric} from './metric';
|
||||||
|
@ -15,7 +15,7 @@ export class SampleDescription {
|
||||||
constructor(public id: string, descriptions: Array<{[key: string]: any}>,
|
constructor(public id: string, descriptions: Array<{[key: string]: any}>,
|
||||||
public metrics: {[key: string]: any}) {
|
public metrics: {[key: string]: any}) {
|
||||||
this.description = {};
|
this.description = {};
|
||||||
ListWrapper.forEach(descriptions, (description) => {
|
descriptions.forEach(description => {
|
||||||
StringMapWrapper.forEach(description, (value, prop) => this.description[prop] = value);
|
StringMapWrapper.forEach(description, (value, prop) => this.description[prop] = value);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,22 @@
|
||||||
import {Math} from 'angular2/src/core/facade/math';
|
import {Math} from 'angular2/src/core/facade/math';
|
||||||
import {ListWrapper} from 'angular2/src/core/facade/collection';
|
|
||||||
|
|
||||||
export class Statistic {
|
export class Statistic {
|
||||||
static calculateCoefficientOfVariation(sample, mean) {
|
static calculateCoefficientOfVariation(sample, mean) {
|
||||||
return Statistic.calculateStandardDeviation(sample, mean) / mean * 100;
|
return Statistic.calculateStandardDeviation(sample, mean) / mean * 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
static calculateMean(sample) {
|
static calculateMean(samples: any[]) {
|
||||||
var total = 0;
|
var total = 0;
|
||||||
ListWrapper.forEach(sample, (x) => {total += x});
|
// TODO: use reduce
|
||||||
return total / sample.length;
|
samples.forEach(x => total += x);
|
||||||
|
return total / samples.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
static calculateStandardDeviation(sample, mean) {
|
static calculateStandardDeviation(samples: any[], mean) {
|
||||||
var deviation = 0;
|
var deviation = 0;
|
||||||
ListWrapper.forEach(sample, (x) => { deviation += Math.pow(x - mean, 2); });
|
// TODO: use reduce
|
||||||
deviation = deviation / (sample.length);
|
samples.forEach(x => deviation += Math.pow(x - mean, 2));
|
||||||
|
deviation = deviation / (samples.length);
|
||||||
deviation = Math.sqrt(deviation);
|
deviation = Math.sqrt(deviation);
|
||||||
return deviation;
|
return deviation;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ import {bind, Binding, Injector, OpaqueToken} from 'angular2/src/core/di';
|
||||||
import {isBlank, isPresent} from 'angular2/src/core/facade/lang';
|
import {isBlank, isPresent} from 'angular2/src/core/facade/lang';
|
||||||
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
||||||
import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async';
|
import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async';
|
||||||
import {ListWrapper} from 'angular2/src/core/facade/collection';
|
|
||||||
|
|
||||||
import {Options} from './common_options';
|
import {Options} from './common_options';
|
||||||
|
|
||||||
|
@ -20,9 +19,9 @@ export abstract class WebDriverExtension {
|
||||||
[Injector]),
|
[Injector]),
|
||||||
bind(WebDriverExtension)
|
bind(WebDriverExtension)
|
||||||
.toFactory(
|
.toFactory(
|
||||||
(children, capabilities) => {
|
(children: WebDriverExtension[], capabilities) => {
|
||||||
var delegate;
|
var delegate;
|
||||||
ListWrapper.forEach(children, (extension) => {
|
children.forEach(extension => {
|
||||||
if (extension.supports(capabilities)) {
|
if (extension.supports(capabilities)) {
|
||||||
delegate = extension;
|
delegate = extension;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ export class ChromeDriverExtension extends WebDriverExtension {
|
||||||
.then((_) => this._driver.logs('performance'))
|
.then((_) => this._driver.logs('performance'))
|
||||||
.then((entries) => {
|
.then((entries) => {
|
||||||
var events = [];
|
var events = [];
|
||||||
ListWrapper.forEach(entries, function(entry) {
|
entries.forEach(entry => {
|
||||||
var message = Json.parse(entry['message'])['message'];
|
var message = Json.parse(entry['message'])['message'];
|
||||||
if (StringWrapper.equals(message['method'], 'Tracing.dataCollected')) {
|
if (StringWrapper.equals(message['method'], 'Tracing.dataCollected')) {
|
||||||
events.push(message['params']);
|
events.push(message['params']);
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import {bind, Binding} from 'angular2/src/core/di';
|
import {bind, Binding} from 'angular2/src/core/di';
|
||||||
import {ListWrapper} from 'angular2/src/core/facade/collection';
|
|
||||||
import {
|
import {
|
||||||
Json,
|
Json,
|
||||||
isPresent,
|
isPresent,
|
||||||
|
@ -41,7 +40,7 @@ export class IOsDriverExtension extends WebDriverExtension {
|
||||||
.then((_) => this._driver.logs('performance'))
|
.then((_) => this._driver.logs('performance'))
|
||||||
.then((entries) => {
|
.then((entries) => {
|
||||||
var records = [];
|
var records = [];
|
||||||
ListWrapper.forEach(entries, function(entry) {
|
entries.forEach(entry => {
|
||||||
var message = Json.parse(entry['message'])['message'];
|
var message = Json.parse(entry['message'])['message'];
|
||||||
if (StringWrapper.equals(message['method'], 'Timeline.eventRecorded')) {
|
if (StringWrapper.equals(message['method'], 'Timeline.eventRecorded')) {
|
||||||
records.push(message['params']['record']);
|
records.push(message['params']['record']);
|
||||||
|
|
|
@ -11,7 +11,7 @@ import {
|
||||||
xit,
|
xit,
|
||||||
} from 'angular2/test_lib';
|
} from 'angular2/test_lib';
|
||||||
|
|
||||||
import {ListWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection';
|
import {StringMapWrapper} from 'angular2/src/core/facade/collection';
|
||||||
import {PromiseWrapper, Promise} from 'angular2/src/core/facade/async';
|
import {PromiseWrapper, Promise} from 'angular2/src/core/facade/async';
|
||||||
import {isPresent, isBlank} from 'angular2/src/core/facade/lang';
|
import {isPresent, isBlank} from 'angular2/src/core/facade/lang';
|
||||||
|
|
||||||
|
@ -325,7 +325,7 @@ export function main() {
|
||||||
describe('aggregation', () => {
|
describe('aggregation', () => {
|
||||||
|
|
||||||
function aggregate(events: any[], microMetrics = null, captureFrames = null) {
|
function aggregate(events: any[], microMetrics = null, captureFrames = null) {
|
||||||
ListWrapper.insert(events, 0, eventFactory.markStart('benchpress0', 0));
|
events.unshift(eventFactory.markStart('benchpress0', 0));
|
||||||
events.push(eventFactory.markEnd('benchpress0', 10));
|
events.push(eventFactory.markEnd('benchpress0', 10));
|
||||||
var metric = createMetric([events], microMetrics, null, null, captureFrames);
|
var metric = createMetric([events], microMetrics, null, null, captureFrames);
|
||||||
return metric.beginMeasure().then((_) => metric.endMeasure(false));
|
return metric.beginMeasure().then((_) => metric.endMeasure(false));
|
||||||
|
@ -662,7 +662,7 @@ class MockDriverExtension extends WebDriverExtension {
|
||||||
this._commandLog.push('readPerfLog');
|
this._commandLog.push('readPerfLog');
|
||||||
if (this._perfLogs.length > 0) {
|
if (this._perfLogs.length > 0) {
|
||||||
var next = this._perfLogs[0];
|
var next = this._perfLogs[0];
|
||||||
ListWrapper.removeAt(this._perfLogs, 0);
|
this._perfLogs.shift();
|
||||||
return PromiseWrapper.resolve(next);
|
return PromiseWrapper.resolve(next);
|
||||||
} else {
|
} else {
|
||||||
return PromiseWrapper.resolve([]);
|
return PromiseWrapper.resolve([]);
|
||||||
|
|
Loading…
Reference in New Issue