chore: kill ListWrapper.create() and .push().
These wrappers are not natively understood by ts2dart. Removing them will improve Dart2JS compilation due to fewer megamorphic calls to List functions. It also makes Angular code more succinct and improves type safety in Angular due to better type inference of the Array component type. This change exposed several bugs in Angular.
This commit is contained in:
@ -17,14 +17,14 @@ export class AbstractChangeDetector extends ChangeDetector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addChild(cd: ChangeDetector): void {
|
addChild(cd: ChangeDetector): void {
|
||||||
ListWrapper.push(this.lightDomChildren, cd);
|
this.lightDomChildren.push(cd);
|
||||||
cd.parent = this;
|
cd.parent = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
removeChild(cd: ChangeDetector): void { ListWrapper.remove(this.lightDomChildren, cd); }
|
removeChild(cd: ChangeDetector): void { ListWrapper.remove(this.lightDomChildren, cd); }
|
||||||
|
|
||||||
addShadowDomChild(cd: ChangeDetector): void {
|
addShadowDomChild(cd: ChangeDetector): void {
|
||||||
ListWrapper.push(this.shadowDomChildren, cd);
|
this.shadowDomChildren.push(cd);
|
||||||
cd.parent = this;
|
cd.parent = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ import {RecordType, ProtoRecord} from './proto_record';
|
|||||||
* replaced with very cheap SELF records.
|
* replaced with very cheap SELF records.
|
||||||
*/
|
*/
|
||||||
export function coalesce(records: List<ProtoRecord>): List<ProtoRecord> {
|
export function coalesce(records: List<ProtoRecord>): List<ProtoRecord> {
|
||||||
var res: List<ProtoRecord> = ListWrapper.create();
|
var res: List<ProtoRecord> = [];
|
||||||
var indexMap: Map<number, number> = MapWrapper.create();
|
var indexMap: Map<number, number> = MapWrapper.create();
|
||||||
|
|
||||||
for (var i = 0; i < records.length; ++i) {
|
for (var i = 0; i < records.length; ++i) {
|
||||||
@ -22,14 +22,14 @@ export function coalesce(records: List<ProtoRecord>): List<ProtoRecord> {
|
|||||||
var matchingRecord = _findMatching(record, res);
|
var matchingRecord = _findMatching(record, res);
|
||||||
|
|
||||||
if (isPresent(matchingRecord) && record.lastInBinding) {
|
if (isPresent(matchingRecord) && record.lastInBinding) {
|
||||||
ListWrapper.push(res, _selfRecord(record, matchingRecord.selfIndex, res.length + 1));
|
res.push(_selfRecord(record, matchingRecord.selfIndex, res.length + 1));
|
||||||
MapWrapper.set(indexMap, r.selfIndex, matchingRecord.selfIndex);
|
MapWrapper.set(indexMap, r.selfIndex, matchingRecord.selfIndex);
|
||||||
|
|
||||||
} else if (isPresent(matchingRecord) && !record.lastInBinding) {
|
} else if (isPresent(matchingRecord) && !record.lastInBinding) {
|
||||||
MapWrapper.set(indexMap, r.selfIndex, matchingRecord.selfIndex);
|
MapWrapper.set(indexMap, r.selfIndex, matchingRecord.selfIndex);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ListWrapper.push(res, record);
|
res.push(record);
|
||||||
MapWrapper.set(indexMap, r.selfIndex, record.selfIndex);
|
MapWrapper.set(indexMap, r.selfIndex, record.selfIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ enum TokenType {
|
|||||||
var tokens = [];
|
var tokens = [];
|
||||||
var token = scanner.scanToken();
|
var token = scanner.scanToken();
|
||||||
while (token != null) {
|
while (token != null) {
|
||||||
ListWrapper.push(tokens, token);
|
tokens.push(token);
|
||||||
token = scanner.scanToken();
|
token = scanner.scanToken();
|
||||||
}
|
}
|
||||||
return tokens;
|
return tokens;
|
||||||
|
@ -99,11 +99,11 @@ export class Parser {
|
|||||||
var part = parts[i];
|
var part = parts[i];
|
||||||
if (i % 2 === 0) {
|
if (i % 2 === 0) {
|
||||||
// fixed string
|
// fixed string
|
||||||
ListWrapper.push(strings, part);
|
strings.push(part);
|
||||||
} else {
|
} else {
|
||||||
var tokens = this._lexer.tokenize(part);
|
var tokens = this._lexer.tokenize(part);
|
||||||
var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseChain();
|
var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseChain();
|
||||||
ListWrapper.push(expressions, ast);
|
expressions.push(ast);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new ASTWithSource(new Interpolation(strings, expressions), input, location);
|
return new ASTWithSource(new Interpolation(strings, expressions), input, location);
|
||||||
@ -194,7 +194,7 @@ class _ParseAST {
|
|||||||
var exprs = [];
|
var exprs = [];
|
||||||
while (this.index < this.tokens.length) {
|
while (this.index < this.tokens.length) {
|
||||||
var expr = this.parsePipe();
|
var expr = this.parsePipe();
|
||||||
ListWrapper.push(exprs, expr);
|
exprs.push(expr);
|
||||||
|
|
||||||
if (this.optionalCharacter($SEMICOLON)) {
|
if (this.optionalCharacter($SEMICOLON)) {
|
||||||
if (!this.parseAction) {
|
if (!this.parseAction) {
|
||||||
@ -222,7 +222,7 @@ class _ParseAST {
|
|||||||
var name = this.expectIdentifierOrKeyword();
|
var name = this.expectIdentifierOrKeyword();
|
||||||
var args = [];
|
var args = [];
|
||||||
while (this.optionalCharacter($COLON)) {
|
while (this.optionalCharacter($COLON)) {
|
||||||
ListWrapper.push(args, this.parsePipe());
|
args.push(this.parsePipe());
|
||||||
}
|
}
|
||||||
result = new Pipe(result, name, args, true);
|
result = new Pipe(result, name, args, true);
|
||||||
} while (this.optionalOperator("|"));
|
} while (this.optionalOperator("|"));
|
||||||
@ -456,7 +456,7 @@ class _ParseAST {
|
|||||||
var result = [];
|
var result = [];
|
||||||
if (!this.next.isCharacter(terminator)) {
|
if (!this.next.isCharacter(terminator)) {
|
||||||
do {
|
do {
|
||||||
ListWrapper.push(result, this.parsePipe());
|
result.push(this.parsePipe());
|
||||||
} while (this.optionalCharacter($COMMA));
|
} while (this.optionalCharacter($COMMA));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -469,9 +469,9 @@ class _ParseAST {
|
|||||||
if (!this.optionalCharacter($RBRACE)) {
|
if (!this.optionalCharacter($RBRACE)) {
|
||||||
do {
|
do {
|
||||||
var key = this.expectIdentifierOrKeywordOrString();
|
var key = this.expectIdentifierOrKeywordOrString();
|
||||||
ListWrapper.push(keys, key);
|
keys.push(key);
|
||||||
this.expectCharacter($COLON);
|
this.expectCharacter($COLON);
|
||||||
ListWrapper.push(values, this.parsePipe());
|
values.push(this.parsePipe());
|
||||||
} while (this.optionalCharacter($COMMA));
|
} while (this.optionalCharacter($COMMA));
|
||||||
this.expectCharacter($RBRACE);
|
this.expectCharacter($RBRACE);
|
||||||
}
|
}
|
||||||
@ -500,7 +500,7 @@ class _ParseAST {
|
|||||||
if (this.next.isCharacter($RPAREN)) return [];
|
if (this.next.isCharacter($RPAREN)) return [];
|
||||||
var positionals = [];
|
var positionals = [];
|
||||||
do {
|
do {
|
||||||
ListWrapper.push(positionals, this.parsePipe());
|
positionals.push(this.parsePipe());
|
||||||
} while (this.optionalCharacter($COMMA));
|
} while (this.optionalCharacter($COMMA));
|
||||||
return positionals;
|
return positionals;
|
||||||
}
|
}
|
||||||
@ -522,7 +522,7 @@ class _ParseAST {
|
|||||||
var exprs = [];
|
var exprs = [];
|
||||||
while (this.index < this.tokens.length && !this.next.isCharacter($RBRACE)) {
|
while (this.index < this.tokens.length && !this.next.isCharacter($RBRACE)) {
|
||||||
var expr = this.parseExpression();
|
var expr = this.parseExpression();
|
||||||
ListWrapper.push(exprs, expr);
|
exprs.push(expr);
|
||||||
|
|
||||||
if (this.optionalCharacter($SEMICOLON)) {
|
if (this.optionalCharacter($SEMICOLON)) {
|
||||||
while (this.optionalCharacter($SEMICOLON)) {
|
while (this.optionalCharacter($SEMICOLON)) {
|
||||||
@ -581,7 +581,7 @@ class _ParseAST {
|
|||||||
var source = this.input.substring(start, this.inputIndex);
|
var source = this.input.substring(start, this.inputIndex);
|
||||||
expression = new ASTWithSource(ast, source, this.location);
|
expression = new ASTWithSource(ast, source, this.location);
|
||||||
}
|
}
|
||||||
ListWrapper.push(bindings, new TemplateBinding(key, keyIsVar, name, expression));
|
bindings.push(new TemplateBinding(key, keyIsVar, name, expression));
|
||||||
if (!this.optionalCharacter($SEMICOLON)) {
|
if (!this.optionalCharacter($SEMICOLON)) {
|
||||||
this.optionalCharacter($COMMA);
|
this.optionalCharacter($COMMA);
|
||||||
}
|
}
|
||||||
|
@ -448,26 +448,26 @@ export class IterableChanges extends Pipe {
|
|||||||
|
|
||||||
var list = [];
|
var list = [];
|
||||||
for (record = this._itHead; record !== null; record = record._next) {
|
for (record = this._itHead; record !== null; record = record._next) {
|
||||||
ListWrapper.push(list, record);
|
list.push(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
var previous = [];
|
var previous = [];
|
||||||
for (record = this._previousItHead; record !== null; record = record._nextPrevious) {
|
for (record = this._previousItHead; record !== null; record = record._nextPrevious) {
|
||||||
ListWrapper.push(previous, record);
|
previous.push(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
var additions = [];
|
var additions = [];
|
||||||
for (record = this._additionsHead; record !== null; record = record._nextAdded) {
|
for (record = this._additionsHead; record !== null; record = record._nextAdded) {
|
||||||
ListWrapper.push(additions, record);
|
additions.push(record);
|
||||||
}
|
}
|
||||||
var moves = [];
|
var moves = [];
|
||||||
for (record = this._movesHead; record !== null; record = record._nextMoved) {
|
for (record = this._movesHead; record !== null; record = record._nextMoved) {
|
||||||
ListWrapper.push(moves, record);
|
moves.push(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
var removals = [];
|
var removals = [];
|
||||||
for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
|
for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
|
||||||
ListWrapper.push(removals, record);
|
removals.push(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
return "collection: " + list.join(', ') + "\n" + "previous: " + previous.join(', ') + "\n" +
|
return "collection: " + list.join(', ') + "\n" + "previous: " + previous.join(', ') + "\n" +
|
||||||
|
@ -299,19 +299,19 @@ export class KeyValueChanges extends Pipe {
|
|||||||
var record: KVChangeRecord;
|
var record: KVChangeRecord;
|
||||||
|
|
||||||
for (record = this._mapHead; record !== null; record = record._next) {
|
for (record = this._mapHead; record !== null; record = record._next) {
|
||||||
ListWrapper.push(items, stringify(record));
|
items.push(stringify(record));
|
||||||
}
|
}
|
||||||
for (record = this._previousMapHead; record !== null; record = record._nextPrevious) {
|
for (record = this._previousMapHead; record !== null; record = record._nextPrevious) {
|
||||||
ListWrapper.push(previous, stringify(record));
|
previous.push(stringify(record));
|
||||||
}
|
}
|
||||||
for (record = this._changesHead; record !== null; record = record._nextChanged) {
|
for (record = this._changesHead; record !== null; record = record._nextChanged) {
|
||||||
ListWrapper.push(changes, stringify(record));
|
changes.push(stringify(record));
|
||||||
}
|
}
|
||||||
for (record = this._additionsHead; record !== null; record = record._nextAdded) {
|
for (record = this._additionsHead; record !== null; record = record._nextAdded) {
|
||||||
ListWrapper.push(additions, stringify(record));
|
additions.push(stringify(record));
|
||||||
}
|
}
|
||||||
for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
|
for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
|
||||||
ListWrapper.push(removals, stringify(record));
|
removals.push(stringify(record));
|
||||||
}
|
}
|
||||||
|
|
||||||
return "map: " + items.join(', ') + "\n" + "previous: " + previous.join(', ') + "\n" +
|
return "map: " + items.join(', ') + "\n" + "previous: " + previous.join(', ') + "\n" +
|
||||||
|
@ -82,10 +82,9 @@ export class ProtoRecordBuilder {
|
|||||||
|
|
||||||
_appendRecords(b: BindingRecord, variableNames: List<string>) {
|
_appendRecords(b: BindingRecord, variableNames: List<string>) {
|
||||||
if (b.isDirectiveLifecycle()) {
|
if (b.isDirectiveLifecycle()) {
|
||||||
ListWrapper.push(
|
this.records.push(new ProtoRecord(RecordType.DIRECTIVE_LIFECYCLE, b.lifecycleEvent, null, [],
|
||||||
this.records,
|
[], -1, null, this.records.length + 1, b, null, false,
|
||||||
new ProtoRecord(RecordType.DIRECTIVE_LIFECYCLE, b.lifecycleEvent, null, [], [], -1, null,
|
false));
|
||||||
this.records.length + 1, b, null, false, false));
|
|
||||||
} else {
|
} else {
|
||||||
_ConvertAstIntoProtoRecords.append(this.records, b, variableNames);
|
_ConvertAstIntoProtoRecords.append(this.records, b, variableNames);
|
||||||
}
|
}
|
||||||
@ -215,13 +214,13 @@ class _ConvertAstIntoProtoRecords implements AstVisitor {
|
|||||||
_addRecord(type, name, funcOrValue, args, fixedArgs, context) {
|
_addRecord(type, name, funcOrValue, args, fixedArgs, context) {
|
||||||
var selfIndex = this._records.length + 1;
|
var selfIndex = this._records.length + 1;
|
||||||
if (context instanceof DirectiveIndex) {
|
if (context instanceof DirectiveIndex) {
|
||||||
ListWrapper.push(this._records, new ProtoRecord(type, name, funcOrValue, args, fixedArgs, -1,
|
this._records.push(new ProtoRecord(type, name, funcOrValue, args, fixedArgs, -1, context,
|
||||||
context, selfIndex, this._bindingRecord,
|
selfIndex, this._bindingRecord, this._expressionAsString,
|
||||||
this._expressionAsString, false, false));
|
false, false));
|
||||||
} else {
|
} else {
|
||||||
ListWrapper.push(this._records, new ProtoRecord(type, name, funcOrValue, args, fixedArgs,
|
this._records.push(new ProtoRecord(type, name, funcOrValue, args, fixedArgs, context, null,
|
||||||
context, null, selfIndex, this._bindingRecord,
|
selfIndex, this._bindingRecord, this._expressionAsString,
|
||||||
this._expressionAsString, false, false));
|
false, false));
|
||||||
}
|
}
|
||||||
return selfIndex;
|
return selfIndex;
|
||||||
}
|
}
|
||||||
|
@ -342,9 +342,9 @@ export class ApplicationRef {
|
|||||||
function _createAppInjector(appComponentType: Type, bindings: List<Type | Binding | List<any>>,
|
function _createAppInjector(appComponentType: Type, bindings: List<Type | Binding | List<any>>,
|
||||||
zone: NgZone): Injector {
|
zone: NgZone): Injector {
|
||||||
if (isBlank(_rootInjector)) _rootInjector = Injector.resolveAndCreate(_rootBindings);
|
if (isBlank(_rootInjector)) _rootInjector = Injector.resolveAndCreate(_rootBindings);
|
||||||
var mergedBindings = isPresent(bindings) ?
|
var mergedBindings: any[] =
|
||||||
ListWrapper.concat(_injectorBindings(appComponentType), bindings) :
|
isPresent(bindings) ? ListWrapper.concat(_injectorBindings(appComponentType), bindings) :
|
||||||
_injectorBindings(appComponentType);
|
_injectorBindings(appComponentType);
|
||||||
ListWrapper.push(mergedBindings, bind(NgZone).toValue(zone));
|
mergedBindings.push(bind(NgZone).toValue(zone));
|
||||||
return _rootInjector.resolveAndCreateChild(mergedBindings);
|
return _rootInjector.resolveAndCreateChild(mergedBindings);
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ export class BaseQueryList<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
add(obj) {
|
add(obj) {
|
||||||
ListWrapper.push(this._results, obj);
|
this._results.push(obj);
|
||||||
this._dirty = true;
|
this._dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ export class BaseQueryList<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onChange(callback) { ListWrapper.push(this._callbacks, callback); }
|
onChange(callback) { this._callbacks.push(callback); }
|
||||||
|
|
||||||
removeCallback(callback) { ListWrapper.remove(this._callbacks, callback); }
|
removeCallback(callback) { ListWrapper.remove(this._callbacks, callback); }
|
||||||
|
|
||||||
|
@ -187,8 +187,7 @@ export class Compiler {
|
|||||||
(nestedPv: AppProtoView) => { elementBinder.nestedProtoView = nestedPv; };
|
(nestedPv: AppProtoView) => { elementBinder.nestedProtoView = nestedPv; };
|
||||||
var nestedCall = this._compile(nestedComponent);
|
var nestedCall = this._compile(nestedComponent);
|
||||||
if (isPromise(nestedCall)) {
|
if (isPromise(nestedCall)) {
|
||||||
ListWrapper.push(nestedPVPromises,
|
nestedPVPromises.push((<Promise<AppProtoView>>nestedCall).then(elementBinderDone));
|
||||||
(<Promise<AppProtoView>>nestedCall).then(elementBinderDone));
|
|
||||||
} else {
|
} else {
|
||||||
elementBinderDone(<AppProtoView>nestedCall);
|
elementBinderDone(<AppProtoView>nestedCall);
|
||||||
}
|
}
|
||||||
@ -206,7 +205,7 @@ export class Compiler {
|
|||||||
ListWrapper.forEach(protoViews, (protoView) => {
|
ListWrapper.forEach(protoViews, (protoView) => {
|
||||||
ListWrapper.forEach(protoView.elementBinders, (elementBinder) => {
|
ListWrapper.forEach(protoView.elementBinders, (elementBinder) => {
|
||||||
if (isPresent(elementBinder.componentDirective)) {
|
if (isPresent(elementBinder.componentDirective)) {
|
||||||
ListWrapper.push(componentElementBinders, elementBinder);
|
componentElementBinders.push(elementBinder);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -254,7 +253,7 @@ export class Compiler {
|
|||||||
if (isArray(item)) {
|
if (isArray(item)) {
|
||||||
this._flattenList(item, out);
|
this._flattenList(item, out);
|
||||||
} else {
|
} else {
|
||||||
ListWrapper.push(out, item);
|
out.push(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,7 @@ export class TreeNode<T extends TreeNode<any>> {
|
|||||||
var res = [];
|
var res = [];
|
||||||
var child = this._head;
|
var child = this._head;
|
||||||
while (child != null) {
|
while (child != null) {
|
||||||
ListWrapper.push(res, child);
|
res.push(child);
|
||||||
child = child._next;
|
child = child._next;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
@ -285,7 +285,7 @@ export class DirectiveBinding extends ResolvedBinding {
|
|||||||
var readAttributes = [];
|
var readAttributes = [];
|
||||||
ListWrapper.forEach(deps, (dep) => {
|
ListWrapper.forEach(deps, (dep) => {
|
||||||
if (isPresent(dep.attributeName)) {
|
if (isPresent(dep.attributeName)) {
|
||||||
ListWrapper.push(readAttributes, dep.attributeName);
|
readAttributes.push(dep.attributeName);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return readAttributes;
|
return readAttributes;
|
||||||
@ -357,10 +357,9 @@ export class BindingData {
|
|||||||
if (!(this.binding instanceof DirectiveBinding)) return [];
|
if (!(this.binding instanceof DirectiveBinding)) return [];
|
||||||
var res = [];
|
var res = [];
|
||||||
var db = <DirectiveBinding>this.binding;
|
var db = <DirectiveBinding>this.binding;
|
||||||
MapWrapper.forEach(
|
MapWrapper.forEach(db.hostActions, (actionExpression, actionName) => {
|
||||||
db.hostActions,
|
res.push(new HostActionAccessor(actionExpression, reflector.getter(actionName)));
|
||||||
(actionExpression, actionName) => {ListWrapper.push(
|
});
|
||||||
res, new HostActionAccessor(actionExpression, reflector.getter(actionName)))});
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -409,8 +408,8 @@ export class ProtoElementInjector {
|
|||||||
bd: List<BindingData>,
|
bd: List<BindingData>,
|
||||||
firstBindingIsComponent: boolean) {
|
firstBindingIsComponent: boolean) {
|
||||||
ListWrapper.forEach(dirBindings, dirBinding => {
|
ListWrapper.forEach(dirBindings, dirBinding => {
|
||||||
ListWrapper.push(bd, ProtoElementInjector._createBindingData(
|
bd.push(ProtoElementInjector._createBindingData(firstBindingIsComponent, dirBinding,
|
||||||
firstBindingIsComponent, dirBinding, dirBindings, dirBinding));
|
dirBindings, dirBinding));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -425,9 +424,9 @@ export class ProtoElementInjector {
|
|||||||
`Multiple directives defined the same host injectable: "${stringify(b.key.token)}"`);
|
`Multiple directives defined the same host injectable: "${stringify(b.key.token)}"`);
|
||||||
}
|
}
|
||||||
MapWrapper.set(visitedIds, b.key.id, true);
|
MapWrapper.set(visitedIds, b.key.id, true);
|
||||||
ListWrapper.push(bd, ProtoElementInjector._createBindingData(
|
bd.push(ProtoElementInjector._createBindingData(firstBindingIsComponent, dirBinding,
|
||||||
firstBindingIsComponent, dirBinding, dirBindings,
|
dirBindings,
|
||||||
ProtoElementInjector._createBinding(b)));
|
ProtoElementInjector._createBinding(b)));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -442,8 +441,7 @@ export class ProtoElementInjector {
|
|||||||
var db = <DirectiveBinding>bindings[0];
|
var db = <DirectiveBinding>bindings[0];
|
||||||
ListWrapper.forEach(
|
ListWrapper.forEach(
|
||||||
db.resolvedViewInjectables,
|
db.resolvedViewInjectables,
|
||||||
b => ListWrapper.push(bd,
|
b => bd.push(new BindingData(ProtoElementInjector._createBinding(b), SHADOW_DOM)));
|
||||||
new BindingData(ProtoElementInjector._createBinding(b), SHADOW_DOM)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static _createBinding(b: ResolvedBinding) {
|
private static _createBinding(b: ResolvedBinding) {
|
||||||
@ -963,15 +961,15 @@ export class ElementInjector extends TreeNode<ElementInjector> {
|
|||||||
var queriesToUpdate = [];
|
var queriesToUpdate = [];
|
||||||
if (isPresent(this.parent._query0)) {
|
if (isPresent(this.parent._query0)) {
|
||||||
this._pruneQueryFromTree(this.parent._query0);
|
this._pruneQueryFromTree(this.parent._query0);
|
||||||
ListWrapper.push(queriesToUpdate, this.parent._query0);
|
queriesToUpdate.push(this.parent._query0);
|
||||||
}
|
}
|
||||||
if (isPresent(this.parent._query1)) {
|
if (isPresent(this.parent._query1)) {
|
||||||
this._pruneQueryFromTree(this.parent._query1);
|
this._pruneQueryFromTree(this.parent._query1);
|
||||||
ListWrapper.push(queriesToUpdate, this.parent._query1);
|
queriesToUpdate.push(this.parent._query1);
|
||||||
}
|
}
|
||||||
if (isPresent(this.parent._query2)) {
|
if (isPresent(this.parent._query2)) {
|
||||||
this._pruneQueryFromTree(this.parent._query2);
|
this._pruneQueryFromTree(this.parent._query2);
|
||||||
ListWrapper.push(queriesToUpdate, this.parent._query2);
|
queriesToUpdate.push(this.parent._query2);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.remove();
|
this.remove();
|
||||||
@ -1454,10 +1452,10 @@ class QueryRef {
|
|||||||
this.list.reset(aggregator);
|
this.list.reset(aggregator);
|
||||||
}
|
}
|
||||||
|
|
||||||
visit(inj: ElementInjector, aggregator): void {
|
visit(inj: ElementInjector, aggregator: any[]): void {
|
||||||
if (isBlank(inj) || !inj._hasQuery(this)) return;
|
if (isBlank(inj) || !inj._hasQuery(this)) return;
|
||||||
if (inj.hasDirective(this.query.directive)) {
|
if (inj.hasDirective(this.query.directive)) {
|
||||||
ListWrapper.push(aggregator, inj.get(this.query.directive));
|
aggregator.push(inj.get(this.query.directive));
|
||||||
}
|
}
|
||||||
var child = inj._head;
|
var child = inj._head;
|
||||||
while (isPresent(child)) {
|
while (isPresent(child)) {
|
||||||
|
@ -47,10 +47,8 @@ class BindingRecordsCreator {
|
|||||||
for (var elementIndex = 0; elementIndex < elementBinders.length; ++elementIndex) {
|
for (var elementIndex = 0; elementIndex < elementBinders.length; ++elementIndex) {
|
||||||
var dirs = elementBinders[elementIndex].directives;
|
var dirs = elementBinders[elementIndex].directives;
|
||||||
for (var dirIndex = 0; dirIndex < dirs.length; ++dirIndex) {
|
for (var dirIndex = 0; dirIndex < dirs.length; ++dirIndex) {
|
||||||
ListWrapper.push(
|
directiveRecords.push(this._getDirectiveRecord(
|
||||||
directiveRecords,
|
elementIndex, dirIndex, allDirectiveMetadatas[dirs[dirIndex].directiveIndex]));
|
||||||
this._getDirectiveRecord(elementIndex, dirIndex,
|
|
||||||
allDirectiveMetadatas[dirs[dirIndex].directiveIndex]));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,15 +60,15 @@ class BindingRecordsCreator {
|
|||||||
if (isBlank(renderElementBinder.textBindings)) return;
|
if (isBlank(renderElementBinder.textBindings)) return;
|
||||||
|
|
||||||
ListWrapper.forEach(renderElementBinder.textBindings, (b) => {
|
ListWrapper.forEach(renderElementBinder.textBindings, (b) => {
|
||||||
ListWrapper.push(bindings, BindingRecord.createForTextNode(b, this._textNodeIndex++));
|
bindings.push(BindingRecord.createForTextNode(b, this._textNodeIndex++));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_createElementPropertyRecords(bindings: List<BindingRecord>, boundElementIndex: number,
|
_createElementPropertyRecords(bindings: List<BindingRecord>, boundElementIndex: number,
|
||||||
renderElementBinder: renderApi.ElementBinder) {
|
renderElementBinder: renderApi.ElementBinder) {
|
||||||
MapWrapper.forEach(renderElementBinder.propertyBindings, (astWithSource, propertyName) => {
|
MapWrapper.forEach(renderElementBinder.propertyBindings, (astWithSource, propertyName) => {
|
||||||
ListWrapper.push(
|
|
||||||
bindings, BindingRecord.createForElement(astWithSource, boundElementIndex, propertyName));
|
bindings.push(BindingRecord.createForElement(astWithSource, boundElementIndex, propertyName));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,18 +85,18 @@ class BindingRecordsCreator {
|
|||||||
// TODO: these setters should eventually be created by change detection, to make
|
// TODO: these setters should eventually be created by change detection, to make
|
||||||
// it monomorphic!
|
// it monomorphic!
|
||||||
var setter = reflector.setter(propertyName);
|
var setter = reflector.setter(propertyName);
|
||||||
ListWrapper.push(bindings, BindingRecord.createForDirective(astWithSource, propertyName,
|
bindings.push(
|
||||||
setter, directiveRecord));
|
BindingRecord.createForDirective(astWithSource, propertyName, setter, directiveRecord));
|
||||||
});
|
});
|
||||||
|
|
||||||
if (directiveRecord.callOnChange) {
|
if (directiveRecord.callOnChange) {
|
||||||
ListWrapper.push(bindings, BindingRecord.createDirectiveOnChange(directiveRecord));
|
bindings.push(BindingRecord.createDirectiveOnChange(directiveRecord));
|
||||||
}
|
}
|
||||||
if (directiveRecord.callOnInit) {
|
if (directiveRecord.callOnInit) {
|
||||||
ListWrapper.push(bindings, BindingRecord.createDirectiveOnInit(directiveRecord));
|
bindings.push(BindingRecord.createDirectiveOnInit(directiveRecord));
|
||||||
}
|
}
|
||||||
if (directiveRecord.callOnCheck) {
|
if (directiveRecord.callOnCheck) {
|
||||||
ListWrapper.push(bindings, BindingRecord.createDirectiveOnCheck(directiveRecord));
|
bindings.push(BindingRecord.createDirectiveOnCheck(directiveRecord));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,8 +105,8 @@ class BindingRecordsCreator {
|
|||||||
// host properties
|
// host properties
|
||||||
MapWrapper.forEach(directiveBinder.hostPropertyBindings, (astWithSource, propertyName) => {
|
MapWrapper.forEach(directiveBinder.hostPropertyBindings, (astWithSource, propertyName) => {
|
||||||
var dirIndex = new DirectiveIndex(boundElementIndex, i);
|
var dirIndex = new DirectiveIndex(boundElementIndex, i);
|
||||||
ListWrapper.push(
|
|
||||||
bindings, BindingRecord.createForHostProperty(dirIndex, astWithSource, propertyName));
|
bindings.push(BindingRecord.createForHostProperty(dirIndex, astWithSource, propertyName));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -185,8 +183,8 @@ function _collectNestedProtoViews(
|
|||||||
if (isBlank(result)) {
|
if (isBlank(result)) {
|
||||||
result = [];
|
result = [];
|
||||||
}
|
}
|
||||||
ListWrapper.push(result, new RenderProtoViewWithIndex(renderProtoView, result.length, parentIndex,
|
result.push(
|
||||||
boundElementIndex));
|
new RenderProtoViewWithIndex(renderProtoView, result.length, parentIndex, boundElementIndex));
|
||||||
var currentIndex = result.length - 1;
|
var currentIndex = result.length - 1;
|
||||||
var childBoundElementIndex = 0;
|
var childBoundElementIndex = 0;
|
||||||
ListWrapper.forEach(renderProtoView.elementBinders, (elementBinder) => {
|
ListWrapper.forEach(renderProtoView.elementBinders, (elementBinder) => {
|
||||||
@ -266,7 +264,6 @@ function _collectNestedProtoViewsVariableNames(
|
|||||||
return nestedPvVariableNames;
|
return nestedPvVariableNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function _createVariableNames(parentVariableNames, renderProtoView): List<string> {
|
function _createVariableNames(parentVariableNames, renderProtoView): List<string> {
|
||||||
var res = isBlank(parentVariableNames) ? [] : ListWrapper.clone(parentVariableNames);
|
var res = isBlank(parentVariableNames) ? [] : ListWrapper.clone(parentVariableNames);
|
||||||
MapWrapper.forEach(renderProtoView.variableBindings,
|
MapWrapper.forEach(renderProtoView.variableBindings,
|
||||||
|
@ -183,7 +183,7 @@ export class AppProtoView {
|
|||||||
new ElementBinder(this.elementBinders.length, parent, distanceToParent,
|
new ElementBinder(this.elementBinders.length, parent, distanceToParent,
|
||||||
protoElementInjector, directiveVariableBindings, componentDirective);
|
protoElementInjector, directiveVariableBindings, componentDirective);
|
||||||
|
|
||||||
ListWrapper.push(this.elementBinders, elBinder);
|
this.elementBinders.push(elBinder);
|
||||||
return elBinder;
|
return elBinder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ export class AppViewManagerUtils {
|
|||||||
elementInjector = protoElementInjector.instantiate(parentElementInjector);
|
elementInjector = protoElementInjector.instantiate(parentElementInjector);
|
||||||
} else {
|
} else {
|
||||||
elementInjector = protoElementInjector.instantiate(null);
|
elementInjector = protoElementInjector.instantiate(null);
|
||||||
ListWrapper.push(rootElementInjectors, elementInjector);
|
rootElementInjectors.push(elementInjector);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elementInjectors[binderIdx] = elementInjector;
|
elementInjectors[binderIdx] = elementInjector;
|
||||||
|
@ -34,7 +34,7 @@ export class AppViewPool {
|
|||||||
}
|
}
|
||||||
var haveRemainingCapacity = pooledViews.length < this._poolCapacityPerProtoView;
|
var haveRemainingCapacity = pooledViews.length < this._poolCapacityPerProtoView;
|
||||||
if (haveRemainingCapacity) {
|
if (haveRemainingCapacity) {
|
||||||
ListWrapper.push(pooledViews, view);
|
pooledViews.push(view);
|
||||||
}
|
}
|
||||||
return haveRemainingCapacity;
|
return haveRemainingCapacity;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ export class Testability {
|
|||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this._pendingCount = 0;
|
this._pendingCount = 0;
|
||||||
this._callbacks = ListWrapper.create();
|
this._callbacks = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
increaseCount(delta: number = 1) {
|
increaseCount(delta: number = 1) {
|
||||||
@ -37,7 +37,7 @@ export class Testability {
|
|||||||
}
|
}
|
||||||
|
|
||||||
whenStable(callback: Function) {
|
whenStable(callback: Function) {
|
||||||
ListWrapper.push(this._callbacks, callback);
|
this._callbacks.push(callback);
|
||||||
|
|
||||||
if (this._pendingCount === 0) {
|
if (this._pendingCount === 0) {
|
||||||
this._runCallbacks();
|
this._runCallbacks();
|
||||||
|
@ -69,7 +69,7 @@ export class DebugElement {
|
|||||||
|
|
||||||
if (!isPresent(shadowView)) {
|
if (!isPresent(shadowView)) {
|
||||||
// The current element is not a component.
|
// The current element is not a component.
|
||||||
return ListWrapper.create();
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return this._getChildElements(shadowView, null);
|
return this._getChildElements(shadowView, null);
|
||||||
@ -123,7 +123,7 @@ export class DebugElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_getChildElements(view: AppView, parentBoundElementIndex: number): List<DebugElement> {
|
_getChildElements(view: AppView, parentBoundElementIndex: number): List<DebugElement> {
|
||||||
var els = ListWrapper.create();
|
var els = [];
|
||||||
var parentElementBinder = null;
|
var parentElementBinder = null;
|
||||||
if (isPresent(parentBoundElementIndex)) {
|
if (isPresent(parentBoundElementIndex)) {
|
||||||
parentElementBinder = view.proto.elementBinders[parentBoundElementIndex];
|
parentElementBinder = view.proto.elementBinders[parentBoundElementIndex];
|
||||||
@ -131,7 +131,7 @@ export class DebugElement {
|
|||||||
for (var i = 0; i < view.proto.elementBinders.length; ++i) {
|
for (var i = 0; i < view.proto.elementBinders.length; ++i) {
|
||||||
var binder = view.proto.elementBinders[i];
|
var binder = view.proto.elementBinders[i];
|
||||||
if (binder.parent == parentElementBinder) {
|
if (binder.parent == parentElementBinder) {
|
||||||
ListWrapper.push(els, new DebugElement(view, i));
|
els.push(new DebugElement(view, i));
|
||||||
|
|
||||||
var views = view.viewContainers[i];
|
var views = view.viewContainers[i];
|
||||||
if (isPresent(views)) {
|
if (isPresent(views)) {
|
||||||
@ -154,8 +154,8 @@ export function inspectElement(elementRef: ElementRef): DebugElement {
|
|||||||
*/
|
*/
|
||||||
export class Scope {
|
export class Scope {
|
||||||
static all(debugElement): List<DebugElement> {
|
static all(debugElement): List<DebugElement> {
|
||||||
var scope = ListWrapper.create();
|
var scope = [];
|
||||||
ListWrapper.push(scope, debugElement);
|
scope.push(debugElement);
|
||||||
|
|
||||||
ListWrapper.forEach(debugElement.children,
|
ListWrapper.forEach(debugElement.children,
|
||||||
(child) => { scope = ListWrapper.concat(scope, Scope.all(child)); });
|
(child) => { scope = ListWrapper.concat(scope, Scope.all(child)); });
|
||||||
@ -166,19 +166,19 @@ export class Scope {
|
|||||||
return scope;
|
return scope;
|
||||||
}
|
}
|
||||||
static light(debugElement): List<DebugElement> {
|
static light(debugElement): List<DebugElement> {
|
||||||
var scope = ListWrapper.create();
|
var scope = [];
|
||||||
ListWrapper.forEach(debugElement.children, (child) => {
|
ListWrapper.forEach(debugElement.children, (child) => {
|
||||||
ListWrapper.push(scope, child);
|
scope.push(child);
|
||||||
scope = ListWrapper.concat(scope, Scope.light(child));
|
scope = ListWrapper.concat(scope, Scope.light(child));
|
||||||
});
|
});
|
||||||
return scope;
|
return scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
static view(debugElement): List<DebugElement> {
|
static view(debugElement): List<DebugElement> {
|
||||||
var scope = ListWrapper.create();
|
var scope = [];
|
||||||
|
|
||||||
ListWrapper.forEach(debugElement.componentViewChildren, (child) => {
|
ListWrapper.forEach(debugElement.componentViewChildren, (child) => {
|
||||||
ListWrapper.push(scope, child);
|
scope.push(child);
|
||||||
scope = ListWrapper.concat(scope, Scope.light(child));
|
scope = ListWrapper.concat(scope, Scope.light(child));
|
||||||
});
|
});
|
||||||
return scope;
|
return scope;
|
||||||
|
@ -501,7 +501,7 @@ function _extractToken(typeOrFunc, annotations /*List<any> | any*/,
|
|||||||
if (isPresent(paramAnnotation.token)) {
|
if (isPresent(paramAnnotation.token)) {
|
||||||
token = paramAnnotation.token;
|
token = paramAnnotation.token;
|
||||||
}
|
}
|
||||||
ListWrapper.push(depProps, paramAnnotation);
|
depProps.push(paramAnnotation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,10 +5,10 @@ function findFirstClosedCycle(keys: List<any>): List<any> {
|
|||||||
var res = [];
|
var res = [];
|
||||||
for (var i = 0; i < keys.length; ++i) {
|
for (var i = 0; i < keys.length; ++i) {
|
||||||
if (ListWrapper.contains(res, keys[i])) {
|
if (ListWrapper.contains(res, keys[i])) {
|
||||||
ListWrapper.push(res, keys[i]);
|
res.push(keys[i]);
|
||||||
return res;
|
return res;
|
||||||
} else {
|
} else {
|
||||||
ListWrapper.push(res, keys[i]);
|
res.push(keys[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
@ -45,7 +45,7 @@ export class AbstractBindingError extends BaseException {
|
|||||||
|
|
||||||
// TODO(tbosch): Can't do key:Key as this results in a circular dependency!
|
// TODO(tbosch): Can't do key:Key as this results in a circular dependency!
|
||||||
addKey(key): void {
|
addKey(key): void {
|
||||||
ListWrapper.push(this.keys, key);
|
this.keys.push(key);
|
||||||
this.message = this.constructResolvingMessage(this.keys);
|
this.message = this.constructResolvingMessage(this.keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,13 +182,13 @@ export class NoAnnotationError extends BaseException {
|
|||||||
message: string;
|
message: string;
|
||||||
constructor(typeOrFunc, params: List<List<any>>) {
|
constructor(typeOrFunc, params: List<List<any>>) {
|
||||||
super();
|
super();
|
||||||
var signature = ListWrapper.create();
|
var signature = [];
|
||||||
for (var i = 0, ii = params.length; i < ii; i++) {
|
for (var i = 0, ii = params.length; i < ii; i++) {
|
||||||
var parameter = params[i];
|
var parameter = params[i];
|
||||||
if (isBlank(parameter) || parameter.length == 0) {
|
if (isBlank(parameter) || parameter.length == 0) {
|
||||||
ListWrapper.push(signature, '?');
|
signature.push('?');
|
||||||
} else {
|
} else {
|
||||||
ListWrapper.push(signature, ListWrapper.map(parameter, stringify).join(' '));
|
signature.push(ListWrapper.map(parameter, stringify).join(' '));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.message = "Cannot resolve all parameters for " + stringify(typeOrFunc) + "(" +
|
this.message = "Cannot resolve all parameters for " + stringify(typeOrFunc) + "(" +
|
||||||
|
@ -390,8 +390,8 @@ export function resolveBindings(bindings: List<Type | Binding | List<any>>): Lis
|
|||||||
|
|
||||||
function flattenBindings(bindings: List<ResolvedBinding>): List<ResolvedBinding> {
|
function flattenBindings(bindings: List<ResolvedBinding>): List<ResolvedBinding> {
|
||||||
var map = _flattenBindings(bindings, MapWrapper.create());
|
var map = _flattenBindings(bindings, MapWrapper.create());
|
||||||
var res = ListWrapper.create();
|
var res = [];
|
||||||
MapWrapper.forEach(map, (binding, keyId) => ListWrapper.push(res, binding));
|
MapWrapper.forEach(map, (binding, keyId) => res.push(binding));
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import {Directive} from 'angular2/annotations';
|
import {Directive} from 'angular2/annotations';
|
||||||
import {ViewContainerRef, ViewRef, ProtoViewRef} from 'angular2/core';
|
import {ViewContainerRef, ViewRef, ProtoViewRef} from 'angular2/core';
|
||||||
import {isPresent, isBlank} from 'angular2/src/facade/lang';
|
import {isPresent, isBlank} from 'angular2/src/facade/lang';
|
||||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The `NgFor` directive instantiates a template once per item from an iterable. The context for
|
* The `NgFor` directive instantiates a template once per item from an iterable. The context for
|
||||||
@ -54,16 +53,16 @@ export class NgFor {
|
|||||||
// TODO(rado): check if change detection can produce a change record that is
|
// TODO(rado): check if change detection can produce a change record that is
|
||||||
// easier to consume than current.
|
// easier to consume than current.
|
||||||
var recordViewTuples = [];
|
var recordViewTuples = [];
|
||||||
changes.forEachRemovedItem((removedRecord) => ListWrapper.push(
|
changes.forEachRemovedItem((removedRecord) =>
|
||||||
recordViewTuples, new RecordViewTuple(removedRecord, null)));
|
recordViewTuples.push(new RecordViewTuple(removedRecord, null)));
|
||||||
|
|
||||||
changes.forEachMovedItem((movedRecord) => ListWrapper.push(
|
changes.forEachMovedItem((movedRecord) =>
|
||||||
recordViewTuples, new RecordViewTuple(movedRecord, null)));
|
recordViewTuples.push(new RecordViewTuple(movedRecord, null)));
|
||||||
|
|
||||||
var insertTuples = NgFor.bulkRemove(recordViewTuples, this.viewContainer);
|
var insertTuples = NgFor.bulkRemove(recordViewTuples, this.viewContainer);
|
||||||
|
|
||||||
changes.forEachAddedItem(
|
changes.forEachAddedItem((addedRecord) =>
|
||||||
(addedRecord) => ListWrapper.push(insertTuples, new RecordViewTuple(addedRecord, null)));
|
insertTuples.push(new RecordViewTuple(addedRecord, null)));
|
||||||
|
|
||||||
NgFor.bulkInsert(insertTuples, this.viewContainer, this.protoViewRef);
|
NgFor.bulkInsert(insertTuples, this.viewContainer, this.protoViewRef);
|
||||||
|
|
||||||
@ -85,7 +84,7 @@ export class NgFor {
|
|||||||
// separate moved views from removed views.
|
// separate moved views from removed views.
|
||||||
if (isPresent(tuple.record.currentIndex)) {
|
if (isPresent(tuple.record.currentIndex)) {
|
||||||
tuple.view = viewContainer.detach(tuple.record.previousIndex);
|
tuple.view = viewContainer.detach(tuple.record.previousIndex);
|
||||||
ListWrapper.push(movedTuples, tuple);
|
movedTuples.push(tuple);
|
||||||
} else {
|
} else {
|
||||||
viewContainer.remove(tuple.record.previousIndex);
|
viewContainer.remove(tuple.record.previousIndex);
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ export class NgSwitch {
|
|||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this._valueViews = MapWrapper.create();
|
this._valueViews = MapWrapper.create();
|
||||||
this._activeViews = ListWrapper.create();
|
this._activeViews = [];
|
||||||
this._useDefault = false;
|
this._useDefault = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ export class NgSwitch {
|
|||||||
this._emptyAllActiveViews();
|
this._emptyAllActiveViews();
|
||||||
}
|
}
|
||||||
view.create();
|
view.create();
|
||||||
ListWrapper.push(this._activeViews, view);
|
this._activeViews.push(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Switch to default when there is no more active ViewContainers
|
// Switch to default when there is no more active ViewContainers
|
||||||
@ -101,7 +101,7 @@ export class NgSwitch {
|
|||||||
for (var i = 0; i < activeContainers.length; i++) {
|
for (var i = 0; i < activeContainers.length; i++) {
|
||||||
activeContainers[i].destroy();
|
activeContainers[i].destroy();
|
||||||
}
|
}
|
||||||
this._activeViews = ListWrapper.create();
|
this._activeViews = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
_activateViews(views: List<SwitchView>): void {
|
_activateViews(views: List<SwitchView>): void {
|
||||||
@ -117,10 +117,10 @@ export class NgSwitch {
|
|||||||
_registerView(value, view: SwitchView): void {
|
_registerView(value, view: SwitchView): void {
|
||||||
var views = MapWrapper.get(this._valueViews, value);
|
var views = MapWrapper.get(this._valueViews, value);
|
||||||
if (isBlank(views)) {
|
if (isBlank(views)) {
|
||||||
views = ListWrapper.create();
|
views = [];
|
||||||
MapWrapper.set(this._valueViews, value, views);
|
MapWrapper.set(this._valueViews, value, views);
|
||||||
}
|
}
|
||||||
ListWrapper.push(views, view);
|
views.push(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
_deregisterView(value, view: SwitchView): void {
|
_deregisterView(value, view: SwitchView): void {
|
||||||
|
@ -13,7 +13,7 @@ export class GenericBrowserDomAdapter extends DomAdapter {
|
|||||||
cssToRules(css: string): List<any> {
|
cssToRules(css: string): List<any> {
|
||||||
var style = this.createStyleElement(css);
|
var style = this.createStyleElement(css);
|
||||||
this.appendChild(this.defaultDoc().head, style);
|
this.appendChild(this.defaultDoc().head, style);
|
||||||
var rules = ListWrapper.create();
|
var rules = [];
|
||||||
if (isPresent(style.sheet)) {
|
if (isPresent(style.sheet)) {
|
||||||
// TODO(sorvell): Firefox throws when accessing the rules of a stylesheet
|
// TODO(sorvell): Firefox throws when accessing the rules of a stylesheet
|
||||||
// with an @import
|
// with an @import
|
||||||
|
@ -33,14 +33,14 @@ export class Parse5DomAdapter extends DomAdapter {
|
|||||||
query(selector) { throw _notImplemented('query'); }
|
query(selector) { throw _notImplemented('query'); }
|
||||||
querySelector(el, selector: string) { return this.querySelectorAll(el, selector)[0]; }
|
querySelector(el, selector: string) { return this.querySelectorAll(el, selector)[0]; }
|
||||||
querySelectorAll(el, selector: string) {
|
querySelectorAll(el, selector: string) {
|
||||||
var res = ListWrapper.create();
|
var res = [];
|
||||||
var _recursive = (result, node, selector, matcher) => {
|
var _recursive = (result, node, selector, matcher) => {
|
||||||
var cNodes = node.childNodes;
|
var cNodes = node.childNodes;
|
||||||
if (cNodes && cNodes.length > 0) {
|
if (cNodes && cNodes.length > 0) {
|
||||||
for (var i = 0; i < cNodes.length; i++) {
|
for (var i = 0; i < cNodes.length; i++) {
|
||||||
var childNode = cNodes[i];
|
var childNode = cNodes[i];
|
||||||
if (this.elementMatches(childNode, selector, matcher)) {
|
if (this.elementMatches(childNode, selector, matcher)) {
|
||||||
ListWrapper.push(result, childNode);
|
result.push(childNode);
|
||||||
}
|
}
|
||||||
_recursive(result, childNode, selector, matcher);
|
_recursive(result, childNode, selector, matcher);
|
||||||
}
|
}
|
||||||
@ -86,9 +86,9 @@ export class Parse5DomAdapter extends DomAdapter {
|
|||||||
}
|
}
|
||||||
var listeners = StringMapWrapper.get(listenersMap, evt);
|
var listeners = StringMapWrapper.get(listenersMap, evt);
|
||||||
if (isBlank(listeners)) {
|
if (isBlank(listeners)) {
|
||||||
listeners = ListWrapper.create();
|
listeners = [];
|
||||||
}
|
}
|
||||||
ListWrapper.push(listeners, listener);
|
listeners.push(listener);
|
||||||
StringMapWrapper.set(listenersMap, evt, listeners);
|
StringMapWrapper.set(listenersMap, evt, listeners);
|
||||||
}
|
}
|
||||||
onAndCancel(el, evt, listener): Function {
|
onAndCancel(el, evt, listener): Function {
|
||||||
@ -287,7 +287,7 @@ export class Parse5DomAdapter extends DomAdapter {
|
|||||||
var classList = this.classList(element);
|
var classList = this.classList(element);
|
||||||
var index = classList.indexOf(classname);
|
var index = classList.indexOf(classname);
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
ListWrapper.push(classList, classname);
|
classList.push(classname);
|
||||||
element.attribs["class"] = element.className = ListWrapper.join(classList, " ");
|
element.attribs["class"] = element.className = ListWrapper.join(classList, " ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -417,7 +417,7 @@ export class Parse5DomAdapter extends DomAdapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
_buildRules(parsedRules, css?) {
|
_buildRules(parsedRules, css?) {
|
||||||
var rules = ListWrapper.create();
|
var rules = [];
|
||||||
for (var i = 0; i < parsedRules.length; i++) {
|
for (var i = 0; i < parsedRules.length; i++) {
|
||||||
var parsedRule = parsedRules[i];
|
var parsedRule = parsedRules[i];
|
||||||
var rule: StringMap<string, any> = StringMapWrapper.create();
|
var rule: StringMap<string, any> = StringMapWrapper.create();
|
||||||
@ -448,13 +448,13 @@ export class Parse5DomAdapter extends DomAdapter {
|
|||||||
StringMapWrapper.set(rule, "cssRules", this._buildRules(parsedRule.rules));
|
StringMapWrapper.set(rule, "cssRules", this._buildRules(parsedRule.rules));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ListWrapper.push(rules, rule);
|
rules.push(rule);
|
||||||
}
|
}
|
||||||
return rules;
|
return rules;
|
||||||
}
|
}
|
||||||
cssToRules(css: string): List<any> {
|
cssToRules(css: string): List<any> {
|
||||||
css = css.replace(/url\(\'(.+)\'\)/g, 'url($1)');
|
css = css.replace(/url\(\'(.+)\'\)/g, 'url($1)');
|
||||||
var rules = ListWrapper.create();
|
var rules = [];
|
||||||
var parsedCSS = cssParse(css, {silent: true});
|
var parsedCSS = cssParse(css, {silent: true});
|
||||||
if (parsedCSS.stylesheet && parsedCSS.stylesheet.rules) {
|
if (parsedCSS.stylesheet && parsedCSS.stylesheet.rules) {
|
||||||
rules = this._buildRules(parsedCSS.stylesheet.rules, css);
|
rules = this._buildRules(parsedCSS.stylesheet.rules, css);
|
||||||
|
@ -101,7 +101,6 @@ class StringMapWrapper {
|
|||||||
|
|
||||||
class ListWrapper {
|
class ListWrapper {
|
||||||
static List clone(Iterable l) => new List.from(l);
|
static List clone(Iterable l) => new List.from(l);
|
||||||
static List create() => new List();
|
|
||||||
static List createFixedSize(int size) => new List(size);
|
static List createFixedSize(int size) => new List(size);
|
||||||
static get(List m, int k) => m[k];
|
static get(List m, int k) => m[k];
|
||||||
static void set(List m, int k, v) {
|
static void set(List m, int k, v) {
|
||||||
@ -126,9 +125,6 @@ class ListWrapper {
|
|||||||
static first(List list) => list.isEmpty ? null : list.first;
|
static first(List list) => list.isEmpty ? null : list.first;
|
||||||
static last(List list) => list.isEmpty ? null : list.last;
|
static last(List list) => list.isEmpty ? null : list.last;
|
||||||
static List reversed(List list) => list.reversed.toList();
|
static List reversed(List list) => list.reversed.toList();
|
||||||
static void push(List l, e) {
|
|
||||||
l.add(e);
|
|
||||||
}
|
|
||||||
static List concat(List a, List b) {
|
static List concat(List a, List b) {
|
||||||
return new List()
|
return new List()
|
||||||
..length = a.length + b.length
|
..length = a.length + b.length
|
||||||
|
@ -145,7 +145,6 @@ export class StringMapWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class ListWrapper {
|
export class ListWrapper {
|
||||||
static create(): List<any> { return new List(); }
|
|
||||||
static createFixedSize(size): List<any> { return new List(size); }
|
static createFixedSize(size): List<any> { return new List(size); }
|
||||||
static get(m, k) { return m[k]; }
|
static get(m, k) { return m[k]; }
|
||||||
static set(m, k, v) { m[k] = v; }
|
static set(m, k, v) { m[k] = v; }
|
||||||
@ -156,7 +155,6 @@ export class ListWrapper {
|
|||||||
fn(array[i]);
|
fn(array[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static push(array, el) { array.push(el); }
|
|
||||||
static first(array) {
|
static first(array) {
|
||||||
if (!array) return null;
|
if (!array) return null;
|
||||||
return array[0];
|
return array[0];
|
||||||
|
@ -113,7 +113,7 @@ export class NgFormModel extends ControlContainer implements Form {
|
|||||||
var c: any = this.form.find(dir.path);
|
var c: any = this.form.find(dir.path);
|
||||||
setUpControl(c, dir);
|
setUpControl(c, dir);
|
||||||
c.updateValidity();
|
c.updateValidity();
|
||||||
ListWrapper.push(this.directives, dir);
|
this.directives.push(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
getControl(dir: NgControl): Control { return <Control>this.form.find(dir.path); }
|
getControl(dir: NgControl): Control { return <Control>this.form.find(dir.path); }
|
||||||
|
@ -10,7 +10,7 @@ import {Renderer, ElementRef} from 'angular2/angular2';
|
|||||||
|
|
||||||
export function controlPath(name, parent: ControlContainer) {
|
export function controlPath(name, parent: ControlContainer) {
|
||||||
var p = ListWrapper.clone(parent.path);
|
var p = ListWrapper.clone(parent.path);
|
||||||
ListWrapper.push(p, name);
|
p.push(name);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,7 +287,7 @@ export class ControlArray extends AbstractControl {
|
|||||||
at(index: number): AbstractControl { return this.controls[index]; }
|
at(index: number): AbstractControl { return this.controls[index]; }
|
||||||
|
|
||||||
push(control: AbstractControl): void {
|
push(control: AbstractControl): void {
|
||||||
ListWrapper.push(this.controls, control);
|
this.controls.push(control);
|
||||||
control.setParent(this);
|
control.setParent(this);
|
||||||
this.updateValueAndValidity();
|
this.updateValueAndValidity();
|
||||||
}
|
}
|
||||||
|
@ -51,12 +51,13 @@ export class Validators {
|
|||||||
return StringMapWrapper.isEmpty(res) ? null : res;
|
return StringMapWrapper.isEmpty(res) ? null : res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static _mergeErrors(control: modelModule.AbstractControl, res: StringMap<string, any>): void {
|
static _mergeErrors(control: modelModule.AbstractControl, res: StringMap<string, any[]>): void {
|
||||||
StringMapWrapper.forEach(control.errors, (value, error) => {
|
StringMapWrapper.forEach(control.errors, (value, error) => {
|
||||||
if (!StringMapWrapper.contains(res, error)) {
|
if (!StringMapWrapper.contains(res, error)) {
|
||||||
res[error] = [];
|
res[error] = [];
|
||||||
}
|
}
|
||||||
ListWrapper.push(res[error], control);
|
var current: any[] = res[error];
|
||||||
|
current.push(control);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,8 +33,8 @@ export class Headers {
|
|||||||
this._headersMap = MapWrapper.createFromStringMap(headers);
|
this._headersMap = MapWrapper.createFromStringMap(headers);
|
||||||
MapWrapper.forEach(this._headersMap, (v, k) => {
|
MapWrapper.forEach(this._headersMap, (v, k) => {
|
||||||
if (!isListLikeIterable(v)) {
|
if (!isListLikeIterable(v)) {
|
||||||
var list = ListWrapper.create();
|
var list = [];
|
||||||
ListWrapper.push(list, v);
|
list.push(v);
|
||||||
MapWrapper.set(this._headersMap, k, list);
|
MapWrapper.set(this._headersMap, k, list);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -42,8 +42,8 @@ export class Headers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
append(name: string, value: string): void {
|
append(name: string, value: string): void {
|
||||||
var list = MapWrapper.get(this._headersMap, name) || ListWrapper.create();
|
var list = MapWrapper.get(this._headersMap, name) || [];
|
||||||
ListWrapper.push(list, value);
|
list.push(value);
|
||||||
MapWrapper.set(this._headersMap, name, list);
|
MapWrapper.set(this._headersMap, name, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,11 +61,11 @@ export class Headers {
|
|||||||
|
|
||||||
// TODO: this implementation seems wrong. create list then check if it's iterable?
|
// TODO: this implementation seems wrong. create list then check if it's iterable?
|
||||||
set(header: string, value: string | List<string>): void {
|
set(header: string, value: string | List<string>): void {
|
||||||
var list = ListWrapper.create();
|
var list = [];
|
||||||
if (!isListLikeIterable(value)) {
|
if (!isListLikeIterable(value)) {
|
||||||
ListWrapper.push(list, value);
|
list.push(value);
|
||||||
} else {
|
} else {
|
||||||
ListWrapper.push(list, ListWrapper.toString((<List<string>>value)));
|
list.push(ListWrapper.toString((<List<string>>value)));
|
||||||
}
|
}
|
||||||
|
|
||||||
MapWrapper.set(this._headersMap, header, list);
|
MapWrapper.set(this._headersMap, header, list);
|
||||||
@ -73,9 +73,7 @@ export class Headers {
|
|||||||
|
|
||||||
values() { return MapWrapper.values(this._headersMap); }
|
values() { return MapWrapper.values(this._headersMap); }
|
||||||
|
|
||||||
getAll(header: string): Array<string> {
|
getAll(header: string): Array<string> { return MapWrapper.get(this._headersMap, header) || []; }
|
||||||
return MapWrapper.get(this._headersMap, header) || ListWrapper.create();
|
|
||||||
}
|
|
||||||
|
|
||||||
entries() { throw new BaseException('"entries" method is not implemented on Headers class'); }
|
entries() { throw new BaseException('"entries" method is not implemented on Headers class'); }
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,8 @@ function paramParser(rawParams: string): Map<string, List<string>> {
|
|||||||
var split: List<string> = StringWrapper.split(param, '=');
|
var split: List<string> = StringWrapper.split(param, '=');
|
||||||
var key = ListWrapper.get(split, 0);
|
var key = ListWrapper.get(split, 0);
|
||||||
var val = ListWrapper.get(split, 1);
|
var val = ListWrapper.get(split, 1);
|
||||||
var list = MapWrapper.get(map, key) || ListWrapper.create();
|
var list = MapWrapper.get(map, key) || [];
|
||||||
ListWrapper.push(list, val);
|
list.push(val);
|
||||||
MapWrapper.set(map, key, list);
|
MapWrapper.set(map, key, list);
|
||||||
});
|
});
|
||||||
return map;
|
return map;
|
||||||
@ -23,20 +23,18 @@ export class URLSearchParams {
|
|||||||
|
|
||||||
get(param: string): string { return ListWrapper.first(MapWrapper.get(this.paramsMap, param)); }
|
get(param: string): string { return ListWrapper.first(MapWrapper.get(this.paramsMap, param)); }
|
||||||
|
|
||||||
getAll(param: string): List<string> {
|
getAll(param: string): List<string> { return MapWrapper.get(this.paramsMap, param) || []; }
|
||||||
return MapWrapper.get(this.paramsMap, param) || ListWrapper.create();
|
|
||||||
}
|
|
||||||
|
|
||||||
append(param: string, val: string): void {
|
append(param: string, val: string): void {
|
||||||
var list = MapWrapper.get(this.paramsMap, param) || ListWrapper.create();
|
var list = MapWrapper.get(this.paramsMap, param) || [];
|
||||||
ListWrapper.push(list, val);
|
list.push(val);
|
||||||
MapWrapper.set(this.paramsMap, param, list);
|
MapWrapper.set(this.paramsMap, param, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
toString(): string {
|
toString(): string {
|
||||||
var paramsList = ListWrapper.create();
|
var paramsList = [];
|
||||||
MapWrapper.forEach(this.paramsMap, (values, k) => {
|
MapWrapper.forEach(this.paramsMap, (values, k) => {
|
||||||
ListWrapper.forEach(values, v => { ListWrapper.push(paramsList, k + '=' + v); });
|
ListWrapper.forEach(values, v => { paramsList.push(k + '=' + v); });
|
||||||
});
|
});
|
||||||
return ListWrapper.join(paramsList, '&');
|
return ListWrapper.join(paramsList, '&');
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ export class DummyBrowserLocation extends SpyObject {
|
|||||||
internalBaseHref: string = '/';
|
internalBaseHref: string = '/';
|
||||||
internalPath: string = '/';
|
internalPath: string = '/';
|
||||||
internalTitle: string = '';
|
internalTitle: string = '';
|
||||||
urlChanges: List<string> = ListWrapper.create();
|
urlChanges: List<string> = [];
|
||||||
_subject: EventEmitter = new EventEmitter();
|
_subject: EventEmitter = new EventEmitter();
|
||||||
constructor() { super(); }
|
constructor() { super(); }
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ export class DummyBrowserLocation extends SpyObject {
|
|||||||
pushState(ctx: any, title: string, url: string): void {
|
pushState(ctx: any, title: string, url: string): void {
|
||||||
this.internalTitle = title;
|
this.internalTitle = title;
|
||||||
this.internalPath = url;
|
this.internalPath = url;
|
||||||
ListWrapper.push(this.urlChanges, url);
|
this.urlChanges.push(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
forward(): void { throw new BaseException('Not implemented yet!'); }
|
forward(): void { throw new BaseException('Not implemented yet!'); }
|
||||||
|
@ -17,7 +17,7 @@ export class SpyLocation extends SpyObject {
|
|||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this._path = '/';
|
this._path = '/';
|
||||||
this.urlChanges = ListWrapper.create();
|
this.urlChanges = [];
|
||||||
this._subject = new EventEmitter();
|
this._subject = new EventEmitter();
|
||||||
this._baseHref = '';
|
this._baseHref = '';
|
||||||
}
|
}
|
||||||
@ -38,7 +38,7 @@ export class SpyLocation extends SpyObject {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._path = url;
|
this._path = url;
|
||||||
ListWrapper.push(this.urlChanges, url);
|
this.urlChanges.push(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
forward() {
|
forward() {
|
||||||
|
@ -10,14 +10,14 @@ import {CompileStep} from './compile_step';
|
|||||||
export class CompileControl {
|
export class CompileControl {
|
||||||
_currentStepIndex: number = 0;
|
_currentStepIndex: number = 0;
|
||||||
_parent: CompileElement = null;
|
_parent: CompileElement = null;
|
||||||
_results = null;
|
_results: any[] = null;
|
||||||
_additionalChildren = null;
|
_additionalChildren: any[] = null;
|
||||||
_ignoreCurrentElement: boolean;
|
_ignoreCurrentElement: boolean;
|
||||||
|
|
||||||
constructor(public _steps: List<CompileStep>) {}
|
constructor(public _steps: List<CompileStep>) {}
|
||||||
|
|
||||||
// only public so that it can be used by compile_pipeline
|
// only public so that it can be used by compile_pipeline
|
||||||
internalProcess(results, startStepIndex, parent: CompileElement, current: CompileElement) {
|
internalProcess(results: any[], startStepIndex, parent: CompileElement, current: CompileElement) {
|
||||||
this._results = results;
|
this._results = results;
|
||||||
var previousStepIndex = this._currentStepIndex;
|
var previousStepIndex = this._currentStepIndex;
|
||||||
var previousParent = this._parent;
|
var previousParent = this._parent;
|
||||||
@ -33,7 +33,7 @@ export class CompileControl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!this._ignoreCurrentElement) {
|
if (!this._ignoreCurrentElement) {
|
||||||
ListWrapper.push(results, current);
|
results.push(current);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._currentStepIndex = previousStepIndex;
|
this._currentStepIndex = previousStepIndex;
|
||||||
@ -51,9 +51,9 @@ export class CompileControl {
|
|||||||
|
|
||||||
addChild(element: CompileElement) {
|
addChild(element: CompileElement) {
|
||||||
if (isBlank(this._additionalChildren)) {
|
if (isBlank(this._additionalChildren)) {
|
||||||
this._additionalChildren = ListWrapper.create();
|
this._additionalChildren = [];
|
||||||
}
|
}
|
||||||
ListWrapper.push(this._additionalChildren, element);
|
this._additionalChildren.push(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -63,10 +63,10 @@ export class CompileElement {
|
|||||||
|
|
||||||
classList(): List<string> {
|
classList(): List<string> {
|
||||||
if (isBlank(this._classList)) {
|
if (isBlank(this._classList)) {
|
||||||
this._classList = ListWrapper.create();
|
this._classList = [];
|
||||||
var elClassList = DOM.classList(this.element);
|
var elClassList = DOM.classList(this.element);
|
||||||
for (var i = 0; i < elClassList.length; i++) {
|
for (var i = 0; i < elClassList.length; i++) {
|
||||||
ListWrapper.push(this._classList, elClassList[i]);
|
this._classList.push(elClassList[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this._classList;
|
return this._classList;
|
||||||
|
@ -20,7 +20,7 @@ export class CompilePipeline {
|
|||||||
if (isBlank(protoViewType)) {
|
if (isBlank(protoViewType)) {
|
||||||
protoViewType = ViewType.COMPONENT;
|
protoViewType = ViewType.COMPONENT;
|
||||||
}
|
}
|
||||||
var results = ListWrapper.create();
|
var results = [];
|
||||||
var rootCompileElement = new CompileElement(rootElement, compilationCtxtDescription);
|
var rootCompileElement = new CompileElement(rootElement, compilationCtxtDescription);
|
||||||
rootCompileElement.inheritedProtoView = new ProtoViewBuilder(rootElement, protoViewType);
|
rootCompileElement.inheritedProtoView = new ProtoViewBuilder(rootElement, protoViewType);
|
||||||
rootCompileElement.isViewRoot = true;
|
rootCompileElement.isViewRoot = true;
|
||||||
|
@ -74,7 +74,7 @@ export class DirectiveParser implements CompileStep {
|
|||||||
componentDirective = directive;
|
componentDirective = directive;
|
||||||
elementBinder.setComponentId(directive.id);
|
elementBinder.setComponentId(directive.id);
|
||||||
} else {
|
} else {
|
||||||
ListWrapper.push(foundDirectiveIndices, directiveIndex);
|
foundDirectiveIndices.push(directiveIndex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ListWrapper.forEach(foundDirectiveIndices, (directiveIndex) => {
|
ListWrapper.forEach(foundDirectiveIndices, (directiveIndex) => {
|
||||||
|
@ -32,13 +32,13 @@ export class CssSelector {
|
|||||||
notSelectors: List<CssSelector> = [];
|
notSelectors: List<CssSelector> = [];
|
||||||
|
|
||||||
static parse(selector: string): List<CssSelector> {
|
static parse(selector: string): List<CssSelector> {
|
||||||
var results = ListWrapper.create();
|
var results: CssSelector[] = [];
|
||||||
var _addResult = (res, cssSel) => {
|
var _addResult = (res: CssSelector[], cssSel) => {
|
||||||
if (cssSel.notSelectors.length > 0 && isBlank(cssSel.element) &&
|
if (cssSel.notSelectors.length > 0 && isBlank(cssSel.element) &&
|
||||||
ListWrapper.isEmpty(cssSel.classNames) && ListWrapper.isEmpty(cssSel.attrs)) {
|
ListWrapper.isEmpty(cssSel.classNames) && ListWrapper.isEmpty(cssSel.attrs)) {
|
||||||
cssSel.element = "*";
|
cssSel.element = "*";
|
||||||
}
|
}
|
||||||
ListWrapper.push(res, cssSel);
|
res.push(cssSel);
|
||||||
};
|
};
|
||||||
var cssSelector = new CssSelector();
|
var cssSelector = new CssSelector();
|
||||||
var matcher = RegExpWrapper.matcher(_SELECTOR_REGEXP, selector);
|
var matcher = RegExpWrapper.matcher(_SELECTOR_REGEXP, selector);
|
||||||
@ -52,7 +52,7 @@ export class CssSelector {
|
|||||||
}
|
}
|
||||||
inNot = true;
|
inNot = true;
|
||||||
current = new CssSelector();
|
current = new CssSelector();
|
||||||
ListWrapper.push(cssSelector.notSelectors, current);
|
cssSelector.notSelectors.push(current);
|
||||||
}
|
}
|
||||||
if (isPresent(match[2])) {
|
if (isPresent(match[2])) {
|
||||||
current.setElement(match[2]);
|
current.setElement(match[2]);
|
||||||
@ -92,16 +92,16 @@ export class CssSelector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addAttribute(name: string, value: string = _EMPTY_ATTR_VALUE) {
|
addAttribute(name: string, value: string = _EMPTY_ATTR_VALUE) {
|
||||||
ListWrapper.push(this.attrs, name.toLowerCase());
|
this.attrs.push(name.toLowerCase());
|
||||||
if (isPresent(value)) {
|
if (isPresent(value)) {
|
||||||
value = value.toLowerCase();
|
value = value.toLowerCase();
|
||||||
} else {
|
} else {
|
||||||
value = _EMPTY_ATTR_VALUE;
|
value = _EMPTY_ATTR_VALUE;
|
||||||
}
|
}
|
||||||
ListWrapper.push(this.attrs, value);
|
this.attrs.push(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
addClassName(name: string) { ListWrapper.push(this.classNames, name.toLowerCase()); }
|
addClassName(name: string) { this.classNames.push(name.toLowerCase()); }
|
||||||
|
|
||||||
toString(): string {
|
toString(): string {
|
||||||
var res = '';
|
var res = '';
|
||||||
@ -141,11 +141,11 @@ export class SelectorMatcher {
|
|||||||
return notMatcher;
|
return notMatcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _elementMap: Map<string, List<string>> = MapWrapper.create();
|
private _elementMap: Map<string, List<SelectorContext>> = MapWrapper.create();
|
||||||
private _elementPartialMap: Map<string, SelectorMatcher> = MapWrapper.create();
|
private _elementPartialMap: Map<string, SelectorMatcher> = MapWrapper.create();
|
||||||
private _classMap: Map<string, List<string>> = MapWrapper.create();
|
private _classMap: Map<string, List<SelectorContext>> = MapWrapper.create();
|
||||||
private _classPartialMap: Map<string, SelectorMatcher> = MapWrapper.create();
|
private _classPartialMap: Map<string, SelectorMatcher> = MapWrapper.create();
|
||||||
private _attrValueMap: Map<string, Map<string, List<string>>> = MapWrapper.create();
|
private _attrValueMap: Map<string, Map<string, List<SelectorContext>>> = MapWrapper.create();
|
||||||
private _attrValuePartialMap: Map<string, Map<string, SelectorMatcher>> = MapWrapper.create();
|
private _attrValuePartialMap: Map<string, Map<string, SelectorMatcher>> = MapWrapper.create();
|
||||||
private _listContexts: List<SelectorListContext> = [];
|
private _listContexts: List<SelectorListContext> = [];
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ export class SelectorMatcher {
|
|||||||
var listContext = null;
|
var listContext = null;
|
||||||
if (cssSelectors.length > 1) {
|
if (cssSelectors.length > 1) {
|
||||||
listContext = new SelectorListContext(cssSelectors);
|
listContext = new SelectorListContext(cssSelectors);
|
||||||
ListWrapper.push(this._listContexts, listContext);
|
this._listContexts.push(listContext);
|
||||||
}
|
}
|
||||||
for (var i = 0; i < cssSelectors.length; i++) {
|
for (var i = 0; i < cssSelectors.length; i++) {
|
||||||
this._addSelectable(cssSelectors[i], callbackCtxt, listContext);
|
this._addSelectable(cssSelectors[i], callbackCtxt, listContext);
|
||||||
@ -220,13 +220,14 @@ export class SelectorMatcher {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _addTerminal(map: Map<string, List<string>>, name: string, selectable: SelectorContext) {
|
private _addTerminal(map: Map<string, List<SelectorContext>>, name: string,
|
||||||
|
selectable: SelectorContext) {
|
||||||
var terminalList = MapWrapper.get(map, name);
|
var terminalList = MapWrapper.get(map, name);
|
||||||
if (isBlank(terminalList)) {
|
if (isBlank(terminalList)) {
|
||||||
terminalList = ListWrapper.create();
|
terminalList = [];
|
||||||
MapWrapper.set(map, name, terminalList);
|
MapWrapper.set(map, name, terminalList);
|
||||||
}
|
}
|
||||||
ListWrapper.push(terminalList, selectable);
|
terminalList.push(selectable);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _addPartial(map: Map<string, SelectorMatcher>, name: string): SelectorMatcher {
|
private _addPartial(map: Map<string, SelectorMatcher>, name: string): SelectorMatcher {
|
||||||
@ -297,8 +298,8 @@ export class SelectorMatcher {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
_matchTerminal(map: Map<string, List<string>>, name, cssSelector: CssSelector,
|
_matchTerminal(map: Map<string, List<SelectorContext>>, name, cssSelector: CssSelector,
|
||||||
matchedCallback /*: (CssSelector, any) => void*/): boolean {
|
matchedCallback: (CssSelector, any) => void): boolean {
|
||||||
if (isBlank(map) || isBlank(name)) {
|
if (isBlank(map) || isBlank(name)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ export class DomRenderer extends Renderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add global events
|
// add global events
|
||||||
view.eventHandlerRemovers = ListWrapper.create();
|
view.eventHandlerRemovers = [];
|
||||||
var binders = view.proto.elementBinders;
|
var binders = view.proto.elementBinders;
|
||||||
for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) {
|
for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) {
|
||||||
var binder = binders[binderIdx];
|
var binder = binders[binderIdx];
|
||||||
@ -160,7 +160,7 @@ export class DomRenderer extends Renderer {
|
|||||||
var globalEvent = binder.globalEvents[i];
|
var globalEvent = binder.globalEvents[i];
|
||||||
var remover = this._createGlobalEventListener(view, binderIdx, globalEvent.name,
|
var remover = this._createGlobalEventListener(view, binderIdx, globalEvent.name,
|
||||||
globalEvent.target, globalEvent.fullName);
|
globalEvent.target, globalEvent.fullName);
|
||||||
ListWrapper.push(view.eventHandlerRemovers, remover);
|
view.eventHandlerRemovers.push(remover);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ export class LightDom {
|
|||||||
for (var i = 0; i < els.length; i++) {
|
for (var i = 0; i < els.length; i++) {
|
||||||
var el = els[i];
|
var el = els[i];
|
||||||
if (isPresent(el.contentTag)) {
|
if (isPresent(el.contentTag)) {
|
||||||
ListWrapper.push(acc, el.contentTag);
|
acc.push(el.contentTag);
|
||||||
}
|
}
|
||||||
if (isPresent(el.viewContainer)) {
|
if (isPresent(el.viewContainer)) {
|
||||||
ListWrapper.forEach(el.viewContainer.contentTagContainers(),
|
ListWrapper.forEach(el.viewContainer.contentTagContainers(),
|
||||||
@ -83,10 +83,10 @@ export class LightDom {
|
|||||||
} else if (isPresent(content)) {
|
} else if (isPresent(content)) {
|
||||||
res = ListWrapper.concat(res, content.nodes());
|
res = ListWrapper.concat(res, content.nodes());
|
||||||
} else {
|
} else {
|
||||||
ListWrapper.push(res, root.node);
|
res.push(root.node);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ListWrapper.push(res, root.node);
|
res.push(root.node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
@ -303,7 +303,7 @@ export class ShadowCss {
|
|||||||
var p = parts[i];
|
var p = parts[i];
|
||||||
if (isBlank(p)) break;
|
if (isBlank(p)) break;
|
||||||
p = p.trim();
|
p = p.trim();
|
||||||
ListWrapper.push(r, partReplacer(_polyfillHostNoCombinator, p, m[3]));
|
r.push(partReplacer(_polyfillHostNoCombinator, p, m[3]));
|
||||||
}
|
}
|
||||||
return r.join(',');
|
return r.join(',');
|
||||||
} else {
|
} else {
|
||||||
@ -392,7 +392,7 @@ export class ShadowCss {
|
|||||||
this._applyStrictSelectorScope(p, scopeSelector) :
|
this._applyStrictSelectorScope(p, scopeSelector) :
|
||||||
this._applySelectorScope(p, scopeSelector, hostSelector);
|
this._applySelectorScope(p, scopeSelector, hostSelector);
|
||||||
}
|
}
|
||||||
ListWrapper.push(r, p);
|
r.push(p);
|
||||||
}
|
}
|
||||||
return r.join(', ');
|
return r.join(', ');
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ export class ShadowDomCompileStep implements CompileStep {
|
|||||||
var stylePromise = this._shadowDomStrategy.processStyleElement(
|
var stylePromise = this._shadowDomStrategy.processStyleElement(
|
||||||
this._template.componentId, this._template.templateAbsUrl, current.element);
|
this._template.componentId, this._template.templateAbsUrl, current.element);
|
||||||
if (isPresent(stylePromise) && isPromise(stylePromise)) {
|
if (isPresent(stylePromise) && isPromise(stylePromise)) {
|
||||||
ListWrapper.push(this._subTaskPromises, stylePromise);
|
this._subTaskPromises.push(stylePromise);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Style elements should not be further processed by the compiler, as they can not contain
|
// Style elements should not be further processed by the compiler, as they can not contain
|
||||||
|
@ -73,7 +73,7 @@ export class StyleInliner {
|
|||||||
// Importing again might cause a circular dependency
|
// Importing again might cause a circular dependency
|
||||||
promise = PromiseWrapper.resolve(prefix);
|
promise = PromiseWrapper.resolve(prefix);
|
||||||
} else {
|
} else {
|
||||||
ListWrapper.push(inlinedUrls, url);
|
inlinedUrls.push(url);
|
||||||
promise = PromiseWrapper.then(this._xhr.get(url), (rawCss) => {
|
promise = PromiseWrapper.then(this._xhr.get(url), (rawCss) => {
|
||||||
// resolve nested @import rules
|
// resolve nested @import rules
|
||||||
var inlinedCss = this._inlineImports(rawCss, url, inlinedUrls);
|
var inlinedCss = this._inlineImports(rawCss, url, inlinedUrls);
|
||||||
@ -88,7 +88,7 @@ export class StyleInliner {
|
|||||||
}
|
}
|
||||||
}, (error) => `/* failed to import ${url} */\n`);
|
}, (error) => `/* failed to import ${url} */\n`);
|
||||||
}
|
}
|
||||||
ListWrapper.push(promises, promise);
|
promises.push(promise);
|
||||||
partIndex += 2;
|
partIndex += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ export class ProtoViewBuilder {
|
|||||||
|
|
||||||
bindElement(element, description = null): ElementBinderBuilder {
|
bindElement(element, description = null): ElementBinderBuilder {
|
||||||
var builder = new ElementBinderBuilder(this.elements.length, element, description);
|
var builder = new ElementBinderBuilder(this.elements.length, element, description);
|
||||||
ListWrapper.push(this.elements, builder);
|
this.elements.push(builder);
|
||||||
DOM.addClass(element, NG_BINDING_CLASS);
|
DOM.addClass(element, NG_BINDING_CLASS);
|
||||||
|
|
||||||
return builder;
|
return builder;
|
||||||
@ -90,7 +90,7 @@ export class ProtoViewBuilder {
|
|||||||
transitiveContentTagCount++;
|
transitiveContentTagCount++;
|
||||||
}
|
}
|
||||||
var parentIndex = isPresent(ebb.parent) ? ebb.parent.index : -1;
|
var parentIndex = isPresent(ebb.parent) ? ebb.parent.index : -1;
|
||||||
ListWrapper.push(apiElementBinders, new api.ElementBinder({
|
apiElementBinders.push(new api.ElementBinder({
|
||||||
index: ebb.index,
|
index: ebb.index,
|
||||||
parentIndex: parentIndex,
|
parentIndex: parentIndex,
|
||||||
distanceToParent: ebb.distanceToParent,
|
distanceToParent: ebb.distanceToParent,
|
||||||
@ -103,22 +103,21 @@ export class ProtoViewBuilder {
|
|||||||
readAttributes: ebb.readAttributes
|
readAttributes: ebb.readAttributes
|
||||||
}));
|
}));
|
||||||
var elementIsEmpty = this._isEmptyElement(ebb.element);
|
var elementIsEmpty = this._isEmptyElement(ebb.element);
|
||||||
ListWrapper.push(renderElementBinders, new ElementBinder({
|
renderElementBinders.push(new ElementBinder({
|
||||||
textNodeIndices: ebb.textBindingIndices,
|
textNodeIndices: ebb.textBindingIndices,
|
||||||
contentTagSelector: ebb.contentTagSelector,
|
contentTagSelector: ebb.contentTagSelector,
|
||||||
parentIndex: parentIndex,
|
parentIndex: parentIndex,
|
||||||
distanceToParent: ebb.distanceToParent,
|
distanceToParent: ebb.distanceToParent,
|
||||||
nestedProtoView: isPresent(nestedProtoView) ?
|
nestedProtoView:
|
||||||
resolveInternalDomProtoView(nestedProtoView.render) :
|
isPresent(nestedProtoView) ? resolveInternalDomProtoView(nestedProtoView.render) : null,
|
||||||
null,
|
componentId: ebb.componentId,
|
||||||
componentId: ebb.componentId,
|
eventLocals: new LiteralArray(ebb.eventBuilder.buildEventLocals()),
|
||||||
eventLocals: new LiteralArray(ebb.eventBuilder.buildEventLocals()),
|
localEvents: ebb.eventBuilder.buildLocalEvents(),
|
||||||
localEvents: ebb.eventBuilder.buildLocalEvents(),
|
globalEvents: ebb.eventBuilder.buildGlobalEvents(),
|
||||||
globalEvents: ebb.eventBuilder.buildGlobalEvents(),
|
hostActions: hostActions,
|
||||||
hostActions: hostActions,
|
propertySetters: propertySetters,
|
||||||
propertySetters: propertySetters,
|
elementIsEmpty: elementIsEmpty
|
||||||
elementIsEmpty: elementIsEmpty
|
}));
|
||||||
}));
|
|
||||||
});
|
});
|
||||||
return new api.ProtoViewDto({
|
return new api.ProtoViewDto({
|
||||||
render: new DomProtoViewRef(new DomProtoView({
|
render: new DomProtoViewRef(new DomProtoView({
|
||||||
@ -178,7 +177,7 @@ export class ElementBinderBuilder {
|
|||||||
|
|
||||||
bindDirective(directiveIndex: number): DirectiveBuilder {
|
bindDirective(directiveIndex: number): DirectiveBuilder {
|
||||||
var directive = new DirectiveBuilder(directiveIndex);
|
var directive = new DirectiveBuilder(directiveIndex);
|
||||||
ListWrapper.push(this.directives, directive);
|
this.directives.push(directive);
|
||||||
return directive;
|
return directive;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,12 +210,12 @@ export class ElementBinderBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bindEvent(name, expression, target = null) {
|
bindEvent(name, expression, target = null) {
|
||||||
ListWrapper.push(this.eventBindings, this.eventBuilder.add(name, expression, target));
|
this.eventBindings.push(this.eventBuilder.add(name, expression, target));
|
||||||
}
|
}
|
||||||
|
|
||||||
bindText(index, expression) {
|
bindText(index, expression) {
|
||||||
ListWrapper.push(this.textBindingIndices, index);
|
this.textBindingIndices.push(index);
|
||||||
ListWrapper.push(this.textBindings, expression);
|
this.textBindings.push(expression);
|
||||||
}
|
}
|
||||||
|
|
||||||
setContentTagSelector(value: string) { this.contentTagSelector = value; }
|
setContentTagSelector(value: string) { this.contentTagSelector = value; }
|
||||||
@ -240,11 +239,11 @@ export class DirectiveBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bindHostAction(actionName: string, actionExpression: string, expression: ASTWithSource) {
|
bindHostAction(actionName: string, actionExpression: string, expression: ASTWithSource) {
|
||||||
ListWrapper.push(this.hostActions, new HostAction(actionName, actionExpression, expression));
|
this.hostActions.push(new HostAction(actionName, actionExpression, expression));
|
||||||
}
|
}
|
||||||
|
|
||||||
bindEvent(name, expression, target = null) {
|
bindEvent(name, expression, target = null) {
|
||||||
ListWrapper.push(this.eventBindings, this.eventBuilder.add(name, expression, target));
|
this.eventBindings.push(this.eventBuilder.add(name, expression, target));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,9 +265,9 @@ export class EventBuilder extends AstTransformer {
|
|||||||
fullName, new ASTWithSource(adjustedAst, source.source, source.location));
|
fullName, new ASTWithSource(adjustedAst, source.source, source.location));
|
||||||
var event = new Event(name, target, fullName);
|
var event = new Event(name, target, fullName);
|
||||||
if (isBlank(target)) {
|
if (isBlank(target)) {
|
||||||
ListWrapper.push(this.localEvents, event);
|
this.localEvents.push(event);
|
||||||
} else {
|
} else {
|
||||||
ListWrapper.push(this.globalEvents, event);
|
this.globalEvents.push(event);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -285,7 +284,7 @@ export class EventBuilder extends AstTransformer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isEventAccess) {
|
if (isEventAccess) {
|
||||||
ListWrapper.push(this.locals, ast);
|
this.locals.push(ast);
|
||||||
var index = this.locals.length - 1;
|
var index = this.locals.length - 1;
|
||||||
return new AccessMember(this._implicitReceiver, `${index}`, (arr) => arr[index], null);
|
return new AccessMember(this._implicitReceiver, `${index}`, (arr) => arr[index], null);
|
||||||
} else {
|
} else {
|
||||||
@ -306,13 +305,13 @@ export class EventBuilder extends AstTransformer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_merge(host: List<Event>, tobeAdded: List<Event>) {
|
_merge(host: List<Event>, tobeAdded: List<Event>) {
|
||||||
var names = ListWrapper.create();
|
var names = [];
|
||||||
for (var i = 0; i < host.length; i++) {
|
for (var i = 0; i < host.length; i++) {
|
||||||
ListWrapper.push(names, host[i].fullName);
|
names.push(host[i].fullName);
|
||||||
}
|
}
|
||||||
for (var j = 0; j < tobeAdded.length; j++) {
|
for (var j = 0; j < tobeAdded.length; j++) {
|
||||||
if (!ListWrapper.contains(names, tobeAdded[j].fullName)) {
|
if (!ListWrapper.contains(names, tobeAdded[j].fullName)) {
|
||||||
ListWrapper.push(host, tobeAdded[j]);
|
host.push(tobeAdded[j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import {PromiseWrapper, Promise} from 'angular2/src/facade/async';
|
|||||||
export class MockXHR extends XHR {
|
export class MockXHR extends XHR {
|
||||||
private _expectations: List<_Expectation>;
|
private _expectations: List<_Expectation>;
|
||||||
private _definitions: Map<string, string>;
|
private _definitions: Map<string, string>;
|
||||||
private _requests: List<Promise<string>>;
|
private _requests: List<_PendingRequest>;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
@ -17,13 +17,13 @@ export class MockXHR extends XHR {
|
|||||||
|
|
||||||
get(url: string): Promise<string> {
|
get(url: string): Promise<string> {
|
||||||
var request = new _PendingRequest(url);
|
var request = new _PendingRequest(url);
|
||||||
ListWrapper.push(this._requests, request);
|
this._requests.push(request);
|
||||||
return request.getPromise();
|
return request.getPromise();
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(url: string, response: string) {
|
expect(url: string, response: string) {
|
||||||
var expectation = new _Expectation(url, response);
|
var expectation = new _Expectation(url, response);
|
||||||
ListWrapper.push(this._expectations, expectation);
|
this._expectations.push(expectation);
|
||||||
}
|
}
|
||||||
|
|
||||||
when(url: string, response: string) { MapWrapper.set(this._definitions, url, response); }
|
when(url: string, response: string) { MapWrapper.set(this._definitions, url, response); }
|
||||||
@ -47,7 +47,7 @@ export class MockXHR extends XHR {
|
|||||||
var urls = [];
|
var urls = [];
|
||||||
for (var i = 0; i < this._expectations.length; i++) {
|
for (var i = 0; i < this._expectations.length; i++) {
|
||||||
var expectation = this._expectations[i];
|
var expectation = this._expectations[i];
|
||||||
ListWrapper.push(urls, expectation.url);
|
urls.push(expectation.url);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new BaseException(`Unsatisfied requests: ${ListWrapper.join(urls, ', ')}`);
|
throw new BaseException(`Unsatisfied requests: ${ListWrapper.join(urls, ', ')}`);
|
||||||
|
@ -76,7 +76,7 @@ function parsePathString(route: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var segments = splitBySlash(route);
|
var segments = splitBySlash(route);
|
||||||
var results = ListWrapper.create();
|
var results = [];
|
||||||
var specificity = 0;
|
var specificity = 0;
|
||||||
|
|
||||||
// The "specificity" of a path is used to determine which route is used when multiple routes match
|
// The "specificity" of a path is used to determine which route is used when multiple routes match
|
||||||
@ -97,12 +97,12 @@ function parsePathString(route: string) {
|
|||||||
var segment = segments[i], match;
|
var segment = segments[i], match;
|
||||||
|
|
||||||
if (isPresent(match = RegExpWrapper.firstMatch(paramMatcher, segment))) {
|
if (isPresent(match = RegExpWrapper.firstMatch(paramMatcher, segment))) {
|
||||||
ListWrapper.push(results, new DynamicSegment(match[1]));
|
results.push(new DynamicSegment(match[1]));
|
||||||
specificity += (100 - i);
|
specificity += (100 - i);
|
||||||
} else if (isPresent(match = RegExpWrapper.firstMatch(wildcardMatcher, segment))) {
|
} else if (isPresent(match = RegExpWrapper.firstMatch(wildcardMatcher, segment))) {
|
||||||
ListWrapper.push(results, new StarSegment(match[1]));
|
results.push(new StarSegment(match[1]));
|
||||||
} else if (segment.length > 0) {
|
} else if (segment.length > 0) {
|
||||||
ListWrapper.push(results, new StaticSegment(segment));
|
results.push(new StaticSegment(segment));
|
||||||
specificity += 100 * (100 - i);
|
specificity += 100 * (100 - i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ export class RouteRecognizer {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
recognize(url: string): List<RouteMatch> {
|
recognize(url: string): List<RouteMatch> {
|
||||||
var solutions = ListWrapper.create();
|
var solutions = [];
|
||||||
|
|
||||||
MapWrapper.forEach(this.redirects, (target, path) => {
|
MapWrapper.forEach(this.redirects, (target, path) => {
|
||||||
// "/" redirect case
|
// "/" redirect case
|
||||||
@ -77,13 +77,13 @@ export class RouteRecognizer {
|
|||||||
matchedUrl = match[0];
|
matchedUrl = match[0];
|
||||||
unmatchedUrl = StringWrapper.substring(url, match[0].length);
|
unmatchedUrl = StringWrapper.substring(url, match[0].length);
|
||||||
}
|
}
|
||||||
ListWrapper.push(solutions, new RouteMatch({
|
solutions.push(new RouteMatch({
|
||||||
specificity: pathRecognizer.specificity,
|
specificity: pathRecognizer.specificity,
|
||||||
handler: pathRecognizer.handler,
|
handler: pathRecognizer.handler,
|
||||||
params: pathRecognizer.parseParams(url),
|
params: pathRecognizer.parseParams(url),
|
||||||
matchedUrl: matchedUrl,
|
matchedUrl: matchedUrl,
|
||||||
unmatchedUrl: unmatchedUrl
|
unmatchedUrl: unmatchedUrl
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/// <reference path="../../typings/jasmine/jasmine"/>
|
/// <reference path="../../typings/jasmine/jasmine.d.ts"/>
|
||||||
|
|
||||||
import {BaseException, global} from 'angular2/src/facade/lang';
|
import {BaseException, global} from 'angular2/src/facade/lang';
|
||||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
import {ListWrapper} from 'angular2/src/facade/collection';
|
||||||
@ -95,7 +95,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 cb = _fnAndFlush(fn);
|
||||||
var id = _scheduler.scheduleFunction(cb, delay, args);
|
var id = _scheduler.scheduleFunction(cb, delay, args);
|
||||||
ListWrapper.push(_pendingTimers, id);
|
_pendingTimers.push(id);
|
||||||
_scheduler.scheduleFunction(_dequeueTimer(id), delay);
|
_scheduler.scheduleFunction(_dequeueTimer(id), delay);
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@ -124,7 +124,7 @@ function _fnAndFlush(fn: Function): Function {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function _scheduleMicrotask(microtask: Function): void {
|
function _scheduleMicrotask(microtask: Function): void {
|
||||||
ListWrapper.push(_microtasks, microtask);
|
_microtasks.push(microtask);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _dequeueTimer(id: number): Function {
|
function _dequeueTimer(id: number): Function {
|
||||||
|
@ -8,12 +8,10 @@ export class Log {
|
|||||||
|
|
||||||
constructor() { this._result = []; }
|
constructor() { this._result = []; }
|
||||||
|
|
||||||
add(value): void { ListWrapper.push(this._result, value); }
|
add(value): void { this._result.push(value); }
|
||||||
|
|
||||||
fn(value) {
|
fn(value) {
|
||||||
return (a1 = null, a2 = null, a3 = null, a4 = null, a5 = null) => {
|
return (a1 = null, a2 = null, a3 = null, a4 = null, a5 = null) => { this._result.push(value); }
|
||||||
ListWrapper.push(this._result, value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
result(): string { return ListWrapper.join(this._result, "; "); }
|
result(): string { return ListWrapper.join(this._result, "; "); }
|
||||||
@ -72,8 +70,8 @@ export function stringifyElement(el): string {
|
|||||||
|
|
||||||
// Attributes in an ordered way
|
// Attributes in an ordered way
|
||||||
var attributeMap = DOM.attributeMap(el);
|
var attributeMap = DOM.attributeMap(el);
|
||||||
var keys = ListWrapper.create();
|
var keys = [];
|
||||||
MapWrapper.forEach(attributeMap, (v, k) => { ListWrapper.push(keys, k); });
|
MapWrapper.forEach(attributeMap, (v, k) => { keys.push(k); });
|
||||||
ListWrapper.sort(keys);
|
ListWrapper.sort(keys);
|
||||||
for (let i = 0; i < keys.length; i++) {
|
for (let i = 0; i < keys.length; i++) {
|
||||||
var key = keys[i];
|
var key = keys[i];
|
||||||
|
@ -35,7 +35,7 @@ function _convertLocalsToVariableBindings(locals: Locals): List<any> {
|
|||||||
var variableBindings = [];
|
var variableBindings = [];
|
||||||
var loc = locals;
|
var loc = locals;
|
||||||
while (isPresent(loc) && isPresent(loc.current)) {
|
while (isPresent(loc) && isPresent(loc.current)) {
|
||||||
MapWrapper.forEach(loc.current, (v, k) => ListWrapper.push(variableBindings, k));
|
MapWrapper.forEach(loc.current, (v, k) => variableBindings.push(k));
|
||||||
loc = loc.parent;
|
loc = loc.parent;
|
||||||
}
|
}
|
||||||
return variableBindings;
|
return variableBindings;
|
||||||
|
@ -455,9 +455,9 @@ export function main() {
|
|||||||
|
|
||||||
var onChangesDoneCalls = [];
|
var onChangesDoneCalls = [];
|
||||||
var td1;
|
var td1;
|
||||||
td1 = new TestDirective(() => ListWrapper.push(onChangesDoneCalls, td1));
|
td1 = new TestDirective(() => onChangesDoneCalls.push(td1));
|
||||||
var td2;
|
var td2;
|
||||||
td2 = new TestDirective(() => ListWrapper.push(onChangesDoneCalls, td2));
|
td2 = new TestDirective(() => onChangesDoneCalls.push(td2));
|
||||||
cd.hydrate(_DEFAULT_CONTEXT, null, new FakeDirectives([td1, td2], []));
|
cd.hydrate(_DEFAULT_CONTEXT, null, new FakeDirectives([td1, td2], []));
|
||||||
|
|
||||||
cd.detectChanges();
|
cd.detectChanges();
|
||||||
@ -473,11 +473,11 @@ export function main() {
|
|||||||
var orderOfOperations = [];
|
var orderOfOperations = [];
|
||||||
|
|
||||||
var directiveInShadowDom = null;
|
var directiveInShadowDom = null;
|
||||||
directiveInShadowDom = new TestDirective(
|
directiveInShadowDom =
|
||||||
() => { ListWrapper.push(orderOfOperations, directiveInShadowDom); });
|
new TestDirective(() => { orderOfOperations.push(directiveInShadowDom); });
|
||||||
var parentDirective = null;
|
var parentDirective = null;
|
||||||
parentDirective = new TestDirective(
|
parentDirective =
|
||||||
() => { ListWrapper.push(orderOfOperations, parentDirective); });
|
new TestDirective(() => { orderOfOperations.push(parentDirective); });
|
||||||
|
|
||||||
parent.hydrate(_DEFAULT_CONTEXT, null, new FakeDirectives([parentDirective], []));
|
parent.hydrate(_DEFAULT_CONTEXT, null, new FakeDirectives([parentDirective], []));
|
||||||
child.hydrate(_DEFAULT_CONTEXT, null, new FakeDirectives([directiveInShadowDom], []));
|
child.hydrate(_DEFAULT_CONTEXT, null, new FakeDirectives([directiveInShadowDom], []));
|
||||||
@ -989,14 +989,14 @@ class TestDispatcher extends ChangeDispatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
clear() {
|
clear() {
|
||||||
this.log = ListWrapper.create();
|
this.log = [];
|
||||||
this.loggedValues = ListWrapper.create();
|
this.loggedValues = [];
|
||||||
this.onAllChangesDoneCalled = true;
|
this.onAllChangesDoneCalled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
notifyOnBinding(binding, value) {
|
notifyOnBinding(binding, value) {
|
||||||
ListWrapper.push(this.log, `${binding.propertyName}=${this._asString(value)}`);
|
this.log.push(`${binding.propertyName}=${this._asString(value)}`);
|
||||||
ListWrapper.push(this.loggedValues, value);
|
this.loggedValues.push(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
notifyOnAllChangesDone() { this.onAllChangesDoneCalled = true; }
|
notifyOnAllChangesDone() { this.onAllChangesDoneCalled = true; }
|
||||||
|
@ -63,7 +63,7 @@ export function main() {
|
|||||||
var c = isBlank(passedInContext) ? td() : passedInContext;
|
var c = isBlank(passedInContext) ? td() : passedInContext;
|
||||||
var res = [];
|
var res = [];
|
||||||
for (var i = 0; i < asts.length; i++) {
|
for (var i = 0; i < asts.length; i++) {
|
||||||
ListWrapper.push(res, asts[i].eval(c, emptyLocals()));
|
res.push(asts[i].eval(c, emptyLocals()));
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,6 @@ import {
|
|||||||
IS_DARTIUM
|
IS_DARTIUM
|
||||||
} from 'angular2/test_lib';
|
} from 'angular2/test_lib';
|
||||||
import {Json, RegExp, NumberWrapper, StringWrapper} from 'angular2/src/facade/lang';
|
import {Json, RegExp, NumberWrapper, StringWrapper} from 'angular2/src/facade/lang';
|
||||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
|
||||||
|
|
||||||
import {JsonPipe} from 'angular2/src/change_detection/pipes/json_pipe';
|
import {JsonPipe} from 'angular2/src/change_detection/pipes/json_pipe';
|
||||||
|
|
||||||
@ -26,7 +25,7 @@ export function main() {
|
|||||||
var inceptionObjString;
|
var inceptionObjString;
|
||||||
var catString;
|
var catString;
|
||||||
var pipe;
|
var pipe;
|
||||||
var collection;
|
var collection: number[];
|
||||||
|
|
||||||
function normalize(obj: string): string { return StringWrapper.replace(obj, regNewLine, ''); }
|
function normalize(obj: string): string { return StringWrapper.replace(obj, regNewLine, ''); }
|
||||||
|
|
||||||
@ -87,7 +86,7 @@ export function main() {
|
|||||||
|
|
||||||
expect(pipe.transform(collection)).toEqual(stringCollection);
|
expect(pipe.transform(collection)).toEqual(stringCollection);
|
||||||
|
|
||||||
ListWrapper.push(collection, 1);
|
collection.push(1);
|
||||||
|
|
||||||
expect(pipe.transform(collection)).toEqual(stringCollectionWith1);
|
expect(pipe.transform(collection)).toEqual(stringCollectionWith1);
|
||||||
});
|
});
|
||||||
|
@ -41,7 +41,8 @@ import {RenderCompiler} from 'angular2/src/render/api';
|
|||||||
export function main() {
|
export function main() {
|
||||||
describe('compiler', function() {
|
describe('compiler', function() {
|
||||||
var directiveResolver, tplResolver, renderCompiler, protoViewFactory, cmpUrlMapper,
|
var directiveResolver, tplResolver, renderCompiler, protoViewFactory, cmpUrlMapper,
|
||||||
renderCompileRequests, rootProtoView;
|
rootProtoView;
|
||||||
|
var renderCompileRequests: any[];
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
directiveResolver = new DirectiveResolver();
|
directiveResolver = new DirectiveResolver();
|
||||||
@ -61,7 +62,7 @@ export function main() {
|
|||||||
var urlResolver = new FakeUrlResolver();
|
var urlResolver = new FakeUrlResolver();
|
||||||
renderCompileRequests = [];
|
renderCompileRequests = [];
|
||||||
renderCompiler.spy('compile').andCallFake((template) => {
|
renderCompiler.spy('compile').andCallFake((template) => {
|
||||||
ListWrapper.push(renderCompileRequests, template);
|
renderCompileRequests.push(template);
|
||||||
return PromiseWrapper.resolve(ListWrapper.removeAt(renderCompileResults, 0));
|
return PromiseWrapper.resolve(ListWrapper.removeAt(renderCompileResults, 0));
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -607,7 +608,7 @@ class FakeProtoViewFactory extends ProtoViewFactory {
|
|||||||
|
|
||||||
createAppProtoViews(componentBinding: DirectiveBinding, renderProtoView: renderApi.ProtoViewDto,
|
createAppProtoViews(componentBinding: DirectiveBinding, renderProtoView: renderApi.ProtoViewDto,
|
||||||
directives: List<DirectiveBinding>): List<AppProtoView> {
|
directives: List<DirectiveBinding>): List<AppProtoView> {
|
||||||
ListWrapper.push(this.requests, [componentBinding, renderProtoView, directives]);
|
this.requests.push([componentBinding, renderProtoView, directives]);
|
||||||
return ListWrapper.removeAt(this.results, 0);
|
return ListWrapper.removeAt(this.results, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -226,7 +226,7 @@ export function main() {
|
|||||||
var dynamicBindings = [];
|
var dynamicBindings = [];
|
||||||
|
|
||||||
for (var i = 0; i < 20; i++) {
|
for (var i = 0; i < 20; i++) {
|
||||||
ListWrapper.push(dynamicBindings, bind(i).toValue(i));
|
dynamicBindings.push(bind(i).toValue(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
function createPei(parent, index, bindings, distance = 1, hasShadowRoot = false) {
|
function createPei(parent, index, bindings, distance = 1, hasShadowRoot = false) {
|
||||||
@ -1090,6 +1090,6 @@ class FakeRenderer extends Renderer {
|
|||||||
this.log = [];
|
this.log = [];
|
||||||
}
|
}
|
||||||
setElementProperty(viewRef, elementIndex, propertyName, value) {
|
setElementProperty(viewRef, elementIndex, propertyName, value) {
|
||||||
ListWrapper.push(this.log, [viewRef, elementIndex, propertyName, value]);
|
this.log.push([viewRef, elementIndex, propertyName, value]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,8 +42,8 @@ export function main() {
|
|||||||
var viewPool;
|
var viewPool;
|
||||||
var manager;
|
var manager;
|
||||||
var directiveResolver;
|
var directiveResolver;
|
||||||
var createdViews;
|
var createdViews: any[];
|
||||||
var createdRenderViews;
|
var createdRenderViews: any[];
|
||||||
|
|
||||||
function wrapPv(protoView: AppProtoView): ProtoViewRef { return new ProtoViewRef(protoView); }
|
function wrapPv(protoView: AppProtoView): ProtoViewRef { return new ProtoViewRef(protoView); }
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ export function main() {
|
|||||||
utils.spy('createView')
|
utils.spy('createView')
|
||||||
.andCallFake((proto, renderViewRef, _a, _b) => {
|
.andCallFake((proto, renderViewRef, _a, _b) => {
|
||||||
var view = createView(proto, renderViewRef);
|
var view = createView(proto, renderViewRef);
|
||||||
ListWrapper.push(createdViews, view);
|
createdViews.push(view);
|
||||||
return view;
|
return view;
|
||||||
});
|
});
|
||||||
utils.spy('attachComponentView')
|
utils.spy('attachComponentView')
|
||||||
@ -143,13 +143,13 @@ export function main() {
|
|||||||
renderer.spy('createRootHostView')
|
renderer.spy('createRootHostView')
|
||||||
.andCallFake((_b, _c) => {
|
.andCallFake((_b, _c) => {
|
||||||
var rv = new RenderViewRef();
|
var rv = new RenderViewRef();
|
||||||
ListWrapper.push(createdRenderViews, rv);
|
createdRenderViews.push(rv);
|
||||||
return rv;
|
return rv;
|
||||||
});
|
});
|
||||||
renderer.spy('createView')
|
renderer.spy('createView')
|
||||||
.andCallFake((_a) => {
|
.andCallFake((_a) => {
|
||||||
var rv = new RenderViewRef();
|
var rv = new RenderViewRef();
|
||||||
ListWrapper.push(createdRenderViews, rv);
|
createdRenderViews.push(rv);
|
||||||
return rv;
|
return rv;
|
||||||
});
|
});
|
||||||
viewPool.spy('returnView').andReturn(true);
|
viewPool.spy('returnView').andReturn(true);
|
||||||
|
@ -74,13 +74,13 @@ class LifecycleDir {
|
|||||||
|
|
||||||
constructor() { this.log = []; }
|
constructor() { this.log = []; }
|
||||||
|
|
||||||
onChange(_) { ListWrapper.push(this.log, "onChange"); }
|
onChange(_) { this.log.push("onChange"); }
|
||||||
|
|
||||||
onInit() { ListWrapper.push(this.log, "onInit"); }
|
onInit() { this.log.push("onInit"); }
|
||||||
|
|
||||||
onCheck() { ListWrapper.push(this.log, "onCheck"); }
|
onCheck() { this.log.push("onCheck"); }
|
||||||
|
|
||||||
onAllChangesDone() { ListWrapper.push(this.log, "onAllChangesDone"); }
|
onAllChangesDone() { this.log.push("onAllChangesDone"); }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component({selector: 'my-comp'})
|
@Component({selector: 'my-comp'})
|
||||||
|
@ -14,7 +14,6 @@ import {
|
|||||||
} from 'angular2/test_lib';
|
} from 'angular2/test_lib';
|
||||||
|
|
||||||
import {PromiseWrapper, TimerWrapper} from 'angular2/src/facade/async';
|
import {PromiseWrapper, TimerWrapper} from 'angular2/src/facade/async';
|
||||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
|
||||||
import {BaseException} from 'angular2/src/facade/lang';
|
import {BaseException} from 'angular2/src/facade/lang';
|
||||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||||
|
|
||||||
@ -33,13 +32,13 @@ function microTask(fn: Function): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var _log;
|
var _log;
|
||||||
var _errors;
|
var _errors: any[];
|
||||||
var _traces;
|
var _traces: any[];
|
||||||
var _zone;
|
var _zone;
|
||||||
|
|
||||||
function logError(error, stackTrace) {
|
function logError(error, stackTrace) {
|
||||||
ListWrapper.push(_errors, error);
|
_errors.push(error);
|
||||||
ListWrapper.push(_traces, stackTrace);
|
_traces.push(stackTrace);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
@ -205,7 +204,8 @@ function commonTests() {
|
|||||||
_zone.initCallbacks({
|
_zone.initCallbacks({
|
||||||
onTurnDone: () => {
|
onTurnDone: () => {
|
||||||
_log.add('onTurnDone:started');
|
_log.add('onTurnDone:started');
|
||||||
_zone.run(() => _log.add('nested run')) _log.add('onTurnDone:finished');
|
_zone.run(() => _log.add('nested run'));
|
||||||
|
_log.add('onTurnDone:finished');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -36,9 +36,9 @@ import {NgFor} from 'angular2/src/directives/ng_for';
|
|||||||
class Logger {
|
class Logger {
|
||||||
log: List<string>;
|
log: List<string>;
|
||||||
|
|
||||||
constructor() { this.log = ListWrapper.create(); }
|
constructor() { this.log = []; }
|
||||||
|
|
||||||
add(thing: string) { ListWrapper.push(this.log, thing); }
|
add(thing: string) { this.log.push(thing); }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Directive({selector: '[message]', properties: ['message']})
|
@Directive({selector: '[message]', properties: ['message']})
|
||||||
|
@ -43,7 +43,7 @@ export function main() {
|
|||||||
.then((view) => {
|
.then((view) => {
|
||||||
view.detectChanges();
|
view.detectChanges();
|
||||||
|
|
||||||
ListWrapper.push(view.context.items, 3);
|
(<number[]>view.context.items).push(3);
|
||||||
view.detectChanges();
|
view.detectChanges();
|
||||||
|
|
||||||
expect(DOM.getText(view.rootNodes[0])).toEqual('1;2;3;');
|
expect(DOM.getText(view.rootNodes[0])).toEqual('1;2;3;');
|
||||||
@ -72,7 +72,7 @@ export function main() {
|
|||||||
view.detectChanges();
|
view.detectChanges();
|
||||||
|
|
||||||
ListWrapper.removeAt(view.context.items, 0);
|
ListWrapper.removeAt(view.context.items, 0);
|
||||||
ListWrapper.push(view.context.items, 1);
|
(<number[]>view.context.items).push(1);
|
||||||
view.detectChanges();
|
view.detectChanges();
|
||||||
|
|
||||||
expect(DOM.getText(view.rootNodes[0])).toEqual('2;1;');
|
expect(DOM.getText(view.rootNodes[0])).toEqual('2;1;');
|
||||||
@ -108,7 +108,7 @@ export function main() {
|
|||||||
expect(DOM.getText(view.rootNodes[0])).toEqual('misko;shyam;');
|
expect(DOM.getText(view.rootNodes[0])).toEqual('misko;shyam;');
|
||||||
|
|
||||||
// GROW
|
// GROW
|
||||||
ListWrapper.push(view.context.items, {'name': 'adam'});
|
(<any[]>view.context.items).push({'name': 'adam'});
|
||||||
view.detectChanges();
|
view.detectChanges();
|
||||||
|
|
||||||
expect(DOM.getText(view.rootNodes[0])).toEqual('misko;shyam;adam;');
|
expect(DOM.getText(view.rootNodes[0])).toEqual('misko;shyam;adam;');
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
import {describe, it, expect, beforeEach, ddescribe, iit, xit, el} from 'angular2/test_lib';
|
import {describe, it, expect, beforeEach, ddescribe, iit, xit, el} from 'angular2/test_lib';
|
||||||
|
|
||||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
|
||||||
import {
|
import {
|
||||||
isPresent,
|
isPresent,
|
||||||
RegExpWrapper,
|
RegExpWrapper,
|
||||||
@ -18,7 +16,7 @@ export function main() {
|
|||||||
var m;
|
var m;
|
||||||
|
|
||||||
while (isPresent(m = RegExpMatcherWrapper.next(matcher))) {
|
while (isPresent(m = RegExpMatcherWrapper.next(matcher))) {
|
||||||
ListWrapper.push(indexes, m.index);
|
indexes.push(m.index);
|
||||||
expect(m[0]).toEqual('!');
|
expect(m[0]).toEqual('!');
|
||||||
expect(m[1]).toEqual('!');
|
expect(m[1]).toEqual('!');
|
||||||
expect(m.length).toBe(2);
|
expect(m.length).toBe(2);
|
||||||
|
@ -15,7 +15,6 @@ import {
|
|||||||
} from 'angular2/test_lib';
|
} from 'angular2/test_lib';
|
||||||
import {ControlGroup, Control, ControlArray, Validators} from 'angular2/forms';
|
import {ControlGroup, Control, ControlArray, Validators} from 'angular2/forms';
|
||||||
import {ObservableWrapper} from 'angular2/src/facade/async';
|
import {ObservableWrapper} from 'angular2/src/facade/async';
|
||||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
describe("Form Model", () => {
|
describe("Form Model", () => {
|
||||||
@ -312,7 +311,7 @@ export function main() {
|
|||||||
var loggedValues = [];
|
var loggedValues = [];
|
||||||
|
|
||||||
ObservableWrapper.subscribe(g.valueChanges, (value) => {
|
ObservableWrapper.subscribe(g.valueChanges, (value) => {
|
||||||
ListWrapper.push(loggedValues, value);
|
loggedValues.push(value);
|
||||||
|
|
||||||
if (loggedValues.length == 2) {
|
if (loggedValues.length == 2) {
|
||||||
expect(loggedValues)
|
expect(loggedValues)
|
||||||
|
@ -30,7 +30,7 @@ import {resolveInternalDomProtoView} from 'angular2/src/render/dom/view/proto_vi
|
|||||||
|
|
||||||
export function runCompilerCommonTests() {
|
export function runCompilerCommonTests() {
|
||||||
describe('DomCompiler', function() {
|
describe('DomCompiler', function() {
|
||||||
var mockStepFactory;
|
var mockStepFactory: MockStepFactory;
|
||||||
|
|
||||||
function createCompiler(processClosure, urlData = null) {
|
function createCompiler(processClosure, urlData = null) {
|
||||||
if (isBlank(urlData)) {
|
if (isBlank(urlData)) {
|
||||||
@ -117,8 +117,8 @@ export function runCompilerCommonTests() {
|
|||||||
var completer = PromiseWrapper.completer();
|
var completer = PromiseWrapper.completer();
|
||||||
|
|
||||||
var compiler = createCompiler((parent, current, control) => {
|
var compiler = createCompiler((parent, current, control) => {
|
||||||
ListWrapper.push(mockStepFactory.subTaskPromises,
|
mockStepFactory.subTaskPromises.push(
|
||||||
completer.promise.then((_) => { subTasksCompleted = true; }));
|
completer.promise.then((_) => { subTasksCompleted = true; }));
|
||||||
});
|
});
|
||||||
|
|
||||||
// It should always return a Promise because the subtask is async
|
// It should always return a Promise because the subtask is async
|
||||||
@ -177,7 +177,7 @@ class MockStepFactory extends CompileStepFactory {
|
|||||||
createSteps(viewDef, subTaskPromises) {
|
createSteps(viewDef, subTaskPromises) {
|
||||||
this.viewDef = viewDef;
|
this.viewDef = viewDef;
|
||||||
this.subTaskPromises = subTaskPromises;
|
this.subTaskPromises = subTaskPromises;
|
||||||
ListWrapper.forEach(this.subTaskPromises, (p) => ListWrapper.push(subTaskPromises, p));
|
ListWrapper.forEach(this.subTaskPromises, (p) => this.subTaskPromises.push(p));
|
||||||
return this.steps;
|
return this.steps;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -213,15 +213,15 @@ class IgnoreCurrentElementStep implements CompileStep {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function logEntry(log, parent, current) {
|
function logEntry(log: string[], parent, current) {
|
||||||
var parentId = '';
|
var parentId = '';
|
||||||
if (isPresent(parent)) {
|
if (isPresent(parent)) {
|
||||||
parentId = DOM.getAttribute(parent.element, 'id') + '<';
|
parentId = DOM.getAttribute(parent.element, 'id') + '<';
|
||||||
}
|
}
|
||||||
ListWrapper.push(log, parentId + DOM.getAttribute(current.element, 'id'));
|
log.push(parentId + DOM.getAttribute(current.element, 'id'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function createLoggerStep(log) {
|
function createLoggerStep(log: string[]) {
|
||||||
return new MockStep((parent, current, control) => { logEntry(log, parent, current); });
|
return new MockStep((parent, current, control) => { logEntry(log, parent, current); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,16 +6,17 @@ import {List, ListWrapper, MapWrapper} from 'angular2/src/facade/collection';
|
|||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
describe('SelectorMatcher', () => {
|
describe('SelectorMatcher', () => {
|
||||||
var matcher, matched, selectableCollector, s1, s2, s3, s4;
|
var matcher, selectableCollector, s1, s2, s3, s4;
|
||||||
|
var matched: any[];
|
||||||
|
|
||||||
function reset() { matched = ListWrapper.create(); }
|
function reset() { matched = []; }
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
reset();
|
reset();
|
||||||
s1 = s2 = s3 = s4 = null;
|
s1 = s2 = s3 = s4 = null;
|
||||||
selectableCollector = (selector, context) => {
|
selectableCollector = (selector, context) => {
|
||||||
ListWrapper.push(matched, selector);
|
matched.push(selector);
|
||||||
ListWrapper.push(matched, context);
|
matched.push(context);
|
||||||
};
|
};
|
||||||
matcher = new SelectorMatcher();
|
matcher = new SelectorMatcher();
|
||||||
});
|
});
|
||||||
|
@ -35,7 +35,7 @@ class LoggingEventDispatcher implements EventDispatcher {
|
|||||||
constructor(log: List<List<any>>) { this.log = log; }
|
constructor(log: List<List<any>>) { this.log = log; }
|
||||||
|
|
||||||
dispatchEvent(elementIndex: number, eventName: string, locals: Map<string, any>) {
|
dispatchEvent(elementIndex: number, eventName: string, locals: Map<string, any>) {
|
||||||
ListWrapper.push(this.log, [elementIndex, eventName, locals]);
|
this.log.push([elementIndex, eventName, locals]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -93,10 +93,10 @@ export class DomTestbed {
|
|||||||
createRootViews(protoViews: List<ProtoViewDto>): List<TestView> {
|
createRootViews(protoViews: List<ProtoViewDto>): List<TestView> {
|
||||||
var views = [];
|
var views = [];
|
||||||
var lastView = this.createRootView(protoViews[0]);
|
var lastView = this.createRootView(protoViews[0]);
|
||||||
ListWrapper.push(views, lastView);
|
views.push(lastView);
|
||||||
for (var i = 1; i < protoViews.length; i++) {
|
for (var i = 1; i < protoViews.length; i++) {
|
||||||
lastView = this.createComponentView(lastView.viewRef, 0, protoViews[i]);
|
lastView = this.createComponentView(lastView.viewRef, 0, protoViews[i]);
|
||||||
ListWrapper.push(views, lastView);
|
views.push(lastView);
|
||||||
}
|
}
|
||||||
return views;
|
return views;
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ class FakeProtoView extends SpyObject {
|
|||||||
@proxy
|
@proxy
|
||||||
@IMPLEMENTS(DomView)
|
@IMPLEMENTS(DomView)
|
||||||
class FakeView extends SpyObject {
|
class FakeView extends SpyObject {
|
||||||
boundElements;
|
boundElements: any[];
|
||||||
proto;
|
proto;
|
||||||
|
|
||||||
constructor(containers = null, transitiveContentTagCount: number = 1) {
|
constructor(containers = null, transitiveContentTagCount: number = 1) {
|
||||||
@ -53,7 +53,7 @@ class FakeView extends SpyObject {
|
|||||||
}
|
}
|
||||||
var boundElement = new DomElement(null, element, contentTag);
|
var boundElement = new DomElement(null, element, contentTag);
|
||||||
boundElement.viewContainer = vc;
|
boundElement.viewContainer = vc;
|
||||||
ListWrapper.push(this.boundElements, boundElement);
|
this.boundElements.push(boundElement);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,6 @@ import {
|
|||||||
proxy
|
proxy
|
||||||
} from 'angular2/test_lib';
|
} from 'angular2/test_lib';
|
||||||
import {isBlank} from 'angular2/src/facade/lang';
|
import {isBlank} from 'angular2/src/facade/lang';
|
||||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
|
||||||
|
|
||||||
import {DomProtoView} from 'angular2/src/render/dom/view/proto_view';
|
import {DomProtoView} from 'angular2/src/render/dom/view/proto_view';
|
||||||
import {ElementBinder} from 'angular2/src/render/dom/view/element_binder';
|
import {ElementBinder} from 'angular2/src/render/dom/view/element_binder';
|
||||||
@ -42,8 +41,7 @@ export function main() {
|
|||||||
var root = el('<div><div></div></div>');
|
var root = el('<div><div></div></div>');
|
||||||
var boundElements = [];
|
var boundElements = [];
|
||||||
for (var i = 0; i < boundElementCount; i++) {
|
for (var i = 0; i < boundElementCount; i++) {
|
||||||
ListWrapper.push(boundElements,
|
boundElements.push(new DomElement(pv.elementBinders[i], el('<span></span'), null));
|
||||||
new DomElement(pv.elementBinders[i], el('<span></span'), null));
|
|
||||||
}
|
}
|
||||||
return new DomView(pv, [DOM.childNodes(root)[0]], [], boundElements);
|
return new DomView(pv, [DOM.childNodes(root)[0]], [], boundElements);
|
||||||
}
|
}
|
||||||
|
@ -118,11 +118,11 @@ export class MdDialog {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
alert(message: string, okMessage: string): Promise {
|
alert(message: string, okMessage: string): Promise<any> {
|
||||||
throw "Not implemented";
|
throw "Not implemented";
|
||||||
}
|
}
|
||||||
|
|
||||||
confirm(message: string, okMessage: string, cancelMessage: string): Promise {
|
confirm(message: string, okMessage: string, cancelMessage: string): Promise<any> {
|
||||||
throw "Not implemented";
|
throw "Not implemented";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -176,7 +176,7 @@ export class MdDialogRef {
|
|||||||
|
|
||||||
|
|
||||||
/** Gets a promise that is resolved when the dialog is closed. */
|
/** Gets a promise that is resolved when the dialog is closed. */
|
||||||
get whenClosed(): Promise {
|
get whenClosed(): Promise<any> {
|
||||||
return this.whenClosedDeferred.promise;
|
return this.whenClosedDeferred.promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ export class MdGridList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set cols(value) {
|
set cols(value) {
|
||||||
this._cols = isString(value) ? NumberWrapper.parseInt(value, 10) : value;
|
this._cols = isString(value) ? NumberWrapper.parseInt(value, 10) : <number>value;
|
||||||
}
|
}
|
||||||
|
|
||||||
get cols() {
|
get cols() {
|
||||||
@ -105,7 +105,7 @@ export class MdGridList {
|
|||||||
* @param tile
|
* @param tile
|
||||||
*/
|
*/
|
||||||
addTile(tile: MdGridTile) {
|
addTile(tile: MdGridTile) {
|
||||||
ListWrapper.push(this.tiles, tile);
|
this.tiles.push(tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -253,7 +253,7 @@ export class MdGridTile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set rowspan(value) {
|
set rowspan(value) {
|
||||||
this._rowspan = isString(value) ? NumberWrapper.parseInt(value, 10) : value;
|
this._rowspan = isString(value) ? NumberWrapper.parseInt(value, 10) : <number>value;
|
||||||
}
|
}
|
||||||
|
|
||||||
get rowspan() {
|
get rowspan() {
|
||||||
@ -261,7 +261,7 @@ export class MdGridTile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set colspan(value) {
|
set colspan(value) {
|
||||||
this._colspan = isString(value) ? NumberWrapper.parseInt(value, 10) : value;
|
this._colspan = isString(value) ? NumberWrapper.parseInt(value, 10) : <number>value;
|
||||||
}
|
}
|
||||||
|
|
||||||
get colspan() {
|
get colspan() {
|
||||||
|
@ -119,7 +119,7 @@ export class MdRadioGroup {
|
|||||||
|
|
||||||
/** Registers a child radio button with this group. */
|
/** Registers a child radio button with this group. */
|
||||||
register(radio: MdRadioButton) {
|
register(radio: MdRadioButton) {
|
||||||
ListWrapper.push(this.radios_, radio);
|
this.radios_.push(radio);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Handles up and down arrow key presses to change the selected child radio. */
|
/** Handles up and down arrow key presses to change the selected child radio. */
|
||||||
|
@ -19,6 +19,6 @@ export class MdRadioDispatcher {
|
|||||||
|
|
||||||
/** Listen for future changes to radio button selection. */
|
/** Listen for future changes to radio button selection. */
|
||||||
listen(listener) {
|
listen(listener) {
|
||||||
ListWrapper.push(this.listeners_, listener);
|
this.listeners_.push(listener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import {SelectorMatcher} from "angular2/src/render/dom/compiler/selector";
|
import {SelectorMatcher} from "angular2/src/render/dom/compiler/selector";
|
||||||
import {CssSelector} from "angular2/src/render/dom/compiler/selector";
|
import {CssSelector} from "angular2/src/render/dom/compiler/selector";
|
||||||
import {StringWrapper, Math} from 'angular2/src/facade/lang';
|
import {StringWrapper, Math} from 'angular2/src/facade/lang';
|
||||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
|
||||||
import {getIntParameter, bindAction} from 'angular2/src/test_lib/benchmark_util';
|
import {getIntParameter, bindAction} from 'angular2/src/test_lib/benchmark_util';
|
||||||
import {BrowserDomAdapter} from 'angular2/src/dom/browser_adapter';
|
import {BrowserDomAdapter} from 'angular2/src/dom/browser_adapter';
|
||||||
|
|
||||||
@ -13,10 +12,10 @@ export function main() {
|
|||||||
var fixedSelectorStrings = [];
|
var fixedSelectorStrings = [];
|
||||||
var fixedSelectors = [];
|
var fixedSelectors = [];
|
||||||
for (var i = 0; i < count; i++) {
|
for (var i = 0; i < count; i++) {
|
||||||
ListWrapper.push(fixedSelectorStrings, randomSelector());
|
fixedSelectorStrings.push(randomSelector());
|
||||||
}
|
}
|
||||||
for (var i = 0; i < count; i++) {
|
for (var i = 0; i < count; i++) {
|
||||||
ListWrapper.push(fixedSelectors, CssSelector.parse(fixedSelectorStrings[i]));
|
fixedSelectors.push(CssSelector.parse(fixedSelectorStrings[i]));
|
||||||
}
|
}
|
||||||
fixedMatcher = new SelectorMatcher();
|
fixedMatcher = new SelectorMatcher();
|
||||||
for (var i = 0; i < count; i++) {
|
for (var i = 0; i < count; i++) {
|
||||||
@ -26,7 +25,7 @@ export function main() {
|
|||||||
function parse() {
|
function parse() {
|
||||||
var result = [];
|
var result = [];
|
||||||
for (var i = 0; i < count; i++) {
|
for (var i = 0; i < count; i++) {
|
||||||
ListWrapper.push(result, CssSelector.parse(fixedSelectorStrings[i]));
|
result.push(CssSelector.parse(fixedSelectorStrings[i]));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ export class App {
|
|||||||
appSize = appSize > 1 ? appSize - 1 : 0; // draw at least one table
|
appSize = appSize > 1 ? appSize - 1 : 0; // draw at least one table
|
||||||
this.scrollAreas = [];
|
this.scrollAreas = [];
|
||||||
for (var i = 0; i < appSize; i++) {
|
for (var i = 0; i < appSize; i++) {
|
||||||
ListWrapper.push(this.scrollAreas, i);
|
this.scrollAreas.push(i);
|
||||||
}
|
}
|
||||||
bindAction('#run-btn', () => { this.runBenchmark(); });
|
bindAction('#run-btn', () => { this.runBenchmark(); });
|
||||||
bindAction('#reset-btn', () => {
|
bindAction('#reset-btn', () => {
|
||||||
|
@ -13,7 +13,7 @@ import {
|
|||||||
export function generateOfferings(count: int): List<Offering> {
|
export function generateOfferings(count: int): List<Offering> {
|
||||||
var res = [];
|
var res = [];
|
||||||
for (var i = 0; i < count; i++) {
|
for (var i = 0; i < count; i++) {
|
||||||
ListWrapper.push(res, generateOffering(i));
|
res.push(generateOffering(i));
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -156,10 +156,10 @@ export class PerflogMetric extends Metric {
|
|||||||
startEvent['ph'] = 'B';
|
startEvent['ph'] = 'B';
|
||||||
endEvent['ph'] = 'E';
|
endEvent['ph'] = 'E';
|
||||||
endEvent['ts'] = startEvent['ts'] + startEvent['dur'];
|
endEvent['ts'] = startEvent['ts'] + startEvent['dur'];
|
||||||
ListWrapper.push(this._remainingEvents, startEvent);
|
this._remainingEvents.push(startEvent);
|
||||||
ListWrapper.push(this._remainingEvents, endEvent);
|
this._remainingEvents.push(endEvent);
|
||||||
} else {
|
} else {
|
||||||
ListWrapper.push(this._remainingEvents, event);
|
this._remainingEvents.push(event);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (needSort) {
|
if (needSort) {
|
||||||
@ -239,10 +239,10 @@ export class PerflogMetric extends Metric {
|
|||||||
if (StringWrapper.equals(ph, 'I') || StringWrapper.equals(ph, 'i')) {
|
if (StringWrapper.equals(ph, 'I') || StringWrapper.equals(ph, 'i')) {
|
||||||
if (isPresent(frameCaptureStartEvent) && isBlank(frameCaptureEndEvent) &&
|
if (isPresent(frameCaptureStartEvent) && isBlank(frameCaptureEndEvent) &&
|
||||||
StringWrapper.equals(name, 'frame')) {
|
StringWrapper.equals(name, 'frame')) {
|
||||||
ListWrapper.push(frameTimestamps, event['ts']);
|
frameTimestamps.push(event['ts']);
|
||||||
if (frameTimestamps.length >= 2) {
|
if (frameTimestamps.length >= 2) {
|
||||||
ListWrapper.push(frameTimes, frameTimestamps[frameTimestamps.length - 1] -
|
frameTimes.push(frameTimestamps[frameTimestamps.length - 1] -
|
||||||
frameTimestamps[frameTimestamps.length - 2]);
|
frameTimestamps[frameTimestamps.length - 2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ export class ConsoleReporter extends Reporter {
|
|||||||
|
|
||||||
static _sortedProps(obj) {
|
static _sortedProps(obj) {
|
||||||
var props = [];
|
var props = [];
|
||||||
StringMapWrapper.forEach(obj, (value, prop) => ListWrapper.push(props, prop));
|
StringMapWrapper.forEach(obj, (value, prop) => props.push(prop));
|
||||||
props.sort();
|
props.sort();
|
||||||
return props;
|
return props;
|
||||||
}
|
}
|
||||||
|
@ -41,13 +41,13 @@ export class Runner {
|
|||||||
bind(Options.EXECUTE).toValue(execute)
|
bind(Options.EXECUTE).toValue(execute)
|
||||||
];
|
];
|
||||||
if (isPresent(prepare)) {
|
if (isPresent(prepare)) {
|
||||||
ListWrapper.push(sampleBindings, bind(Options.PREPARE).toValue(prepare));
|
sampleBindings.push(bind(Options.PREPARE).toValue(prepare));
|
||||||
}
|
}
|
||||||
if (isPresent(microMetrics)) {
|
if (isPresent(microMetrics)) {
|
||||||
ListWrapper.push(sampleBindings, bind(Options.MICRO_METRICS).toValue(microMetrics));
|
sampleBindings.push(bind(Options.MICRO_METRICS).toValue(microMetrics));
|
||||||
}
|
}
|
||||||
if (isPresent(bindings)) {
|
if (isPresent(bindings)) {
|
||||||
ListWrapper.push(sampleBindings, bindings);
|
sampleBindings.push(bindings);
|
||||||
}
|
}
|
||||||
return Injector.resolveAndCreate(sampleBindings)
|
return Injector.resolveAndCreate(sampleBindings)
|
||||||
.asyncGet(Sampler)
|
.asyncGet(Sampler)
|
||||||
|
@ -39,8 +39,8 @@ export class RegressionSlopeValidator extends Validator {
|
|||||||
for (var i = 0; i < latestSample.length; i++) {
|
for (var i = 0; i < latestSample.length; i++) {
|
||||||
// For now, we only use the array index as x value.
|
// For now, we only use the array index as x value.
|
||||||
// TODO(tbosch): think about whether we should use time here instead
|
// TODO(tbosch): think about whether we should use time here instead
|
||||||
ListWrapper.push(xValues, i);
|
xValues.push(i);
|
||||||
ListWrapper.push(yValues, latestSample[i].values[this._metric]);
|
yValues.push(latestSample[i].values[this._metric]);
|
||||||
}
|
}
|
||||||
var regressionSlope = Statistic.calculateRegressionSlope(
|
var regressionSlope = Statistic.calculateRegressionSlope(
|
||||||
xValues, Statistic.calculateMean(xValues), yValues, Statistic.calculateMean(yValues));
|
xValues, Statistic.calculateMean(xValues), yValues, Statistic.calculateMean(yValues));
|
||||||
|
@ -53,7 +53,7 @@ export class ChromeDriverExtension extends WebDriverExtension {
|
|||||||
ListWrapper.forEach(entries, function(entry) {
|
ListWrapper.forEach(entries, function(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')) {
|
||||||
ListWrapper.push(events, message['params']);
|
events.push(message['params']);
|
||||||
}
|
}
|
||||||
if (StringWrapper.equals(message['method'], 'Tracing.bufferUsage')) {
|
if (StringWrapper.equals(message['method'], 'Tracing.bufferUsage')) {
|
||||||
throw new BaseException('The DevTools trace buffer filled during the test!');
|
throw new BaseException('The DevTools trace buffer filled during the test!');
|
||||||
@ -79,14 +79,14 @@ export class ChromeDriverExtension extends WebDriverExtension {
|
|||||||
if (StringWrapper.equals(name, 'FunctionCall') &&
|
if (StringWrapper.equals(name, 'FunctionCall') &&
|
||||||
(isBlank(args) || isBlank(args['data']) ||
|
(isBlank(args) || isBlank(args['data']) ||
|
||||||
!StringWrapper.equals(args['data']['scriptName'], 'InjectedScript'))) {
|
!StringWrapper.equals(args['data']['scriptName'], 'InjectedScript'))) {
|
||||||
ListWrapper.push(normalizedEvents, normalizeEvent(event, {'name': 'script'}));
|
normalizedEvents.push(normalizeEvent(event, {'name': 'script'}));
|
||||||
|
|
||||||
} else if (StringWrapper.equals(name, 'RecalculateStyles') ||
|
} else if (StringWrapper.equals(name, 'RecalculateStyles') ||
|
||||||
StringWrapper.equals(name, 'Layout') ||
|
StringWrapper.equals(name, 'Layout') ||
|
||||||
StringWrapper.equals(name, 'UpdateLayerTree') ||
|
StringWrapper.equals(name, 'UpdateLayerTree') ||
|
||||||
StringWrapper.equals(name, 'Paint') || StringWrapper.equals(name, 'Rasterize') ||
|
StringWrapper.equals(name, 'Paint') || StringWrapper.equals(name, 'Rasterize') ||
|
||||||
StringWrapper.equals(name, 'CompositeLayers')) {
|
StringWrapper.equals(name, 'CompositeLayers')) {
|
||||||
ListWrapper.push(normalizedEvents, normalizeEvent(event, {'name': 'render'}));
|
normalizedEvents.push(normalizeEvent(event, {'name': 'render'}));
|
||||||
|
|
||||||
} else if (StringWrapper.equals(name, 'GCEvent')) {
|
} else if (StringWrapper.equals(name, 'GCEvent')) {
|
||||||
var normArgs = {
|
var normArgs = {
|
||||||
@ -97,12 +97,11 @@ export class ChromeDriverExtension extends WebDriverExtension {
|
|||||||
normArgs['majorGc'] = isPresent(majorGCPids[pid]) && majorGCPids[pid];
|
normArgs['majorGc'] = isPresent(majorGCPids[pid]) && majorGCPids[pid];
|
||||||
}
|
}
|
||||||
majorGCPids[pid] = false;
|
majorGCPids[pid] = false;
|
||||||
ListWrapper.push(normalizedEvents,
|
normalizedEvents.push(normalizeEvent(event, {'name': 'gc', 'args': normArgs}));
|
||||||
normalizeEvent(event, {'name': 'gc', 'args': normArgs}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (StringWrapper.equals(cat, 'blink.console')) {
|
} else if (StringWrapper.equals(cat, 'blink.console')) {
|
||||||
ListWrapper.push(normalizedEvents, normalizeEvent(event, {'name': name}));
|
normalizedEvents.push(normalizeEvent(event, {'name': name}));
|
||||||
|
|
||||||
} else if (StringWrapper.equals(cat, 'v8')) {
|
} else if (StringWrapper.equals(cat, 'v8')) {
|
||||||
if (StringWrapper.equals(name, 'majorGC')) {
|
if (StringWrapper.equals(name, 'majorGC')) {
|
||||||
@ -118,7 +117,7 @@ export class ChromeDriverExtension extends WebDriverExtension {
|
|||||||
throw new BaseException('multi-frame render stats not supported');
|
throw new BaseException('multi-frame render stats not supported');
|
||||||
}
|
}
|
||||||
if (frameCount == 1) {
|
if (frameCount == 1) {
|
||||||
ListWrapper.push(normalizedEvents, normalizeEvent(event, {'name': 'frame'}));
|
normalizedEvents.push(normalizeEvent(event, {'name': 'frame'}));
|
||||||
}
|
}
|
||||||
} else if (StringWrapper.equals(name, 'BenchmarkInstrumentation::DisplayRenderingStats') ||
|
} else if (StringWrapper.equals(name, 'BenchmarkInstrumentation::DisplayRenderingStats') ||
|
||||||
StringWrapper.equals(name, 'vsync_before')) {
|
StringWrapper.equals(name, 'vsync_before')) {
|
||||||
|
@ -44,14 +44,14 @@ export class IOsDriverExtension extends WebDriverExtension {
|
|||||||
ListWrapper.forEach(entries, function(entry) {
|
ListWrapper.forEach(entries, function(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')) {
|
||||||
ListWrapper.push(records, message['params']['record']);
|
records.push(message['params']['record']);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return this._convertPerfRecordsToEvents(records);
|
return this._convertPerfRecordsToEvents(records);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_convertPerfRecordsToEvents(records: any[], events = null) {
|
_convertPerfRecordsToEvents(records: any[], events: any[] = null) {
|
||||||
if (isBlank(events)) {
|
if (isBlank(events)) {
|
||||||
events = [];
|
events = [];
|
||||||
}
|
}
|
||||||
@ -64,18 +64,18 @@ export class IOsDriverExtension extends WebDriverExtension {
|
|||||||
|
|
||||||
if (StringWrapper.equals(type, 'FunctionCall') &&
|
if (StringWrapper.equals(type, 'FunctionCall') &&
|
||||||
(isBlank(data) || !StringWrapper.equals(data['scriptName'], 'InjectedScript'))) {
|
(isBlank(data) || !StringWrapper.equals(data['scriptName'], 'InjectedScript'))) {
|
||||||
ListWrapper.push(events, createStartEvent('script', startTime));
|
events.push(createStartEvent('script', startTime));
|
||||||
endEvent = createEndEvent('script', endTime);
|
endEvent = createEndEvent('script', endTime);
|
||||||
} else if (StringWrapper.equals(type, 'Time')) {
|
} else if (StringWrapper.equals(type, 'Time')) {
|
||||||
ListWrapper.push(events, createMarkStartEvent(data['message'], startTime));
|
events.push(createMarkStartEvent(data['message'], startTime));
|
||||||
} else if (StringWrapper.equals(type, 'TimeEnd')) {
|
} else if (StringWrapper.equals(type, 'TimeEnd')) {
|
||||||
ListWrapper.push(events, createMarkEndEvent(data['message'], startTime));
|
events.push(createMarkEndEvent(data['message'], startTime));
|
||||||
} else if (StringWrapper.equals(type, 'RecalculateStyles') ||
|
} else if (StringWrapper.equals(type, 'RecalculateStyles') ||
|
||||||
StringWrapper.equals(type, 'Layout') ||
|
StringWrapper.equals(type, 'Layout') ||
|
||||||
StringWrapper.equals(type, 'UpdateLayerTree') ||
|
StringWrapper.equals(type, 'UpdateLayerTree') ||
|
||||||
StringWrapper.equals(type, 'Paint') || StringWrapper.equals(type, 'Rasterize') ||
|
StringWrapper.equals(type, 'Paint') || StringWrapper.equals(type, 'Rasterize') ||
|
||||||
StringWrapper.equals(type, 'CompositeLayers')) {
|
StringWrapper.equals(type, 'CompositeLayers')) {
|
||||||
ListWrapper.push(events, createStartEvent('render', startTime));
|
events.push(createStartEvent('render', startTime));
|
||||||
endEvent = createEndEvent('render', endTime);
|
endEvent = createEndEvent('render', endTime);
|
||||||
}
|
}
|
||||||
// Note: ios used to support GCEvent up until iOS 6 :-(
|
// Note: ios used to support GCEvent up until iOS 6 :-(
|
||||||
@ -83,7 +83,7 @@ export class IOsDriverExtension extends WebDriverExtension {
|
|||||||
this._convertPerfRecordsToEvents(record['children'], events);
|
this._convertPerfRecordsToEvents(record['children'], events);
|
||||||
}
|
}
|
||||||
if (isPresent(endEvent)) {
|
if (isPresent(endEvent)) {
|
||||||
ListWrapper.push(events, endEvent);
|
events.push(endEvent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return events;
|
return events;
|
||||||
|
@ -28,7 +28,7 @@ import {
|
|||||||
import {TraceEventFactory} from '../trace_event_factory';
|
import {TraceEventFactory} from '../trace_event_factory';
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
var commandLog;
|
var commandLog: any[];
|
||||||
var eventFactory = new TraceEventFactory('timeline', 'pid0');
|
var eventFactory = new TraceEventFactory('timeline', 'pid0');
|
||||||
|
|
||||||
function createMetric(perfLogs, microMetrics = null, perfLogFeatures = null, forceGc = null,
|
function createMetric(perfLogs, microMetrics = null, perfLogFeatures = null, forceGc = null,
|
||||||
@ -46,17 +46,17 @@ export function main() {
|
|||||||
bind(Options.MICRO_METRICS).toValue(microMetrics),
|
bind(Options.MICRO_METRICS).toValue(microMetrics),
|
||||||
bind(PerflogMetric.SET_TIMEOUT)
|
bind(PerflogMetric.SET_TIMEOUT)
|
||||||
.toValue((fn, millis) => {
|
.toValue((fn, millis) => {
|
||||||
ListWrapper.push(commandLog, ['setTimeout', millis]);
|
commandLog.push(['setTimeout', millis]);
|
||||||
fn();
|
fn();
|
||||||
}),
|
}),
|
||||||
bind(WebDriverExtension)
|
bind(WebDriverExtension)
|
||||||
.toValue(new MockDriverExtension(perfLogs, commandLog, perfLogFeatures))
|
.toValue(new MockDriverExtension(perfLogs, commandLog, perfLogFeatures))
|
||||||
];
|
];
|
||||||
if (isPresent(forceGc)) {
|
if (isPresent(forceGc)) {
|
||||||
ListWrapper.push(bindings, bind(Options.FORCE_GC).toValue(forceGc));
|
bindings.push(bind(Options.FORCE_GC).toValue(forceGc));
|
||||||
}
|
}
|
||||||
if (isPresent(captureFrames)) {
|
if (isPresent(captureFrames)) {
|
||||||
ListWrapper.push(bindings, bind(Options.CAPTURE_FRAMES).toValue(captureFrames));
|
bindings.push(bind(Options.CAPTURE_FRAMES).toValue(captureFrames));
|
||||||
}
|
}
|
||||||
return Injector.resolveAndCreate(bindings).get(PerflogMetric);
|
return Injector.resolveAndCreate(bindings).get(PerflogMetric);
|
||||||
}
|
}
|
||||||
@ -65,7 +65,7 @@ export function main() {
|
|||||||
|
|
||||||
function sortedKeys(stringMap) {
|
function sortedKeys(stringMap) {
|
||||||
var res = [];
|
var res = [];
|
||||||
StringMapWrapper.forEach(stringMap, (_, key) => { ListWrapper.push(res, key); });
|
StringMapWrapper.forEach(stringMap, (_, key) => { res.push(key); });
|
||||||
res.sort();
|
res.sort();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -324,9 +324,9 @@ export function main() {
|
|||||||
|
|
||||||
describe('aggregation', () => {
|
describe('aggregation', () => {
|
||||||
|
|
||||||
function aggregate(events, microMetrics = null, captureFrames = null) {
|
function aggregate(events: any[], microMetrics = null, captureFrames = null) {
|
||||||
ListWrapper.insert(events, 0, eventFactory.markStart('benchpress0', 0));
|
ListWrapper.insert(events, 0, eventFactory.markStart('benchpress0', 0));
|
||||||
ListWrapper.push(events, 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));
|
||||||
}
|
}
|
||||||
@ -640,19 +640,19 @@ class MockDriverExtension extends WebDriverExtension {
|
|||||||
}
|
}
|
||||||
|
|
||||||
timeBegin(name): Promise<any> {
|
timeBegin(name): Promise<any> {
|
||||||
ListWrapper.push(this._commandLog, ['timeBegin', name]);
|
this._commandLog.push(['timeBegin', name]);
|
||||||
return PromiseWrapper.resolve(null);
|
return PromiseWrapper.resolve(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
timeEnd(name, restartName): Promise<any> {
|
timeEnd(name, restartName): Promise<any> {
|
||||||
ListWrapper.push(this._commandLog, ['timeEnd', name, restartName]);
|
this._commandLog.push(['timeEnd', name, restartName]);
|
||||||
return PromiseWrapper.resolve(null);
|
return PromiseWrapper.resolve(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
perfLogFeatures(): PerfLogFeatures { return this._perfLogFeatures; }
|
perfLogFeatures(): PerfLogFeatures { return this._perfLogFeatures; }
|
||||||
|
|
||||||
readPerfLog(): Promise<any> {
|
readPerfLog(): Promise<any> {
|
||||||
ListWrapper.push(this._commandLog, '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);
|
ListWrapper.removeAt(this._perfLogs, 0);
|
||||||
@ -663,7 +663,7 @@ class MockDriverExtension extends WebDriverExtension {
|
|||||||
}
|
}
|
||||||
|
|
||||||
gc(): Promise<any> {
|
gc(): Promise<any> {
|
||||||
ListWrapper.push(this._commandLog, ['gc']);
|
this._commandLog.push(['gc']);
|
||||||
return PromiseWrapper.resolve(null);
|
return PromiseWrapper.resolve(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ import {
|
|||||||
export function main() {
|
export function main() {
|
||||||
describe('console reporter', () => {
|
describe('console reporter', () => {
|
||||||
var reporter;
|
var reporter;
|
||||||
var log;
|
var log: string[];
|
||||||
|
|
||||||
function createReporter({columnWidth = null, sampleId = null, descriptions = null,
|
function createReporter({columnWidth = null, sampleId = null, descriptions = null,
|
||||||
metrics = null}: {columnWidth?, sampleId?, descriptions?, metrics?}) {
|
metrics = null}: {columnWidth?, sampleId?, descriptions?, metrics?}) {
|
||||||
@ -30,10 +30,10 @@ export function main() {
|
|||||||
var bindings = [
|
var bindings = [
|
||||||
ConsoleReporter.BINDINGS,
|
ConsoleReporter.BINDINGS,
|
||||||
bind(SampleDescription).toValue(new SampleDescription(sampleId, descriptions, metrics)),
|
bind(SampleDescription).toValue(new SampleDescription(sampleId, descriptions, metrics)),
|
||||||
bind(ConsoleReporter.PRINT).toValue((line) => ListWrapper.push(log, line))
|
bind(ConsoleReporter.PRINT).toValue((line) => log.push(line))
|
||||||
];
|
];
|
||||||
if (isPresent(columnWidth)) {
|
if (isPresent(columnWidth)) {
|
||||||
ListWrapper.push(bindings, bind(ConsoleReporter.COLUMN_WIDTH).toValue(columnWidth));
|
bindings.push(bind(ConsoleReporter.COLUMN_WIDTH).toValue(columnWidth));
|
||||||
}
|
}
|
||||||
reporter = Injector.resolveAndCreate(bindings).get(ConsoleReporter);
|
reporter = Injector.resolveAndCreate(bindings).get(ConsoleReporter);
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ export function main() {
|
|||||||
bind(Options.NOW).toValue(() => DateWrapper.fromMillis(time++))
|
bind(Options.NOW).toValue(() => DateWrapper.fromMillis(time++))
|
||||||
];
|
];
|
||||||
if (isPresent(prepare)) {
|
if (isPresent(prepare)) {
|
||||||
ListWrapper.push(bindings, bind(Options.PREPARE).toValue(prepare));
|
bindings.push(bind(Options.PREPARE).toValue(prepare));
|
||||||
}
|
}
|
||||||
|
|
||||||
sampler = Injector.resolveAndCreate(bindings).get(Sampler);
|
sampler = Injector.resolveAndCreate(bindings).get(Sampler);
|
||||||
@ -81,7 +81,7 @@ export function main() {
|
|||||||
var count = 0;
|
var count = 0;
|
||||||
var driver = new MockDriverAdapter([], (callback) => {
|
var driver = new MockDriverAdapter([], (callback) => {
|
||||||
var result = callback();
|
var result = callback();
|
||||||
ListWrapper.push(log, result);
|
log.push(result);
|
||||||
return PromiseWrapper.resolve(result);
|
return PromiseWrapper.resolve(result);
|
||||||
});
|
});
|
||||||
createSampler({
|
createSampler({
|
||||||
@ -105,8 +105,8 @@ export function main() {
|
|||||||
createSampler({
|
createSampler({
|
||||||
metric: createCountingMetric(log),
|
metric: createCountingMetric(log),
|
||||||
validator: createCountingValidator(2),
|
validator: createCountingValidator(2),
|
||||||
prepare: () => { ListWrapper.push(log, `p${workCount++}`); },
|
prepare: () => { log.push(`p${workCount++}`); },
|
||||||
execute: () => { ListWrapper.push(log, `w${workCount++}`); }
|
execute: () => { log.push(`w${workCount++}`); }
|
||||||
});
|
});
|
||||||
sampler.sample().then((_) => {
|
sampler.sample().then((_) => {
|
||||||
expect(log).toEqual([
|
expect(log).toEqual([
|
||||||
@ -130,7 +130,7 @@ export function main() {
|
|||||||
createSampler({
|
createSampler({
|
||||||
metric: createCountingMetric(log),
|
metric: createCountingMetric(log),
|
||||||
validator: createCountingValidator(2),
|
validator: createCountingValidator(2),
|
||||||
execute: () => { ListWrapper.push(log, `w${workCount++}`); },
|
execute: () => { log.push(`w${workCount++}`); },
|
||||||
prepare: null
|
prepare: null
|
||||||
});
|
});
|
||||||
sampler.sample().then((_) => {
|
sampler.sample().then((_) => {
|
||||||
@ -282,7 +282,7 @@ class MockValidator extends Validator {
|
|||||||
}
|
}
|
||||||
validate(completeSample: List<MeasureValues>): List<MeasureValues> {
|
validate(completeSample: List<MeasureValues>): List<MeasureValues> {
|
||||||
var stableSample = isPresent(this._validate) ? this._validate(completeSample) : completeSample;
|
var stableSample = isPresent(this._validate) ? this._validate(completeSample) : completeSample;
|
||||||
ListWrapper.push(this._log, ['validate', completeSample, stableSample]);
|
this._log.push(['validate', completeSample, stableSample]);
|
||||||
return stableSample;
|
return stableSample;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -297,12 +297,12 @@ class MockMetric extends Metric {
|
|||||||
this._log = log;
|
this._log = log;
|
||||||
}
|
}
|
||||||
beginMeasure() {
|
beginMeasure() {
|
||||||
ListWrapper.push(this._log, ['beginMeasure']);
|
this._log.push(['beginMeasure']);
|
||||||
return PromiseWrapper.resolve(null);
|
return PromiseWrapper.resolve(null);
|
||||||
}
|
}
|
||||||
endMeasure(restart) {
|
endMeasure(restart) {
|
||||||
var measureValues = isPresent(this._endMeasure) ? this._endMeasure() : {};
|
var measureValues = isPresent(this._endMeasure) ? this._endMeasure() : {};
|
||||||
ListWrapper.push(this._log, ['endMeasure', restart, measureValues]);
|
this._log.push(['endMeasure', restart, measureValues]);
|
||||||
return PromiseWrapper.resolve(measureValues);
|
return PromiseWrapper.resolve(measureValues);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -317,11 +317,11 @@ class MockReporter extends Reporter {
|
|||||||
this._log = log;
|
this._log = log;
|
||||||
}
|
}
|
||||||
reportMeasureValues(values): Promise<any> {
|
reportMeasureValues(values): Promise<any> {
|
||||||
ListWrapper.push(this._log, ['reportMeasureValues', values]);
|
this._log.push(['reportMeasureValues', values]);
|
||||||
return PromiseWrapper.resolve(null);
|
return PromiseWrapper.resolve(null);
|
||||||
}
|
}
|
||||||
reportSample(completeSample, validSample): Promise<any> {
|
reportSample(completeSample, validSample): Promise<any> {
|
||||||
ListWrapper.push(this._log, ['reportSample', completeSample, validSample]);
|
this._log.push(['reportSample', completeSample, validSample]);
|
||||||
return PromiseWrapper.resolve(null);
|
return PromiseWrapper.resolve(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@ import {
|
|||||||
xit,
|
xit,
|
||||||
} from 'angular2/test_lib';
|
} from 'angular2/test_lib';
|
||||||
|
|
||||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
|
||||||
import {PromiseWrapper} from 'angular2/src/facade/async';
|
import {PromiseWrapper} from 'angular2/src/facade/async';
|
||||||
import {Json, isBlank} from 'angular2/src/facade/lang';
|
import {Json, isBlank} from 'angular2/src/facade/lang';
|
||||||
|
|
||||||
@ -307,12 +306,12 @@ class MockDriverAdapter extends WebDriverAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
executeScript(script) {
|
executeScript(script) {
|
||||||
ListWrapper.push(this._log, ['executeScript', script]);
|
this._log.push(['executeScript', script]);
|
||||||
return PromiseWrapper.resolve(null);
|
return PromiseWrapper.resolve(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
logs(type) {
|
logs(type) {
|
||||||
ListWrapper.push(this._log, ['logs', type]);
|
this._log.push(['logs', type]);
|
||||||
if (type === 'performance') {
|
if (type === 'performance') {
|
||||||
return PromiseWrapper.resolve(this._events.map((event) => {
|
return PromiseWrapper.resolve(this._events.map((event) => {
|
||||||
return {
|
return {
|
||||||
|
@ -11,7 +11,6 @@ import {
|
|||||||
xit,
|
xit,
|
||||||
} from 'angular2/test_lib';
|
} from 'angular2/test_lib';
|
||||||
|
|
||||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
|
||||||
import {PromiseWrapper} from 'angular2/src/facade/async';
|
import {PromiseWrapper} from 'angular2/src/facade/async';
|
||||||
import {Json, isBlank, isPresent} from 'angular2/src/facade/lang';
|
import {Json, isBlank, isPresent} from 'angular2/src/facade/lang';
|
||||||
|
|
||||||
@ -196,12 +195,12 @@ class MockDriverAdapter extends WebDriverAdapter {
|
|||||||
constructor(private _log: List<any>, private _perfRecords: List<any>) { super(); }
|
constructor(private _log: List<any>, private _perfRecords: List<any>) { super(); }
|
||||||
|
|
||||||
executeScript(script) {
|
executeScript(script) {
|
||||||
ListWrapper.push(this._log, ['executeScript', script]);
|
this._log.push(['executeScript', script]);
|
||||||
return PromiseWrapper.resolve(null);
|
return PromiseWrapper.resolve(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
logs(type) {
|
logs(type) {
|
||||||
ListWrapper.push(this._log, ['logs', type]);
|
this._log.push(['logs', type]);
|
||||||
if (type === 'performance') {
|
if (type === 'performance') {
|
||||||
return PromiseWrapper.resolve(this._perfRecords.map(function(record) {
|
return PromiseWrapper.resolve(this._perfRecords.map(function(record) {
|
||||||
return {
|
return {
|
||||||
|
@ -26,7 +26,7 @@ export class TodoFactory {
|
|||||||
export class Store {
|
export class Store {
|
||||||
list: List<KeyModel> = [];
|
list: List<KeyModel> = [];
|
||||||
|
|
||||||
add(record: KeyModel): void { ListWrapper.push(this.list, record); }
|
add(record: KeyModel): void { this.list.push(record); }
|
||||||
|
|
||||||
remove(record: KeyModel): void { this._spliceOut(record); }
|
remove(record: KeyModel): void { this._spliceOut(record); }
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user