style(lint): re-format modules/@angular

This commit is contained in:
Alex Eagle
2016-06-08 16:38:52 -07:00
parent bbed364e7b
commit f39c9c9e75
589 changed files with 21829 additions and 24259 deletions
@@ -2,7 +2,7 @@ import {ListWrapper} from '../facade/collection';
export class AST {
visit(visitor: AstVisitor, context: any = null): any { return null; }
toString(): string { return "AST"; }
toString(): string { return 'AST'; }
}
/**
@@ -23,7 +23,7 @@ export class Quote extends AST {
super();
}
visit(visitor: AstVisitor, context: any = null): any { return visitor.visitQuote(this, context); }
toString(): string { return "Quote"; }
toString(): string { return 'Quote'; }
}
export class EmptyExpr extends AST {
@@ -163,8 +163,9 @@ export class ASTWithSource extends AST {
}
export class TemplateBinding {
constructor(public key: string, public keyIsVar: boolean, public name: string,
public expression: ASTWithSource) {}
constructor(
public key: string, public keyIsVar: boolean, public name: string,
public expression: ASTWithSource) {}
}
export interface AstVisitor {
@@ -316,8 +317,8 @@ export class AstTransformer implements AstVisitor {
}
visitConditional(ast: Conditional, context: any): AST {
return new Conditional(ast.condition.visit(this), ast.trueExp.visit(this),
ast.falseExp.visit(this));
return new Conditional(
ast.condition.visit(this), ast.trueExp.visit(this), ast.falseExp.visit(this));
}
visitPipe(ast: BindingPipe, context: any): AST {
@@ -1,7 +1,8 @@
import {Injectable} from '@angular/core';
import {SetWrapper} from '../facade/collection';
import {NumberWrapper, StringJoiner, StringWrapper, isPresent} from '../facade/lang';
import {BaseException} from '../facade/exceptions';
import {NumberWrapper, StringJoiner, StringWrapper, isPresent} from '../facade/lang';
export enum TokenType {
Character,
@@ -27,8 +28,9 @@ export class Lexer {
}
export class Token {
constructor(public index: number, public type: TokenType, public numValue: number,
public strValue: string) {}
constructor(
public index: number, public type: TokenType, public numValue: number,
public strValue: string) {}
isCharacter(code: number): boolean {
return (this.type == TokenType.Character && this.numValue == code);
@@ -47,20 +49,20 @@ export class Token {
isKeyword(): boolean { return (this.type == TokenType.Keyword); }
isKeywordDeprecatedVar(): boolean {
return (this.type == TokenType.Keyword && this.strValue == "var");
return (this.type == TokenType.Keyword && this.strValue == 'var');
}
isKeywordLet(): boolean { return (this.type == TokenType.Keyword && this.strValue == "let"); }
isKeywordLet(): boolean { return (this.type == TokenType.Keyword && this.strValue == 'let'); }
isKeywordNull(): boolean { return (this.type == TokenType.Keyword && this.strValue == "null"); }
isKeywordNull(): boolean { return (this.type == TokenType.Keyword && this.strValue == 'null'); }
isKeywordUndefined(): boolean {
return (this.type == TokenType.Keyword && this.strValue == "undefined");
return (this.type == TokenType.Keyword && this.strValue == 'undefined');
}
isKeywordTrue(): boolean { return (this.type == TokenType.Keyword && this.strValue == "true"); }
isKeywordTrue(): boolean { return (this.type == TokenType.Keyword && this.strValue == 'true'); }
isKeywordFalse(): boolean { return (this.type == TokenType.Keyword && this.strValue == "false"); }
isKeywordFalse(): boolean { return (this.type == TokenType.Keyword && this.strValue == 'false'); }
toNumber(): number {
// -1 instead of NULL ok?
@@ -104,11 +106,11 @@ function newStringToken(index: number, text: string): Token {
}
function newNumberToken(index: number, n: number): Token {
return new Token(index, TokenType.Number, n, "");
return new Token(index, TokenType.Number, n, '');
}
export var EOF: Token = new Token(-1, TokenType.Character, 0, "");
export var EOF: Token = new Token(-1, TokenType.Character, 0, '');
export const $EOF = /*@ts2dart_const*/ 0;
export const $TAB = /*@ts2dart_const*/ 9;
@@ -237,8 +239,8 @@ class _Scanner {
return this.scanComplexOperator(start, StringWrapper.fromCharCode(peek), $EQ, '=');
case $BANG:
case $EQ:
return this.scanComplexOperator(start, StringWrapper.fromCharCode(peek), $EQ, '=', $EQ,
'=');
return this.scanComplexOperator(
start, StringWrapper.fromCharCode(peek), $EQ, '=', $EQ, '=');
case $AMPERSAND:
return this.scanComplexOperator(start, '&', $AMPERSAND, '&');
case $BAR:
@@ -274,8 +276,9 @@ class _Scanner {
* @param three third symbol (part of the operator when provided and matches source expression)
* @returns {Token}
*/
scanComplexOperator(start: number, one: string, twoCode: number, two: string, threeCode?: number,
three?: string): Token {
scanComplexOperator(
start: number, one: string, twoCode: number, two: string, threeCode?: number,
three?: string): Token {
this.advance();
var str: string = one;
if (this.peek == twoCode) {
@@ -406,7 +409,7 @@ export function isIdentifier(input: string): boolean {
function isIdentifierPart(code: number): boolean {
return ($a <= code && code <= $z) || ($A <= code && code <= $Z) || ($0 <= code && code <= $9) ||
(code == $_) || (code == $$);
(code == $_) || (code == $$);
}
function isDigit(code: number): boolean {
@@ -443,29 +446,8 @@ function unescape(code: number): number {
}
var OPERATORS = SetWrapper.createFromList([
'+',
'-',
'*',
'/',
'%',
'^',
'=',
'==',
'!=',
'===',
'!==',
'<',
'>',
'<=',
'>=',
'&&',
'||',
'&',
'|',
'!',
'?',
'#',
'?.'
'+', '-', '*', '/', '%', '^', '=', '==', '!=', '===', '!==', '<',
'>', '<=', '>=', '&&', '||', '&', '|', '!', '?', '#', '?.'
]);
@@ -1,51 +1,11 @@
import {Injectable} from '@angular/core';
import {isBlank, isPresent, StringWrapper} from '../facade/lang';
import {BaseException} from '../facade/exceptions';
import {ListWrapper} from '../facade/collection';
import {
Lexer,
EOF,
isIdentifier,
isQuote,
Token,
$PERIOD,
$COLON,
$SEMICOLON,
$LBRACKET,
$RBRACKET,
$COMMA,
$LBRACE,
$RBRACE,
$LPAREN,
$RPAREN,
$SLASH
} from './lexer';
import {
AST,
EmptyExpr,
ImplicitReceiver,
PropertyRead,
PropertyWrite,
SafePropertyRead,
LiteralPrimitive,
Binary,
PrefixNot,
Conditional,
BindingPipe,
Chain,
KeyedRead,
KeyedWrite,
LiteralArray,
LiteralMap,
Interpolation,
MethodCall,
SafeMethodCall,
FunctionCall,
TemplateBinding,
ASTWithSource,
AstVisitor,
Quote
} from './ast';
import {BaseException} from '../facade/exceptions';
import {StringWrapper, isBlank, isPresent} from '../facade/lang';
import {AST, ASTWithSource, AstVisitor, Binary, BindingPipe, Chain, Conditional, EmptyExpr, FunctionCall, ImplicitReceiver, Interpolation, KeyedRead, KeyedWrite, LiteralArray, LiteralMap, LiteralPrimitive, MethodCall, PrefixNot, PropertyRead, PropertyWrite, Quote, SafeMethodCall, SafePropertyRead, TemplateBinding} from './ast';
import {$COLON, $COMMA, $LBRACE, $LBRACKET, $LPAREN, $PERIOD, $RBRACE, $RBRACKET, $RPAREN, $SEMICOLON, $SLASH, EOF, Lexer, Token, isIdentifier, isQuote} from './lexer';
var _implicitReceiver = new ImplicitReceiver();
@@ -152,9 +112,9 @@ export class Parser {
} else if (part.trim().length > 0) {
expressions.push(part);
} else {
throw new ParseException('Blank expressions are not allowed in interpolated strings', input,
`at column ${this._findInterpolationErrorColumn(parts, i)} in`,
location);
throw new ParseException(
'Blank expressions are not allowed in interpolated strings', input,
`at column ${this._findInterpolationErrorColumn(parts, i)} in`, location);
}
}
return new SplitInterpolation(strings, expressions);
@@ -189,9 +149,9 @@ export class Parser {
private _checkNoInterpolation(input: string, location: any): void {
var parts = StringWrapper.split(input, INTERPOLATION_REGEXP);
if (parts.length > 1) {
throw new ParseException('Got interpolation ({{}}) where expression was expected', input,
`at column ${this._findInterpolationErrorColumn(parts, 1)} in`,
location);
throw new ParseException(
'Got interpolation ({{}}) where expression was expected', input,
`at column ${this._findInterpolationErrorColumn(parts, 1)} in`, location);
}
}
@@ -207,8 +167,9 @@ export class Parser {
export class _ParseAST {
index: number = 0;
constructor(public input: string, public location: any, public tokens: any[],
public parseAction: boolean) {}
constructor(
public input: string, public location: any, public tokens: any[],
public parseAction: boolean) {}
peek(offset: number): Token {
var i = this.index + offset;
@@ -284,7 +245,7 @@ export class _ParseAST {
if (this.optionalCharacter($SEMICOLON)) {
if (!this.parseAction) {
this.error("Binding expression cannot contain chained expression");
this.error('Binding expression cannot contain chained expression');
}
while (this.optionalCharacter($SEMICOLON)) {
} // read all semicolons
@@ -299,9 +260,9 @@ export class _ParseAST {
parsePipe(): AST {
var result = this.parseExpression();
if (this.optionalOperator("|")) {
if (this.optionalOperator('|')) {
if (this.parseAction) {
this.error("Cannot have a pipe in an action expression");
this.error('Cannot have a pipe in an action expression');
}
do {
@@ -311,7 +272,7 @@ export class _ParseAST {
args.push(this.parseExpression());
}
result = new BindingPipe(result, name, args);
} while (this.optionalOperator("|"));
} while (this.optionalOperator('|'));
}
return result;
@@ -445,7 +406,7 @@ export class _ParseAST {
} else if (this.optionalCharacter($LBRACKET)) {
var key = this.parsePipe();
this.expectCharacter($RBRACKET);
if (this.optionalOperator("=")) {
if (this.optionalOperator('=')) {
var value = this.parseConditional();
result = new KeyedWrite(result, key, value);
} else {
@@ -508,7 +469,7 @@ export class _ParseAST {
this.error(`Unexpected token ${this.next}`);
}
// error() throws, so we don't reach here.
throw new BaseException("Fell through all cases in parsePrimary");
throw new BaseException('Fell through all cases in parsePrimary');
}
parseExpressionList(terminator: number): any[] {
@@ -547,15 +508,15 @@ export class _ParseAST {
} else {
if (isSafe) {
if (this.optionalOperator("=")) {
this.error("The '?.' operator cannot be used in the assignment");
if (this.optionalOperator('=')) {
this.error('The \'?.\' operator cannot be used in the assignment');
} else {
return new SafePropertyRead(receiver, id);
}
} else {
if (this.optionalOperator("=")) {
if (this.optionalOperator('=')) {
if (!this.parseAction) {
this.error("Bindings cannot contain assignments");
this.error('Bindings cannot contain assignments');
}
let value = this.parseConditional();
@@ -580,7 +541,7 @@ export class _ParseAST {
parseBlockContent(): AST {
if (!this.parseAction) {
this.error("Binding expression cannot contain chained expression");
this.error('Binding expression cannot contain chained expression');
}
var exprs: any[] /** TODO #9100 */ = [];
while (this.index < this.tokens.length && !this.next.isCharacter($RBRACE)) {
@@ -645,13 +606,14 @@ export class _ParseAST {
var name: any /** TODO #9100 */ = null;
var expression: any /** TODO #9100 */ = null;
if (keyIsVar) {
if (this.optionalOperator("=")) {
if (this.optionalOperator('=')) {
name = this.expectTemplateBindingKey();
} else {
name = '\$implicit';
}
} else if (this.next !== EOF && !this.peekKeywordLet() && !this.peekDeprecatedKeywordVar() &&
!this.peekDeprecatedOperatorHash()) {
} else if (
this.next !== EOF && !this.peekKeywordLet() && !this.peekDeprecatedKeywordVar() &&
!this.peekDeprecatedOperatorHash()) {
var start = this.inputIndex;
var ast = this.parsePipe();
var source = this.input.substring(start, this.inputIndex);