style(ChangeDetection): idiomatic TS

This commit is contained in:
Victor Berchet
2015-06-16 08:47:24 +02:00
parent cdfb635737
commit 598a75ec1c
16 changed files with 128 additions and 228 deletions

View File

@ -8,12 +8,12 @@ import {
isPresent
} from "angular2/src/facade/lang";
export const TOKEN_TYPE_CHARACTER = 1;
export const TOKEN_TYPE_IDENTIFIER = 2;
export const TOKEN_TYPE_KEYWORD = 3;
export const TOKEN_TYPE_STRING = 4;
export const TOKEN_TYPE_OPERATOR = 5;
export const TOKEN_TYPE_NUMBER = 6;
const TOKEN_TYPE_CHARACTER = 1;
const TOKEN_TYPE_IDENTIFIER = 2;
const TOKEN_TYPE_KEYWORD = 3;
const TOKEN_TYPE_STRING = 4;
const TOKEN_TYPE_OPERATOR = 5;
const TOKEN_TYPE_NUMBER = 6;
@Injectable()
export class Lexer {
@ -160,24 +160,18 @@ const $NBSP = 160;
export class ScannerError extends BaseException {
message: string;
constructor(message) {
super();
this.message = message;
}
constructor(public message) { super(); }
toString() { return this.message; }
toString(): string { return this.message; }
}
class _Scanner {
length: number;
peek: number;
index: number;
peek: number = 0;
index: number = -1;
constructor(public input: string) {
this.length = input.length;
this.peek = 0;
this.index = -1;
this.advance();
}

View File

@ -55,10 +55,9 @@ var INTERPOLATION_REGEXP = RegExpWrapper.create('\\{\\{(.*?)\\}\\}');
@Injectable()
export class Parser {
_lexer: Lexer;
_reflector: Reflector;
constructor(lexer: Lexer, providedReflector: Reflector = null) {
this._lexer = lexer;
constructor(public _lexer: Lexer, providedReflector: Reflector = null) {
this._reflector = isPresent(providedReflector) ? providedReflector : reflector;
}
@ -116,11 +115,9 @@ export class Parser {
}
class _ParseAST {
index: int;
index: int = 0;
constructor(public input: string, public location: any, public tokens: List<any>,
public reflector: Reflector, public parseAction: boolean) {
this.index = 0;
}
public reflector: Reflector, public parseAction: boolean) {}
peek(offset: int): Token {
var i = this.index + offset;