parent
8336881a85
commit
b986c54079
|
@ -4,7 +4,6 @@
|
|||
|
||||
/// <reference path="typings/zone/zone.d.ts"/>
|
||||
declare var assert: any;
|
||||
declare type int = number;
|
||||
|
||||
interface List<T> extends Array<T> {}
|
||||
|
||||
|
|
|
@ -83,13 +83,13 @@ export class CodegenNameUtil {
|
|||
return this._addFieldPrefix(_FIRST_PROTO_IN_CURRENT_BINDING);
|
||||
}
|
||||
|
||||
getLocalName(idx: int): string { return `l_${this._sanitizedNames[idx]}`; }
|
||||
getLocalName(idx: number): string { return `l_${this._sanitizedNames[idx]}`; }
|
||||
|
||||
getEventLocalName(eb: EventBinding, idx: int): string {
|
||||
getEventLocalName(eb: EventBinding, idx: number): string {
|
||||
return `l_${MapWrapper.get(this._sanitizedEventNames, eb)[idx]}`;
|
||||
}
|
||||
|
||||
getChangeName(idx: int): string { return `c_${this._sanitizedNames[idx]}`; }
|
||||
getChangeName(idx: number): string { return `c_${this._sanitizedNames[idx]}`; }
|
||||
|
||||
/**
|
||||
* Generate a statement initializing local variables used when detecting changes.
|
||||
|
@ -133,9 +133,9 @@ export class CodegenNameUtil {
|
|||
|
||||
getPreventDefaultAccesor(): string { return "preventDefault"; }
|
||||
|
||||
getFieldCount(): int { return this._sanitizedNames.length; }
|
||||
getFieldCount(): number { return this._sanitizedNames.length; }
|
||||
|
||||
getFieldName(idx: int): string { return this._addFieldPrefix(this._sanitizedNames[idx]); }
|
||||
getFieldName(idx: number): string { return this._addFieldPrefix(this._sanitizedNames[idx]); }
|
||||
|
||||
getAllFieldNames(): List<string> {
|
||||
var fieldList = [];
|
||||
|
@ -188,7 +188,7 @@ export class CodegenNameUtil {
|
|||
'\n');
|
||||
}
|
||||
|
||||
getPipeName(idx: int): string {
|
||||
getPipeName(idx: number): string {
|
||||
return this._addFieldPrefix(`${this._sanitizedNames[idx]}_pipe`);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ export class DefaultIterableDifferFactory implements IterableDifferFactory {
|
|||
|
||||
export class DefaultIterableDiffer implements IterableDiffer {
|
||||
private _collection = null;
|
||||
private _length: int = null;
|
||||
private _length: number = null;
|
||||
// Keeps track of the used records at any point in time (during & across `_check()` calls)
|
||||
private _linkedRecords: _DuplicateMap = null;
|
||||
// Keeps track of the removed records at any point in time during `_check()` calls.
|
||||
|
@ -43,7 +43,7 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
|||
|
||||
get collection() { return this._collection; }
|
||||
|
||||
get length(): int { return this._length; }
|
||||
get length(): number { return this._length; }
|
||||
|
||||
forEachItem(fn: Function) {
|
||||
var record: CollectionChangeRecord;
|
||||
|
@ -101,7 +101,7 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
|||
|
||||
var record: CollectionChangeRecord = this._itHead;
|
||||
var mayBeDirty: boolean = false;
|
||||
var index: int;
|
||||
var index: number;
|
||||
var item;
|
||||
|
||||
if (isArray(collection)) {
|
||||
|
@ -185,7 +185,7 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
|||
* - `item` is the current item in the collection
|
||||
* - `index` is the position of the item in the collection
|
||||
*/
|
||||
_mismatch(record: CollectionChangeRecord, item, index: int): CollectionChangeRecord {
|
||||
_mismatch(record: CollectionChangeRecord, item, index: number): CollectionChangeRecord {
|
||||
// The previous record after which we will append the current one.
|
||||
var previousRecord: CollectionChangeRecord;
|
||||
|
||||
|
@ -241,7 +241,7 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
|||
* better way to think of it is as insert of 'b' rather then switch 'a' with 'b' and then add 'a'
|
||||
* at the end.
|
||||
*/
|
||||
_verifyReinsertion(record: CollectionChangeRecord, item, index: int): CollectionChangeRecord {
|
||||
_verifyReinsertion(record: CollectionChangeRecord, item, index: number): CollectionChangeRecord {
|
||||
var reinsertRecord: CollectionChangeRecord =
|
||||
this._unlinkedRecords === null ? null : this._unlinkedRecords.get(item);
|
||||
if (reinsertRecord !== null) {
|
||||
|
@ -284,7 +284,7 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
|||
}
|
||||
|
||||
_reinsertAfter(record: CollectionChangeRecord, prevRecord: CollectionChangeRecord,
|
||||
index: int): CollectionChangeRecord {
|
||||
index: number): CollectionChangeRecord {
|
||||
if (this._unlinkedRecords !== null) {
|
||||
this._unlinkedRecords.remove(record);
|
||||
}
|
||||
|
@ -308,7 +308,7 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
|||
}
|
||||
|
||||
_moveAfter(record: CollectionChangeRecord, prevRecord: CollectionChangeRecord,
|
||||
index: int): CollectionChangeRecord {
|
||||
index: number): CollectionChangeRecord {
|
||||
this._unlink(record);
|
||||
this._insertAfter(record, prevRecord, index);
|
||||
this._addToMoves(record, index);
|
||||
|
@ -316,7 +316,7 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
|||
}
|
||||
|
||||
_addAfter(record: CollectionChangeRecord, prevRecord: CollectionChangeRecord,
|
||||
index: int): CollectionChangeRecord {
|
||||
index: number): CollectionChangeRecord {
|
||||
this._insertAfter(record, prevRecord, index);
|
||||
|
||||
if (this._additionsTail === null) {
|
||||
|
@ -333,7 +333,7 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
|||
}
|
||||
|
||||
_insertAfter(record: CollectionChangeRecord, prevRecord: CollectionChangeRecord,
|
||||
index: int): CollectionChangeRecord {
|
||||
index: number): CollectionChangeRecord {
|
||||
// todo(vicb)
|
||||
// assert(record != prevRecord);
|
||||
// assert(record._next === null);
|
||||
|
@ -395,7 +395,7 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
|||
return record;
|
||||
}
|
||||
|
||||
_addToMoves(record: CollectionChangeRecord, toIndex: int): CollectionChangeRecord {
|
||||
_addToMoves(record: CollectionChangeRecord, toIndex: number): CollectionChangeRecord {
|
||||
// todo(vicb)
|
||||
// assert(record._nextMoved === null);
|
||||
|
||||
|
@ -473,8 +473,8 @@ export class DefaultIterableDiffer implements IterableDiffer {
|
|||
}
|
||||
|
||||
export class CollectionChangeRecord {
|
||||
currentIndex: int = null;
|
||||
previousIndex: int = null;
|
||||
currentIndex: number = null;
|
||||
previousIndex: number = null;
|
||||
|
||||
_nextPrevious: CollectionChangeRecord = null;
|
||||
_prev: CollectionChangeRecord = null;
|
||||
|
@ -524,7 +524,7 @@ class _DuplicateItemRecordList {
|
|||
|
||||
// Returns a CollectionChangeRecord having CollectionChangeRecord.item == item and
|
||||
// CollectionChangeRecord.currentIndex >= afterIndex
|
||||
get(item: any, afterIndex: int): CollectionChangeRecord {
|
||||
get(item: any, afterIndex: number): CollectionChangeRecord {
|
||||
var record: CollectionChangeRecord;
|
||||
for (record = this._head; record !== null; record = record._nextDup) {
|
||||
if ((afterIndex === null || afterIndex < record.currentIndex) &&
|
||||
|
@ -588,7 +588,7 @@ class _DuplicateMap {
|
|||
* Use case: `[a, b, c, a, a]` if we are at index `3` which is the second `a` then asking if we
|
||||
* have any more `a`s needs to return the last `a` not the first or second.
|
||||
*/
|
||||
get(value: any, afterIndex: int = null): CollectionChangeRecord {
|
||||
get(value: any, afterIndex: number = null): CollectionChangeRecord {
|
||||
var key = getMapKey(value);
|
||||
|
||||
var recordList = this.map.get(key);
|
||||
|
|
|
@ -122,24 +122,24 @@ export class Parser {
|
|||
}
|
||||
|
||||
export class _ParseAST {
|
||||
index: int = 0;
|
||||
index: number = 0;
|
||||
constructor(public input: string, public location: any, public tokens: List<any>,
|
||||
public reflector: Reflector, public parseAction: boolean) {}
|
||||
|
||||
peek(offset: int): Token {
|
||||
peek(offset: number): Token {
|
||||
var i = this.index + offset;
|
||||
return i < this.tokens.length ? this.tokens[i] : EOF;
|
||||
}
|
||||
|
||||
get next(): Token { return this.peek(0); }
|
||||
|
||||
get inputIndex(): int {
|
||||
get inputIndex(): number {
|
||||
return (this.index < this.tokens.length) ? this.next.index : this.input.length;
|
||||
}
|
||||
|
||||
advance() { this.index++; }
|
||||
|
||||
optionalCharacter(code: int): boolean {
|
||||
optionalCharacter(code: number): boolean {
|
||||
if (this.next.isCharacter(code)) {
|
||||
this.advance();
|
||||
return true;
|
||||
|
@ -159,7 +159,7 @@ export class _ParseAST {
|
|||
|
||||
peekKeywordVar(): boolean { return this.next.isKeywordVar() || this.next.isOperator('#'); }
|
||||
|
||||
expectCharacter(code: int) {
|
||||
expectCharacter(code: number) {
|
||||
if (this.optionalCharacter(code)) return;
|
||||
this.error(`Missing expected ${StringWrapper.fromCharCode(code)}`);
|
||||
}
|
||||
|
@ -453,7 +453,7 @@ export class _ParseAST {
|
|||
throw new BaseException("Fell through all cases in parsePrimary");
|
||||
}
|
||||
|
||||
parseExpressionList(terminator: int): List<any> {
|
||||
parseExpressionList(terminator: number): List<any> {
|
||||
var result = [];
|
||||
if (!this.next.isCharacter(terminator)) {
|
||||
do {
|
||||
|
@ -606,7 +606,7 @@ export class _ParseAST {
|
|||
return bindings;
|
||||
}
|
||||
|
||||
error(message: string, index: int = null) {
|
||||
error(message: string, index: number = null) {
|
||||
if (isBlank(index)) index = this.index;
|
||||
|
||||
var location = (index < this.tokens.length) ? `at column ${this.tokens[index].index + 1} in` :
|
||||
|
|
|
@ -7,7 +7,7 @@ export class ElementBinder {
|
|||
// updated later, so we are able to resolve cycles
|
||||
nestedProtoView: viewModule.AppProtoView = null;
|
||||
|
||||
constructor(public index: int, public parent: ElementBinder, public distanceToParent: int,
|
||||
constructor(public index: number, public parent: ElementBinder, public distanceToParent: number,
|
||||
public protoElementInjector: eiModule.ProtoElementInjector,
|
||||
public componentDirective: DirectiveBinding) {
|
||||
if (isBlank(index)) {
|
||||
|
|
|
@ -378,8 +378,9 @@ export class ProtoElementInjector {
|
|||
|
||||
|
||||
|
||||
constructor(public parent: ProtoElementInjector, public index: int, bwv: BindingWithVisibility[],
|
||||
public distanceToParent: number, public _firstBindingIsComponent: boolean,
|
||||
constructor(public parent: ProtoElementInjector, public index: number,
|
||||
bwv: BindingWithVisibility[], public distanceToParent: number,
|
||||
public _firstBindingIsComponent: boolean,
|
||||
public directiveVariableBindings: Map<string, number>) {
|
||||
var length = bwv.length;
|
||||
|
||||
|
|
|
@ -162,9 +162,9 @@ export class AppView implements ChangeDispatcher, RenderEventDispatcher {
|
|||
*
|
||||
* @param {string} eventName
|
||||
* @param {*} eventObj
|
||||
* @param {int} boundElementIndex
|
||||
* @param {number} boundElementIndex
|
||||
*/
|
||||
triggerEventHandlers(eventName: string, eventObj: Event, boundElementIndex: int): void {
|
||||
triggerEventHandlers(eventName: string, eventObj: Event, boundElementIndex: number): void {
|
||||
var locals = new Map();
|
||||
locals.set('$event', eventObj);
|
||||
this.dispatchEvent(boundElementIndex, eventName, locals);
|
||||
|
@ -328,7 +328,7 @@ export class AppProtoView {
|
|||
}
|
||||
}
|
||||
|
||||
bindElement(parent: ElementBinder, distanceToParent: int,
|
||||
bindElement(parent: ElementBinder, distanceToParent: number,
|
||||
protoElementInjector: ProtoElementInjector,
|
||||
componentDirective: DirectiveBinding = null): ElementBinder {
|
||||
var elBinder = new ElementBinder(this.elementBinders.length, parent, distanceToParent,
|
||||
|
|
|
@ -58,11 +58,13 @@ export class PromiseWrapper {
|
|||
}
|
||||
|
||||
export class TimerWrapper {
|
||||
static setTimeout(fn: Function, millis: int): int { return global.setTimeout(fn, millis); }
|
||||
static clearTimeout(id: int): void { global.clearTimeout(id); }
|
||||
static setTimeout(fn: Function, millis: number): number { return global.setTimeout(fn, millis); }
|
||||
static clearTimeout(id: number): void { global.clearTimeout(id); }
|
||||
|
||||
static setInterval(fn: Function, millis: int): int { return global.setInterval(fn, millis); }
|
||||
static clearInterval(id: int): void { global.clearInterval(id); }
|
||||
static setInterval(fn: Function, millis: number): number {
|
||||
return global.setInterval(fn, millis);
|
||||
}
|
||||
static clearInterval(id: number): void { global.clearInterval(id); }
|
||||
}
|
||||
|
||||
export class ObservableWrapper {
|
||||
|
|
|
@ -51,9 +51,9 @@ export class NumberFormatter {
|
|||
static format(number: number, locale: string, style: NumberFormatStyle,
|
||||
{minimumIntegerDigits = 1, minimumFractionDigits = 0, maximumFractionDigits = 3,
|
||||
currency, currencyAsSymbol = false}: {
|
||||
minimumIntegerDigits?: int,
|
||||
minimumFractionDigits?: int,
|
||||
maximumFractionDigits?: int,
|
||||
minimumIntegerDigits?: number,
|
||||
minimumFractionDigits?: number,
|
||||
maximumFractionDigits?: number,
|
||||
currency?: string,
|
||||
currencyAsSymbol?: boolean
|
||||
} = {}): string {
|
||||
|
@ -71,10 +71,10 @@ export class NumberFormatter {
|
|||
}
|
||||
}
|
||||
|
||||
function digitCondition(len: int): string {
|
||||
function digitCondition(len: number): string {
|
||||
return len == 2 ? '2-digit' : 'numeric';
|
||||
}
|
||||
function nameCondition(len: int): string {
|
||||
function nameCondition(len: number): string {
|
||||
return len < 4 ? 'short' : 'long';
|
||||
}
|
||||
function extractComponents(pattern: string): Intl.DateTimeFormatOptions {
|
||||
|
|
|
@ -50,7 +50,7 @@ int serializeEnum(val) {
|
|||
* val should be the indexed value of the enum (sa returned from @Link{serializeEnum})
|
||||
* values should be a map from indexes to values for the enum that you want to deserialize.
|
||||
*/
|
||||
dynamic deserializeEnum(int val, Map<int, dynamic> values) {
|
||||
dynamic deserializeEnum(num val, Map<num, dynamic> values) {
|
||||
return values[val];
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ _global.assert = function assert(condition) {
|
|||
}
|
||||
};
|
||||
|
||||
export function ENUM_INDEX(value: int): int {
|
||||
export function ENUM_INDEX(value: number): number {
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@ -139,18 +139,18 @@ export function stringify(token): string {
|
|||
// serialize / deserialize enum exist only for consistency with dart API
|
||||
// enums in typescript don't need to be serialized
|
||||
|
||||
export function serializeEnum(val): int {
|
||||
export function serializeEnum(val): number {
|
||||
return val;
|
||||
}
|
||||
|
||||
export function deserializeEnum(val, values: Map<int, any>): any {
|
||||
export function deserializeEnum(val, values: Map<number, any>): any {
|
||||
return val;
|
||||
}
|
||||
|
||||
export class StringWrapper {
|
||||
static fromCharCode(code: int): string { return String.fromCharCode(code); }
|
||||
static fromCharCode(code: number): string { return String.fromCharCode(code); }
|
||||
|
||||
static charCodeAt(s: string, index: int): number { return s.charCodeAt(index); }
|
||||
static charCodeAt(s: string, index: number): number { return s.charCodeAt(index); }
|
||||
|
||||
static split(s: string, regExp: RegExp): List<string> { return s.split(regExp); }
|
||||
|
||||
|
@ -170,7 +170,7 @@ export class StringWrapper {
|
|||
|
||||
static startsWith(s: string, start: string): boolean { return s.startsWith(start); }
|
||||
|
||||
static substring(s: string, start: int, end: int = null): string {
|
||||
static substring(s: string, start: number, end: number = null): string {
|
||||
return s.substring(start, end === null ? undefined : end);
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,7 @@ export class StringWrapper {
|
|||
|
||||
static contains(s: string, substr: string): boolean { return s.indexOf(substr) != -1; }
|
||||
|
||||
static compare(a: string, b: string): int {
|
||||
static compare(a: string, b: string): number {
|
||||
if (a < b) {
|
||||
return -1;
|
||||
} else if (a > b) {
|
||||
|
@ -214,19 +214,19 @@ export class NumberParseError extends BaseException {
|
|||
|
||||
|
||||
export class NumberWrapper {
|
||||
static toFixed(n: number, fractionDigits: int): string { return n.toFixed(fractionDigits); }
|
||||
static toFixed(n: number, fractionDigits: number): string { return n.toFixed(fractionDigits); }
|
||||
|
||||
static equal(a: number, b: number): boolean { return a === b; }
|
||||
|
||||
static parseIntAutoRadix(text: string): int {
|
||||
var result: int = parseInt(text);
|
||||
static parseIntAutoRadix(text: string): number {
|
||||
var result: number = parseInt(text);
|
||||
if (isNaN(result)) {
|
||||
throw new NumberParseError("Invalid integer literal when parsing " + text);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static parseInt(text: string, radix: int): int {
|
||||
static parseInt(text: string, radix: number): number {
|
||||
if (radix == 10) {
|
||||
if (/^(\-|\+)?[0-9]+$/.test(text)) {
|
||||
return parseInt(text, radix);
|
||||
|
@ -236,7 +236,7 @@ export class NumberWrapper {
|
|||
return parseInt(text, radix);
|
||||
}
|
||||
} else {
|
||||
var result: int = parseInt(text, radix);
|
||||
var result: number = parseInt(text, radix);
|
||||
if (!isNaN(result)) {
|
||||
return result;
|
||||
}
|
||||
|
@ -338,12 +338,12 @@ export class Json {
|
|||
}
|
||||
|
||||
export class DateWrapper {
|
||||
static create(year: int, month: int = 1, day: int = 1, hour: int = 0, minutes: int = 0,
|
||||
seconds: int = 0, milliseconds: int = 0): Date {
|
||||
static create(year: number, month: number = 1, day: number = 1, hour: number = 0,
|
||||
minutes: number = 0, seconds: number = 0, milliseconds: number = 0): Date {
|
||||
return new Date(year, month - 1, day, hour, minutes, seconds, milliseconds);
|
||||
}
|
||||
static fromMillis(ms: int): Date { return new Date(ms); }
|
||||
static toMillis(date: Date): int { return date.getTime(); }
|
||||
static fromMillis(ms: number): Date { return new Date(ms); }
|
||||
static toMillis(date: Date): number { return date.getTime(); }
|
||||
static now(): Date { return new Date(); }
|
||||
static toJson(date: Date): string { return date.toJSON(); }
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ export class LimitToPipe implements PipeTransform {
|
|||
throw new InvalidPipeArgumentException(LimitToPipe, value);
|
||||
}
|
||||
if (isBlank(value)) return value;
|
||||
var limit: int = args[0];
|
||||
var limit: number = args[0];
|
||||
var left = 0, right = Math.min(limit, value.length);
|
||||
if (limit < 0) {
|
||||
left = Math.max(0, value.length + limit);
|
||||
|
|
|
@ -42,24 +42,24 @@ import {
|
|||
|
||||
@Injectable()
|
||||
export class Serializer {
|
||||
private _enumRegistry: Map<any, Map<int, any>>;
|
||||
private _enumRegistry: Map<any, Map<number, any>>;
|
||||
constructor(private _parser: Parser, private _protoViewStore: RenderProtoViewRefStore,
|
||||
private _renderViewStore: RenderViewWithFragmentsStore) {
|
||||
this._enumRegistry = new Map<any, Map<int, any>>();
|
||||
this._enumRegistry = new Map<any, Map<number, any>>();
|
||||
|
||||
var viewTypeMap = new Map<int, any>();
|
||||
var viewTypeMap = new Map<number, any>();
|
||||
viewTypeMap[0] = ViewType.HOST;
|
||||
viewTypeMap[1] = ViewType.COMPONENT;
|
||||
viewTypeMap[2] = ViewType.EMBEDDED;
|
||||
this._enumRegistry.set(ViewType, viewTypeMap);
|
||||
|
||||
var viewEncapsulationMap = new Map<int, any>();
|
||||
var viewEncapsulationMap = new Map<number, any>();
|
||||
viewEncapsulationMap[0] = ViewEncapsulation.EMULATED;
|
||||
viewEncapsulationMap[1] = ViewEncapsulation.NATIVE;
|
||||
viewEncapsulationMap[2] = ViewEncapsulation.NONE;
|
||||
this._enumRegistry.set(ViewEncapsulation, viewEncapsulationMap);
|
||||
|
||||
var propertyBindingTypeMap = new Map<int, any>();
|
||||
var propertyBindingTypeMap = new Map<number, any>();
|
||||
propertyBindingTypeMap[0] = PropertyBindingType.PROPERTY;
|
||||
propertyBindingTypeMap[1] = PropertyBindingType.ATTRIBUTE;
|
||||
propertyBindingTypeMap[2] = PropertyBindingType.CLASS;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import {List} from 'angular2/src/facade/collection';
|
||||
|
||||
export class TestIterable {
|
||||
list: List<int>;
|
||||
list: List<number>;
|
||||
constructor() { this.list = []; }
|
||||
|
||||
[Symbol.iterator]() { return this.list[Symbol.iterator](); }
|
||||
|
|
|
@ -53,13 +53,13 @@ export function main() {
|
|||
describe('lexer', function() {
|
||||
describe('token', function() {
|
||||
it('should tokenize a simple identifier', function() {
|
||||
var tokens: List<int> = lex("j");
|
||||
var tokens: List<number> = lex("j");
|
||||
expect(tokens.length).toEqual(1);
|
||||
expectIdentifierToken(tokens[0], 0, 'j');
|
||||
});
|
||||
|
||||
it('should tokenize a dotted identifier', function() {
|
||||
var tokens: List<int> = lex("j.k");
|
||||
var tokens: List<number> = lex("j.k");
|
||||
expect(tokens.length).toEqual(3);
|
||||
expectIdentifierToken(tokens[0], 0, 'j');
|
||||
expectCharacterToken(tokens[1], 1, '.');
|
||||
|
@ -67,20 +67,20 @@ export function main() {
|
|||
});
|
||||
|
||||
it('should tokenize an operator', function() {
|
||||
var tokens: List<int> = lex("j-k");
|
||||
var tokens: List<number> = lex("j-k");
|
||||
expect(tokens.length).toEqual(3);
|
||||
expectOperatorToken(tokens[1], 1, '-');
|
||||
});
|
||||
|
||||
it('should tokenize an indexed operator', function() {
|
||||
var tokens: List<int> = lex("j[k]");
|
||||
var tokens: List<number> = lex("j[k]");
|
||||
expect(tokens.length).toEqual(4);
|
||||
expectCharacterToken(tokens[1], 1, "[");
|
||||
expectCharacterToken(tokens[3], 3, "]");
|
||||
});
|
||||
|
||||
it('should tokenize numbers', function() {
|
||||
var tokens: List<int> = lex("88");
|
||||
var tokens: List<number> = lex("88");
|
||||
expect(tokens.length).toEqual(1);
|
||||
expectNumberToken(tokens[0], 0, 88);
|
||||
});
|
||||
|
|
|
@ -10,7 +10,7 @@ import {
|
|||
|
||||
export function main() {
|
||||
describe('ListWrapper', () => {
|
||||
var l: List<int>;
|
||||
var l: List<number>;
|
||||
|
||||
describe('splice', () => {
|
||||
it('should remove sublist of given length and return it', () => {
|
||||
|
|
|
@ -302,13 +302,13 @@ export class MdGridTile {
|
|||
*/
|
||||
class TileCoordinator {
|
||||
// Tracking array (see class description).
|
||||
tracker: List<int>;
|
||||
tracker: List<number>;
|
||||
|
||||
// Index at which the search for the next gap will start.
|
||||
columnIndex: int;
|
||||
columnIndex: number;
|
||||
|
||||
// The current row index.
|
||||
rowIndex: int;
|
||||
rowIndex: number;
|
||||
|
||||
// The computed (row, col) position of each tile (the output).
|
||||
positions: List<Position>;
|
||||
|
|
|
@ -25,9 +25,9 @@ import {Component, Directive, View} from 'angular2/angular2';
|
|||
</div>`
|
||||
})
|
||||
export class App {
|
||||
scrollAreas: List<int>;
|
||||
iterationCount: int;
|
||||
scrollIncrement: int;
|
||||
scrollAreas: List<number>;
|
||||
iterationCount: number;
|
||||
scrollIncrement: number;
|
||||
|
||||
constructor() {
|
||||
var appSize = getIntParameter('appSize');
|
||||
|
@ -50,7 +50,7 @@ export class App {
|
|||
|
||||
runBenchmark() {
|
||||
var scrollDiv = this._getScrollDiv();
|
||||
var n: int = this.iterationCount;
|
||||
var n: number = this.iterationCount;
|
||||
var scheduleScroll;
|
||||
scheduleScroll = () => {
|
||||
TimerWrapper.setTimeout(() => {
|
||||
|
|
|
@ -5,11 +5,11 @@ import {NgFor} from 'angular2/directives';
|
|||
import {Component, Directive, View} from 'angular2/angular2';
|
||||
|
||||
export class HasStyle {
|
||||
cellWidth: int;
|
||||
cellWidth: number;
|
||||
|
||||
constructor() {}
|
||||
|
||||
set width(w: int) { this.cellWidth = w; }
|
||||
set width(w: number) { this.cellWidth = w; }
|
||||
}
|
||||
|
||||
@Component({selector: 'company-name', properties: ['width: cell-width', 'company']})
|
||||
|
|
|
@ -10,7 +10,7 @@ import {
|
|||
AAT_STATUS_LIST
|
||||
} from './common';
|
||||
|
||||
export function generateOfferings(count: int): List<Offering> {
|
||||
export function generateOfferings(count: number): List<Offering> {
|
||||
var res = [];
|
||||
for (var i = 0; i < count; i++) {
|
||||
res.push(generateOffering(i));
|
||||
|
@ -18,7 +18,7 @@ export function generateOfferings(count: int): List<Offering> {
|
|||
return res;
|
||||
}
|
||||
|
||||
export function generateOffering(seed: int): Offering {
|
||||
export function generateOffering(seed: number): Offering {
|
||||
var res = new Offering();
|
||||
res.name = generateName(seed++);
|
||||
res.company = generateCompany(seed++);
|
||||
|
@ -34,19 +34,19 @@ export function generateOffering(seed: int): Offering {
|
|||
return res;
|
||||
}
|
||||
|
||||
export function generateCompany(seed: int): Company {
|
||||
export function generateCompany(seed: number): Company {
|
||||
var res = new Company();
|
||||
res.name = generateName(seed);
|
||||
return res;
|
||||
}
|
||||
|
||||
export function generateOpportunity(seed: int): Opportunity {
|
||||
export function generateOpportunity(seed: number): Opportunity {
|
||||
var res = new Opportunity();
|
||||
res.name = generateName(seed);
|
||||
return res;
|
||||
}
|
||||
|
||||
export function generateAccount(seed: int): Account {
|
||||
export function generateAccount(seed: number): Account {
|
||||
var res = new Account();
|
||||
res.accountId = seed;
|
||||
return res;
|
||||
|
@ -68,13 +68,13 @@ var names = [
|
|||
'Stuff'
|
||||
];
|
||||
|
||||
function generateName(seed: int): string {
|
||||
function generateName(seed: number): string {
|
||||
return names[seed % names.length];
|
||||
}
|
||||
|
||||
var offsets = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
|
||||
|
||||
function randomDate(seed: int, minDate: CustomDate = null): CustomDate {
|
||||
function randomDate(seed: number, minDate: CustomDate = null): CustomDate {
|
||||
if (minDate == null) {
|
||||
minDate = CustomDate.now();
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ function randomDate(seed: int, minDate: CustomDate = null): CustomDate {
|
|||
var stringLengths = [5, 7, 9, 11, 13];
|
||||
var charCodeOffsets = [0, 1, 2, 3, 4, 5, 6, 7, 8];
|
||||
|
||||
function randomString(seed: int): string {
|
||||
function randomString(seed: number): string {
|
||||
var len = stringLengths[seed % 5];
|
||||
var str = '';
|
||||
for (var i = 0; i < len; i++) {
|
||||
|
|
|
@ -25,7 +25,7 @@ export class PerflogMetric extends Metric {
|
|||
static get SET_TIMEOUT(): OpaqueToken { return _SET_TIMEOUT; }
|
||||
|
||||
private _remainingEvents: List<StringMap<string, any>>;
|
||||
private _measureCount: int;
|
||||
private _measureCount: number;
|
||||
_perfLogFeatures: PerfLogFeatures;
|
||||
|
||||
|
||||
|
@ -124,7 +124,7 @@ export class PerflogMetric extends Metric {
|
|||
.then((_) => this._readUntilEndMark(markName));
|
||||
}
|
||||
|
||||
_readUntilEndMark(markName: string, loopCount: int = 0, startEvent = null) {
|
||||
_readUntilEndMark(markName: string, loopCount: number = 0, startEvent = null) {
|
||||
if (loopCount > _MAX_RETRY_COUNT) {
|
||||
throw new BaseException(`Tried too often to get the ending mark: ${loopCount}`);
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ export enum RequestMethods {
|
|||
export class RequestMethodsMap {
|
||||
private _methods: List<string>;
|
||||
constructor() { this._methods = ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS', 'HEAD', 'PATCH']; }
|
||||
getMethod(method: int): string { return this._methods[method]; }
|
||||
getMethod(method: number): string { return this._methods[method]; }
|
||||
}
|
||||
/**
|
||||
* All possible states in which a connection can be, based on
|
||||
|
|
Loading…
Reference in New Issue