refactor: add types (#9148)
This commit is contained in:
parent
55860e1621
commit
1f6fd3c8fc
|
@ -276,8 +276,6 @@ class TestComponent {
|
||||||
this.nestedBooleanCondition = true;
|
this.nestedBooleanCondition = true;
|
||||||
this.numberCondition = 1;
|
this.numberCondition = 1;
|
||||||
this.stringCondition = 'foo';
|
this.stringCondition = 'foo';
|
||||||
this.functionCondition = function(s: any /** TODO #9100 */, n: any /** TODO #9100 */) {
|
this.functionCondition = function(s: any, n: any): boolean { return s == 'foo' && n == 1; };
|
||||||
return s == 'foo' && n == 1;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ export function main() {
|
||||||
.toEqual('40px');
|
.toEqual('40px');
|
||||||
|
|
||||||
expr = fixture.debugElement.componentInstance.expr;
|
expr = fixture.debugElement.componentInstance.expr;
|
||||||
(expr as any /** TODO #9100 */)['max-width'] = '30%';
|
(expr as any)['max-width'] = '30%';
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
expect(getDOM().getStyle(
|
expect(getDOM().getStyle(
|
||||||
fixture.debugElement.children[0].nativeElement, 'max-width'))
|
fixture.debugElement.children[0].nativeElement, 'max-width'))
|
||||||
|
@ -153,5 +153,5 @@ export function main() {
|
||||||
|
|
||||||
@Component({selector: 'test-cmp', directives: [NgStyle], template: ''})
|
@Component({selector: 'test-cmp', directives: [NgStyle], template: ''})
|
||||||
class TestComponent {
|
class TestComponent {
|
||||||
expr: any /** TODO #9100 */;
|
expr: any;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ import {PromiseWrapper} from '../../src/facade/promise';
|
||||||
import {SimpleChange} from '@angular/core/src/change_detection';
|
import {SimpleChange} from '@angular/core/src/change_detection';
|
||||||
|
|
||||||
class DummyControlValueAccessor implements ControlValueAccessor {
|
class DummyControlValueAccessor implements ControlValueAccessor {
|
||||||
writtenValue: any /** TODO #9100 */;
|
writtenValue: any;
|
||||||
|
|
||||||
registerOnChange(fn: any /** TODO #9100 */) {}
|
registerOnChange(fn: any /** TODO #9100 */) {}
|
||||||
registerOnTouched(fn: any /** TODO #9100 */) {}
|
registerOnTouched(fn: any /** TODO #9100 */) {}
|
||||||
|
|
|
@ -94,7 +94,7 @@ export class BindingPipe extends AST {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class LiteralPrimitive extends AST {
|
export class LiteralPrimitive extends AST {
|
||||||
constructor(public value: any /** TODO #9100 */) { super(); }
|
constructor(public value: any) { super(); }
|
||||||
visit(visitor: AstVisitor, context: any = null): any {
|
visit(visitor: AstVisitor, context: any = null): any {
|
||||||
return visitor.visitLiteralPrimitive(this, context);
|
return visitor.visitLiteralPrimitive(this, context);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ export enum TokenType {
|
||||||
export class Lexer {
|
export class Lexer {
|
||||||
tokenize(text: string): any[] {
|
tokenize(text: string): any[] {
|
||||||
var scanner = new _Scanner(text);
|
var scanner = new _Scanner(text);
|
||||||
var tokens: any[] /** TODO #9100 */ = [];
|
var tokens: Token[] = [];
|
||||||
var token = scanner.scanToken();
|
var token = scanner.scanToken();
|
||||||
while (token != null) {
|
while (token != null) {
|
||||||
tokens.push(token);
|
tokens.push(token);
|
||||||
|
@ -162,7 +162,7 @@ export const $RBRACE = /*@ts2dart_const*/ 125;
|
||||||
const $NBSP = /*@ts2dart_const*/ 160;
|
const $NBSP = /*@ts2dart_const*/ 160;
|
||||||
|
|
||||||
export class ScannerError extends BaseException {
|
export class ScannerError extends BaseException {
|
||||||
constructor(public message: any /** TODO #9100 */) { super(); }
|
constructor(public message: string) { super(); }
|
||||||
|
|
||||||
toString(): string { return this.message; }
|
toString(): string { return this.message; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ export class Parser {
|
||||||
let split = this.splitInterpolation(input, location);
|
let split = this.splitInterpolation(input, location);
|
||||||
if (split == null) return null;
|
if (split == null) return null;
|
||||||
|
|
||||||
let expressions: any[] /** TODO #9100 */ = [];
|
let expressions: AST[] = [];
|
||||||
|
|
||||||
for (let i = 0; i < split.expressions.length; ++i) {
|
for (let i = 0; i < split.expressions.length; ++i) {
|
||||||
var tokens = this._lexer.tokenize(this._stripComments(split.expressions[i]));
|
var tokens = this._lexer.tokenize(this._stripComments(split.expressions[i]));
|
||||||
|
@ -101,8 +101,8 @@ export class Parser {
|
||||||
if (parts.length <= 1) {
|
if (parts.length <= 1) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
var strings: any[] /** TODO #9100 */ = [];
|
var strings: string[] = [];
|
||||||
var expressions: any[] /** TODO #9100 */ = [];
|
var expressions: string[] = [];
|
||||||
|
|
||||||
for (var i = 0; i < parts.length; i++) {
|
for (var i = 0; i < parts.length; i++) {
|
||||||
var part: string = parts[i];
|
var part: string = parts[i];
|
||||||
|
@ -130,7 +130,7 @@ export class Parser {
|
||||||
}
|
}
|
||||||
|
|
||||||
private _commentStart(input: string): number {
|
private _commentStart(input: string): number {
|
||||||
var outerQuote: any /** TODO #9100 */ = null;
|
var outerQuote: number = null;
|
||||||
for (var i = 0; i < input.length - 1; i++) {
|
for (var i = 0; i < input.length - 1; i++) {
|
||||||
let char = StringWrapper.charCodeAt(input, i);
|
let char = StringWrapper.charCodeAt(input, i);
|
||||||
let nextChar = StringWrapper.charCodeAt(input, i + 1);
|
let nextChar = StringWrapper.charCodeAt(input, i + 1);
|
||||||
|
@ -238,7 +238,7 @@ export class _ParseAST {
|
||||||
}
|
}
|
||||||
|
|
||||||
parseChain(): AST {
|
parseChain(): AST {
|
||||||
var exprs: any[] /** TODO #9100 */ = [];
|
var exprs: AST[] = [];
|
||||||
while (this.index < this.tokens.length) {
|
while (this.index < this.tokens.length) {
|
||||||
var expr = this.parsePipe();
|
var expr = this.parsePipe();
|
||||||
exprs.push(expr);
|
exprs.push(expr);
|
||||||
|
@ -267,7 +267,7 @@ export class _ParseAST {
|
||||||
|
|
||||||
do {
|
do {
|
||||||
var name = this.expectIdentifierOrKeyword();
|
var name = this.expectIdentifierOrKeyword();
|
||||||
var args: any[] /** TODO #9100 */ = [];
|
var args: AST[] = [];
|
||||||
while (this.optionalCharacter($COLON)) {
|
while (this.optionalCharacter($COLON)) {
|
||||||
args.push(this.parseExpression());
|
args.push(this.parseExpression());
|
||||||
}
|
}
|
||||||
|
@ -472,8 +472,8 @@ export class _ParseAST {
|
||||||
throw new BaseException('Fell through all cases in parsePrimary');
|
throw new BaseException('Fell through all cases in parsePrimary');
|
||||||
}
|
}
|
||||||
|
|
||||||
parseExpressionList(terminator: number): any[] {
|
parseExpressionList(terminator: number): AST[] {
|
||||||
var result: any[] /** TODO #9100 */ = [];
|
var result: AST[] = [];
|
||||||
if (!this.next.isCharacter(terminator)) {
|
if (!this.next.isCharacter(terminator)) {
|
||||||
do {
|
do {
|
||||||
result.push(this.parsePipe());
|
result.push(this.parsePipe());
|
||||||
|
@ -483,8 +483,8 @@ export class _ParseAST {
|
||||||
}
|
}
|
||||||
|
|
||||||
parseLiteralMap(): LiteralMap {
|
parseLiteralMap(): LiteralMap {
|
||||||
var keys: any[] /** TODO #9100 */ = [];
|
var keys: string[] = [];
|
||||||
var values: any[] /** TODO #9100 */ = [];
|
var values: AST[] = [];
|
||||||
this.expectCharacter($LBRACE);
|
this.expectCharacter($LBRACE);
|
||||||
if (!this.optionalCharacter($RBRACE)) {
|
if (!this.optionalCharacter($RBRACE)) {
|
||||||
do {
|
do {
|
||||||
|
@ -532,34 +532,13 @@ export class _ParseAST {
|
||||||
|
|
||||||
parseCallArguments(): BindingPipe[] {
|
parseCallArguments(): BindingPipe[] {
|
||||||
if (this.next.isCharacter($RPAREN)) return [];
|
if (this.next.isCharacter($RPAREN)) return [];
|
||||||
var positionals: any[] /** TODO #9100 */ = [];
|
var positionals: AST[] = [];
|
||||||
do {
|
do {
|
||||||
positionals.push(this.parsePipe());
|
positionals.push(this.parsePipe());
|
||||||
} while (this.optionalCharacter($COMMA));
|
} while (this.optionalCharacter($COMMA));
|
||||||
return positionals;
|
return positionals as BindingPipe[];
|
||||||
}
|
}
|
||||||
|
|
||||||
parseBlockContent(): AST {
|
|
||||||
if (!this.parseAction) {
|
|
||||||
this.error('Binding expression cannot contain chained expression');
|
|
||||||
}
|
|
||||||
var exprs: any[] /** TODO #9100 */ = [];
|
|
||||||
while (this.index < this.tokens.length && !this.next.isCharacter($RBRACE)) {
|
|
||||||
var expr = this.parseExpression();
|
|
||||||
exprs.push(expr);
|
|
||||||
|
|
||||||
if (this.optionalCharacter($SEMICOLON)) {
|
|
||||||
while (this.optionalCharacter($SEMICOLON)) {
|
|
||||||
} // read all semicolons
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (exprs.length == 0) return new EmptyExpr();
|
|
||||||
if (exprs.length == 1) return exprs[0];
|
|
||||||
|
|
||||||
return new Chain(exprs);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An identifier, a keyword, a string with an optional `-` inbetween.
|
* An identifier, a keyword, a string with an optional `-` inbetween.
|
||||||
*/
|
*/
|
||||||
|
@ -579,7 +558,7 @@ export class _ParseAST {
|
||||||
|
|
||||||
parseTemplateBindings(): TemplateBindingParseResult {
|
parseTemplateBindings(): TemplateBindingParseResult {
|
||||||
var bindings: TemplateBinding[] = [];
|
var bindings: TemplateBinding[] = [];
|
||||||
var prefix: any /** TODO #9100 */ = null;
|
var prefix: string = null;
|
||||||
var warnings: string[] = [];
|
var warnings: string[] = [];
|
||||||
while (this.index < this.tokens.length) {
|
while (this.index < this.tokens.length) {
|
||||||
var keyIsVar: boolean = this.peekKeywordLet();
|
var keyIsVar: boolean = this.peekKeywordLet();
|
||||||
|
@ -603,8 +582,8 @@ export class _ParseAST {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.optionalCharacter($COLON);
|
this.optionalCharacter($COLON);
|
||||||
var name: any /** TODO #9100 */ = null;
|
var name: string = null;
|
||||||
var expression: any /** TODO #9100 */ = null;
|
var expression: ASTWithSource = null;
|
||||||
if (keyIsVar) {
|
if (keyIsVar) {
|
||||||
if (this.optionalOperator('=')) {
|
if (this.optionalOperator('=')) {
|
||||||
name = this.expectTemplateBindingKey();
|
name = this.expectTemplateBindingKey();
|
||||||
|
|
|
@ -59,7 +59,7 @@ export interface HtmlAstVisitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function htmlVisitAll(visitor: HtmlAstVisitor, asts: HtmlAst[], context: any = null): any[] {
|
export function htmlVisitAll(visitor: HtmlAstVisitor, asts: HtmlAst[], context: any = null): any[] {
|
||||||
var result: any[] /** TODO #9100 */ = [];
|
var result: any[] = [];
|
||||||
asts.forEach(ast => {
|
asts.forEach(ast => {
|
||||||
var astResult = ast.visit(visitor, context);
|
var astResult = ast.visit(visitor, context);
|
||||||
if (isPresent(astResult)) {
|
if (isPresent(astResult)) {
|
||||||
|
|
|
@ -362,7 +362,7 @@ class _HtmlTokenizer {
|
||||||
}
|
}
|
||||||
this._advance();
|
this._advance();
|
||||||
let name = this._input.substring(start.offset + 1, this._index - 1);
|
let name = this._input.substring(start.offset + 1, this._index - 1);
|
||||||
let char = (NAMED_ENTITIES as any /** TODO #9100 */)[name];
|
let char = (NAMED_ENTITIES as any)[name];
|
||||||
if (isBlank(char)) {
|
if (isBlank(char)) {
|
||||||
throw this._createError(unknownEntityErrorMsg(name), this._getSpan(start));
|
throw this._createError(unknownEntityErrorMsg(name), this._getSpan(start));
|
||||||
}
|
}
|
||||||
|
@ -372,11 +372,11 @@ class _HtmlTokenizer {
|
||||||
|
|
||||||
private _consumeRawText(
|
private _consumeRawText(
|
||||||
decodeEntities: boolean, firstCharOfEnd: number, attemptEndRest: Function): HtmlToken {
|
decodeEntities: boolean, firstCharOfEnd: number, attemptEndRest: Function): HtmlToken {
|
||||||
var tagCloseStart: any /** TODO #9100 */;
|
var tagCloseStart: ParseLocation;
|
||||||
var textStart = this._getLocation();
|
var textStart = this._getLocation();
|
||||||
this._beginToken(
|
this._beginToken(
|
||||||
decodeEntities ? HtmlTokenType.ESCAPABLE_RAW_TEXT : HtmlTokenType.RAW_TEXT, textStart);
|
decodeEntities ? HtmlTokenType.ESCAPABLE_RAW_TEXT : HtmlTokenType.RAW_TEXT, textStart);
|
||||||
var parts: any[] /** TODO #9100 */ = [];
|
var parts: string[] = [];
|
||||||
while (true) {
|
while (true) {
|
||||||
tagCloseStart = this._getLocation();
|
tagCloseStart = this._getLocation();
|
||||||
if (this._attemptCharCode(firstCharOfEnd) && attemptEndRest()) {
|
if (this._attemptCharCode(firstCharOfEnd) && attemptEndRest()) {
|
||||||
|
@ -419,11 +419,11 @@ class _HtmlTokenizer {
|
||||||
|
|
||||||
private _consumePrefixAndName(): string[] {
|
private _consumePrefixAndName(): string[] {
|
||||||
var nameOrPrefixStart = this._index;
|
var nameOrPrefixStart = this._index;
|
||||||
var prefix: any /** TODO #9100 */ = null;
|
var prefix: string = null;
|
||||||
while (this._peek !== $COLON && !isPrefixEnd(this._peek)) {
|
while (this._peek !== $COLON && !isPrefixEnd(this._peek)) {
|
||||||
this._advance();
|
this._advance();
|
||||||
}
|
}
|
||||||
var nameStart: any /** TODO #9100 */;
|
var nameStart: number;
|
||||||
if (this._peek === $COLON) {
|
if (this._peek === $COLON) {
|
||||||
this._advance();
|
this._advance();
|
||||||
prefix = this._input.substring(nameOrPrefixStart, this._index - 1);
|
prefix = this._input.substring(nameOrPrefixStart, this._index - 1);
|
||||||
|
@ -438,7 +438,7 @@ class _HtmlTokenizer {
|
||||||
|
|
||||||
private _consumeTagOpen(start: ParseLocation) {
|
private _consumeTagOpen(start: ParseLocation) {
|
||||||
let savedPos = this._savePosition();
|
let savedPos = this._savePosition();
|
||||||
let lowercaseTagName: any /** TODO #9100 */;
|
let lowercaseTagName: string;
|
||||||
try {
|
try {
|
||||||
if (!isAsciiLetter(this._peek)) {
|
if (!isAsciiLetter(this._peek)) {
|
||||||
throw this._createError(unexpectedCharacterErrorMsg(this._peek), this._getSpan());
|
throw this._createError(unexpectedCharacterErrorMsg(this._peek), this._getSpan());
|
||||||
|
@ -505,11 +505,11 @@ class _HtmlTokenizer {
|
||||||
|
|
||||||
private _consumeAttributeValue() {
|
private _consumeAttributeValue() {
|
||||||
this._beginToken(HtmlTokenType.ATTR_VALUE);
|
this._beginToken(HtmlTokenType.ATTR_VALUE);
|
||||||
var value: any /** TODO #9100 */;
|
var value: string;
|
||||||
if (this._peek === $SQ || this._peek === $DQ) {
|
if (this._peek === $SQ || this._peek === $DQ) {
|
||||||
var quoteChar = this._peek;
|
var quoteChar = this._peek;
|
||||||
this._advance();
|
this._advance();
|
||||||
var parts: any[] /** TODO #9100 */ = [];
|
var parts: string[] = [];
|
||||||
while (this._peek !== quoteChar) {
|
while (this._peek !== quoteChar) {
|
||||||
parts.push(this._readChar(true));
|
parts.push(this._readChar(true));
|
||||||
}
|
}
|
||||||
|
@ -534,8 +534,7 @@ class _HtmlTokenizer {
|
||||||
private _consumeTagClose(start: ParseLocation) {
|
private _consumeTagClose(start: ParseLocation) {
|
||||||
this._beginToken(HtmlTokenType.TAG_CLOSE, start);
|
this._beginToken(HtmlTokenType.TAG_CLOSE, start);
|
||||||
this._attemptCharCodeUntilFn(isNotWhitespace);
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
||||||
var prefixAndName: any /** TODO #9100 */;
|
let prefixAndName = this._consumePrefixAndName();
|
||||||
prefixAndName = this._consumePrefixAndName();
|
|
||||||
this._attemptCharCodeUntilFn(isNotWhitespace);
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
||||||
this._requireCharCode($GT);
|
this._requireCharCode($GT);
|
||||||
this._endToken(prefixAndName);
|
this._endToken(prefixAndName);
|
||||||
|
@ -596,7 +595,7 @@ class _HtmlTokenizer {
|
||||||
var start = this._getLocation();
|
var start = this._getLocation();
|
||||||
this._beginToken(HtmlTokenType.TEXT, start);
|
this._beginToken(HtmlTokenType.TEXT, start);
|
||||||
|
|
||||||
var parts: any[] /** TODO #9100 */ = [];
|
var parts: string[] = [];
|
||||||
let interpolation = false;
|
let interpolation = false;
|
||||||
|
|
||||||
if (this._peek === $LBRACE && this._nextPeek === $LBRACE) {
|
if (this._peek === $LBRACE && this._nextPeek === $LBRACE) {
|
||||||
|
@ -719,7 +718,7 @@ function toUpperCaseCharCode(code: number): number {
|
||||||
}
|
}
|
||||||
|
|
||||||
function mergeTextTokens(srcTokens: HtmlToken[]): HtmlToken[] {
|
function mergeTextTokens(srcTokens: HtmlToken[]): HtmlToken[] {
|
||||||
let dstTokens: any[] /** TODO #9100 */ = [];
|
let dstTokens: HtmlToken[] = [];
|
||||||
let lastDstToken: HtmlToken;
|
let lastDstToken: HtmlToken;
|
||||||
for (let i = 0; i < srcTokens.length; i++) {
|
for (let i = 0; i < srcTokens.length; i++) {
|
||||||
let token = srcTokens[i];
|
let token = srcTokens[i];
|
||||||
|
|
|
@ -160,7 +160,7 @@ class TreeBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
private _collectExpansionExpTokens(start: HtmlToken): HtmlToken[] {
|
private _collectExpansionExpTokens(start: HtmlToken): HtmlToken[] {
|
||||||
let exp: any[] /** TODO #9100 */ = [];
|
let exp: HtmlToken[] = [];
|
||||||
let expansionFormStack = [HtmlTokenType.EXPANSION_CASE_EXP_START];
|
let expansionFormStack = [HtmlTokenType.EXPANSION_CASE_EXP_START];
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@ -229,7 +229,7 @@ class TreeBuilder {
|
||||||
private _consumeStartTag(startTagToken: HtmlToken) {
|
private _consumeStartTag(startTagToken: HtmlToken) {
|
||||||
var prefix = startTagToken.parts[0];
|
var prefix = startTagToken.parts[0];
|
||||||
var name = startTagToken.parts[1];
|
var name = startTagToken.parts[1];
|
||||||
var attrs: any[] /** TODO #9100 */ = [];
|
var attrs: HtmlAttrAst[] = [];
|
||||||
while (this.peek.type === HtmlTokenType.ATTR_NAME) {
|
while (this.peek.type === HtmlTokenType.ATTR_NAME) {
|
||||||
attrs.push(this._consumeAttr(this._advance()));
|
attrs.push(this._consumeAttr(this._advance()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {HtmlParseTreeResult, HtmlParser} from '../html_parser';
|
||||||
import {ParseError, ParseSourceSpan} from '../parse_util';
|
import {ParseError, ParseSourceSpan} from '../parse_util';
|
||||||
|
|
||||||
import {expandNodes} from './expander';
|
import {expandNodes} from './expander';
|
||||||
import {id} from './message';
|
import {Message, id} from './message';
|
||||||
import {I18N_ATTR, I18N_ATTR_PREFIX, I18nError, Part, dedupePhName, getPhNameFromBinding, messageFromAttribute, messageFromI18nAttribute, partition} from './shared';
|
import {I18N_ATTR, I18N_ATTR_PREFIX, I18nError, Part, dedupePhName, getPhNameFromBinding, messageFromAttribute, messageFromI18nAttribute, partition} from './shared';
|
||||||
|
|
||||||
const _PLACEHOLDER_ELEMENT = 'ph';
|
const _PLACEHOLDER_ELEMENT = 'ph';
|
||||||
|
@ -260,14 +260,14 @@ export class I18nHtmlParser implements HtmlParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
private _i18nAttributes(el: HtmlElementAst): HtmlAttrAst[] {
|
private _i18nAttributes(el: HtmlElementAst): HtmlAttrAst[] {
|
||||||
let res: any[] /** TODO #9100 */ = [];
|
let res: HtmlAttrAst[] = [];
|
||||||
let implicitAttrs: string[] =
|
let implicitAttrs: string[] =
|
||||||
isPresent(this._implicitAttrs[el.name]) ? this._implicitAttrs[el.name] : [];
|
isPresent(this._implicitAttrs[el.name]) ? this._implicitAttrs[el.name] : [];
|
||||||
|
|
||||||
el.attrs.forEach(attr => {
|
el.attrs.forEach(attr => {
|
||||||
if (attr.name.startsWith(I18N_ATTR_PREFIX) || attr.name == I18N_ATTR) return;
|
if (attr.name.startsWith(I18N_ATTR_PREFIX) || attr.name == I18N_ATTR) return;
|
||||||
|
|
||||||
let message: any /** TODO #9100 */;
|
let message: Message;
|
||||||
|
|
||||||
let i18ns = el.attrs.filter(a => a.name == `${I18N_ATTR_PREFIX}${attr.name}`);
|
let i18ns = el.attrs.filter(a => a.name == `${I18N_ATTR_PREFIX}${attr.name}`);
|
||||||
|
|
||||||
|
@ -314,8 +314,7 @@ export class I18nHtmlParser implements HtmlParser {
|
||||||
private _replacePlaceholdersWithExpressions(
|
private _replacePlaceholdersWithExpressions(
|
||||||
message: string, exps: string[], sourceSpan: ParseSourceSpan): string {
|
message: string, exps: string[], sourceSpan: ParseSourceSpan): string {
|
||||||
let expMap = this._buildExprMap(exps);
|
let expMap = this._buildExprMap(exps);
|
||||||
return RegExpWrapper.replaceAll(
|
return RegExpWrapper.replaceAll(_PLACEHOLDER_EXPANDED_REGEXP, message, (match: string[]) => {
|
||||||
_PLACEHOLDER_EXPANDED_REGEXP, message, (match: any /** TODO #9100 */) => {
|
|
||||||
let nameWithQuotes = match[2];
|
let nameWithQuotes = match[2];
|
||||||
let name = nameWithQuotes.substring(1, nameWithQuotes.length - 1);
|
let name = nameWithQuotes.substring(1, nameWithQuotes.length - 1);
|
||||||
return this._convertIntoExpression(name, expMap, sourceSpan);
|
return this._convertIntoExpression(name, expMap, sourceSpan);
|
||||||
|
|
|
@ -19,11 +19,11 @@ export class I18nError extends ParseError {
|
||||||
|
|
||||||
// Man, this is so ugly!
|
// Man, this is so ugly!
|
||||||
export function partition(nodes: HtmlAst[], errors: ParseError[], implicitTags: string[]): Part[] {
|
export function partition(nodes: HtmlAst[], errors: ParseError[], implicitTags: string[]): Part[] {
|
||||||
let res: any[] /** TODO #9100 */ = [];
|
let res: Part[] = [];
|
||||||
|
|
||||||
for (let i = 0; i < nodes.length; ++i) {
|
for (let i = 0; i < nodes.length; ++i) {
|
||||||
let n = nodes[i];
|
let n = nodes[i];
|
||||||
let temp: any[] /** TODO #9100 */ = [];
|
let temp: HtmlAst[] = [];
|
||||||
if (_isOpeningComment(n)) {
|
if (_isOpeningComment(n)) {
|
||||||
let i18n = (<HtmlCommentAst>n).value.substring(5).trim();
|
let i18n = (<HtmlCommentAst>n).value.substring(5).trim();
|
||||||
i++;
|
i++;
|
||||||
|
|
|
@ -40,7 +40,7 @@ export function deserializeXmb(content: string, url: string): XmbDeserialization
|
||||||
}
|
}
|
||||||
|
|
||||||
let bundleEl = <HtmlElementAst>parsed.rootNodes[0]; // test this
|
let bundleEl = <HtmlElementAst>parsed.rootNodes[0]; // test this
|
||||||
let errors: any[] /** TODO #9100 */ = [];
|
let errors: ParseError[] = [];
|
||||||
let messages: {[key: string]: HtmlAst[]} = {};
|
let messages: {[key: string]: HtmlAst[]} = {};
|
||||||
|
|
||||||
_createMessages(bundleEl.children, messages, errors);
|
_createMessages(bundleEl.children, messages, errors);
|
||||||
|
@ -90,7 +90,7 @@ function _serializeMessage(m: Message): string {
|
||||||
}
|
}
|
||||||
|
|
||||||
function _expandPlaceholder(input: string): string {
|
function _expandPlaceholder(input: string): string {
|
||||||
return RegExpWrapper.replaceAll(_PLACEHOLDER_REGEXP, input, (match: any /** TODO #9100 */) => {
|
return RegExpWrapper.replaceAll(_PLACEHOLDER_REGEXP, input, (match: string[]) => {
|
||||||
let nameWithQuotes = match[2];
|
let nameWithQuotes = match[2];
|
||||||
return `<ph name=${nameWithQuotes}></ph>`;
|
return `<ph name=${nameWithQuotes}></ph>`;
|
||||||
});
|
});
|
||||||
|
|
|
@ -96,7 +96,7 @@ export class CompileMetadataResolver {
|
||||||
var meta = this._directiveCache.get(directiveType);
|
var meta = this._directiveCache.get(directiveType);
|
||||||
if (isBlank(meta)) {
|
if (isBlank(meta)) {
|
||||||
var dirMeta = this._directiveResolver.resolve(directiveType);
|
var dirMeta = this._directiveResolver.resolve(directiveType);
|
||||||
var templateMeta: any /** TODO #9100 */ = null;
|
var templateMeta: cpl.CompileTemplateMetadata = null;
|
||||||
var changeDetectionStrategy: any /** TODO #9100 */ = null;
|
var changeDetectionStrategy: any /** TODO #9100 */ = null;
|
||||||
var viewProviders: any[] /** TODO #9100 */ = [];
|
var viewProviders: any[] /** TODO #9100 */ = [];
|
||||||
var moduleUrl = staticTypeModuleUrl(directiveType);
|
var moduleUrl = staticTypeModuleUrl(directiveType);
|
||||||
|
|
|
@ -47,8 +47,8 @@ export class OfflineCompiler {
|
||||||
if (components.length === 0) {
|
if (components.length === 0) {
|
||||||
throw new BaseException('No components given');
|
throw new BaseException('No components given');
|
||||||
}
|
}
|
||||||
var statements: any[] /** TODO #9100 */ = [];
|
var statements: o.DeclareVarStmt[] = [];
|
||||||
var exportedVars: any[] /** TODO #9100 */ = [];
|
var exportedVars: string[] = [];
|
||||||
var moduleUrl = _templateModuleUrl(components[0].component);
|
var moduleUrl = _templateModuleUrl(components[0].component);
|
||||||
components.forEach(componentWithDirs => {
|
components.forEach(componentWithDirs => {
|
||||||
var compMeta = <CompileDirectiveMetadata>componentWithDirs.component;
|
var compMeta = <CompileDirectiveMetadata>componentWithDirs.component;
|
||||||
|
@ -81,7 +81,7 @@ export class OfflineCompiler {
|
||||||
Promise<StyleSheetSourceWithImports> {
|
Promise<StyleSheetSourceWithImports> {
|
||||||
return this._xhr.get(stylesheetUrl).then((cssText) => {
|
return this._xhr.get(stylesheetUrl).then((cssText) => {
|
||||||
var compileResult = this._styleCompiler.compileStylesheet(stylesheetUrl, cssText, shim);
|
var compileResult = this._styleCompiler.compileStylesheet(stylesheetUrl, cssText, shim);
|
||||||
var importedUrls: any[] /** TODO #9100 */ = [];
|
var importedUrls: string[] = [];
|
||||||
compileResult.dependencies.forEach((dep) => {
|
compileResult.dependencies.forEach((dep) => {
|
||||||
importedUrls.push(dep.moduleUrl);
|
importedUrls.push(dep.moduleUrl);
|
||||||
dep.valuePlaceholder.moduleUrl = _stylesModuleUrl(dep.moduleUrl, dep.isShimmed, suffix);
|
dep.valuePlaceholder.moduleUrl = _stylesModuleUrl(dep.moduleUrl, dep.isShimmed, suffix);
|
||||||
|
|
|
@ -149,7 +149,7 @@ export class ProviderElementContext {
|
||||||
var transformedProviders = resolvedProvider.providers.map((provider) => {
|
var transformedProviders = resolvedProvider.providers.map((provider) => {
|
||||||
var transformedUseValue = provider.useValue;
|
var transformedUseValue = provider.useValue;
|
||||||
var transformedUseExisting = provider.useExisting;
|
var transformedUseExisting = provider.useExisting;
|
||||||
var transformedDeps: any /** TODO #9100 */;
|
var transformedDeps: CompileDiDependencyMetadata[];
|
||||||
if (isPresent(provider.useExisting)) {
|
if (isPresent(provider.useExisting)) {
|
||||||
var existingDiDep = this._getDependency(
|
var existingDiDep = this._getDependency(
|
||||||
resolvedProvider.providerType,
|
resolvedProvider.providerType,
|
||||||
|
|
|
@ -89,7 +89,7 @@ export class RuntimeCompiler implements ComponentResolver {
|
||||||
compMeta, compMeta.template.template, normalizedViewDirMetas, pipes,
|
compMeta, compMeta.template.template, normalizedViewDirMetas, pipes,
|
||||||
compMeta.type.name);
|
compMeta.type.name);
|
||||||
|
|
||||||
var childPromises: any[] /** TODO #9100 */ = [];
|
var childPromises: Promise<any>[] = [];
|
||||||
compiledTemplate.init(this._compileComponent(
|
compiledTemplate.init(this._compileComponent(
|
||||||
compMeta, parsedTemplate, styles, pipes, compilingComponentsPath,
|
compMeta, parsedTemplate, styles, pipes, compilingComponentsPath,
|
||||||
childPromises));
|
childPromises));
|
||||||
|
@ -128,7 +128,7 @@ export class RuntimeCompiler implements ComponentResolver {
|
||||||
childPromises.push(this._compiledTemplateDone.get(childCacheKey));
|
childPromises.push(this._compiledTemplateDone.get(childCacheKey));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var factory: any /** TODO #9100 */;
|
var factory: any;
|
||||||
if (IS_DART || !this._genConfig.useJit) {
|
if (IS_DART || !this._genConfig.useJit) {
|
||||||
factory = interpretStatements(
|
factory = interpretStatements(
|
||||||
compileResult.statements, compileResult.viewFactoryVar,
|
compileResult.statements, compileResult.viewFactoryVar,
|
||||||
|
@ -151,7 +151,7 @@ export class RuntimeCompiler implements ComponentResolver {
|
||||||
var promises = result.dependencies.map((dep) => this._loadStylesheetDep(dep));
|
var promises = result.dependencies.map((dep) => this._loadStylesheetDep(dep));
|
||||||
return PromiseWrapper.all(promises)
|
return PromiseWrapper.all(promises)
|
||||||
.then((cssTexts) => {
|
.then((cssTexts) => {
|
||||||
var nestedCompileResultPromises: any[] /** TODO #9100 */ = [];
|
var nestedCompileResultPromises: Promise<string[]>[] = [];
|
||||||
for (var i = 0; i < result.dependencies.length; i++) {
|
for (var i = 0; i < result.dependencies.length; i++) {
|
||||||
var dep = result.dependencies[i];
|
var dep = result.dependencies[i];
|
||||||
var cssText = cssTexts[i];
|
var cssText = cssTexts[i];
|
||||||
|
|
|
@ -27,7 +27,7 @@ export class CssSelector {
|
||||||
|
|
||||||
static parse(selector: string): CssSelector[] {
|
static parse(selector: string): CssSelector[] {
|
||||||
var results: CssSelector[] = [];
|
var results: CssSelector[] = [];
|
||||||
var _addResult = (res: CssSelector[], cssSel: any /** TODO #9100 */) => {
|
var _addResult = (res: CssSelector[], cssSel: CssSelector) => {
|
||||||
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 = '*';
|
||||||
|
@ -36,7 +36,7 @@ export class CssSelector {
|
||||||
};
|
};
|
||||||
var cssSelector = new CssSelector();
|
var cssSelector = new CssSelector();
|
||||||
var matcher = RegExpWrapper.matcher(_SELECTOR_REGEXP, selector);
|
var matcher = RegExpWrapper.matcher(_SELECTOR_REGEXP, selector);
|
||||||
var match: any /** TODO #9100 */;
|
var match: string[];
|
||||||
var current = cssSelector;
|
var current = cssSelector;
|
||||||
var inNot = false;
|
var inNot = false;
|
||||||
while (isPresent(match = RegExpMatcherWrapper.next(matcher))) {
|
while (isPresent(match = RegExpMatcherWrapper.next(matcher))) {
|
||||||
|
@ -153,7 +153,7 @@ export class SelectorMatcher {
|
||||||
private _listContexts: SelectorListContext[] = [];
|
private _listContexts: SelectorListContext[] = [];
|
||||||
|
|
||||||
addSelectables(cssSelectors: CssSelector[], callbackCtxt?: any) {
|
addSelectables(cssSelectors: CssSelector[], callbackCtxt?: any) {
|
||||||
var listContext: any /** TODO #9100 */ = null;
|
var listContext: SelectorListContext = null;
|
||||||
if (cssSelectors.length > 1) {
|
if (cssSelectors.length > 1) {
|
||||||
listContext = new SelectorListContext(cssSelectors);
|
listContext = new SelectorListContext(cssSelectors);
|
||||||
this._listContexts.push(listContext);
|
this._listContexts.push(listContext);
|
||||||
|
@ -303,7 +303,7 @@ export class SelectorMatcher {
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
_matchTerminal(
|
_matchTerminal(
|
||||||
map: Map<string, SelectorContext[]>, name: any /** TODO #9100 */, cssSelector: CssSelector,
|
map: Map<string, SelectorContext[]>, name: string, cssSelector: CssSelector,
|
||||||
matchedCallback: (c: CssSelector, a: any) => void): boolean {
|
matchedCallback: (c: CssSelector, a: any) => void): boolean {
|
||||||
if (isBlank(map) || isBlank(name)) {
|
if (isBlank(map) || isBlank(name)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -317,7 +317,7 @@ export class SelectorMatcher {
|
||||||
if (isBlank(selectables)) {
|
if (isBlank(selectables)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var selectable: any /** TODO #9100 */;
|
var selectable: SelectorContext;
|
||||||
var result = false;
|
var result = false;
|
||||||
for (var index = 0; index < selectables.length; index++) {
|
for (var index = 0; index < selectables.length; index++) {
|
||||||
selectable = selectables[index];
|
selectable = selectables[index];
|
||||||
|
@ -328,8 +328,8 @@ export class SelectorMatcher {
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
_matchPartial(
|
_matchPartial(
|
||||||
map: Map<string, SelectorMatcher>, name: any /** TODO #9100 */, cssSelector: CssSelector,
|
map: Map<string, SelectorMatcher>, name: string, cssSelector: CssSelector,
|
||||||
matchedCallback: any /** TODO #9100 */ /*: (c: CssSelector, a: any) => void*/): boolean {
|
matchedCallback: (c: CssSelector, a: any) => void): boolean {
|
||||||
if (isBlank(map) || isBlank(name)) {
|
if (isBlank(map) || isBlank(name)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ export class StyleCompiler {
|
||||||
shim: boolean): StylesCompileResult {
|
shim: boolean): StylesCompileResult {
|
||||||
var styleExpressions =
|
var styleExpressions =
|
||||||
plainStyles.map(plainStyle => o.literal(this._shimIfNeeded(plainStyle, shim)));
|
plainStyles.map(plainStyle => o.literal(this._shimIfNeeded(plainStyle, shim)));
|
||||||
var dependencies: any[] /** TODO #9100 */ = [];
|
var dependencies: StylesCompileDependency[] = [];
|
||||||
for (var i = 0; i < absUrls.length; i++) {
|
for (var i = 0; i < absUrls.length; i++) {
|
||||||
var identifier = new CompileIdentifierMetadata({name: getStylesVarName(null)});
|
var identifier = new CompileIdentifierMetadata({name: getStylesVarName(null)});
|
||||||
dependencies.push(new StylesCompileDependency(absUrls[i], shim, identifier));
|
dependencies.push(new StylesCompileDependency(absUrls[i], shim, identifier));
|
||||||
|
|
|
@ -21,9 +21,8 @@ export function isStyleUrlResolvable(url: string): boolean {
|
||||||
*/
|
*/
|
||||||
export function extractStyleUrls(
|
export function extractStyleUrls(
|
||||||
resolver: UrlResolver, baseUrl: string, cssText: string): StyleWithImports {
|
resolver: UrlResolver, baseUrl: string, cssText: string): StyleWithImports {
|
||||||
var foundUrls: any[] /** TODO #9100 */ = [];
|
var foundUrls: string[] = [];
|
||||||
var modifiedCssText =
|
var modifiedCssText = StringWrapper.replaceAllMapped(cssText, _cssImportRe, (m: string[]) => {
|
||||||
StringWrapper.replaceAllMapped(cssText, _cssImportRe, (m: any /** TODO #9100 */) => {
|
|
||||||
var url = isPresent(m[1]) ? m[1] : m[2];
|
var url = isPresent(m[1]) ? m[1] : m[2];
|
||||||
if (!isStyleUrlResolvable(url)) {
|
if (!isStyleUrlResolvable(url)) {
|
||||||
// Do not attempt to resolve non-package absolute URLs with URI scheme
|
// Do not attempt to resolve non-package absolute URLs with URI scheme
|
||||||
|
|
|
@ -248,7 +248,7 @@ export interface TemplateAstVisitor {
|
||||||
*/
|
*/
|
||||||
export function templateVisitAll(
|
export function templateVisitAll(
|
||||||
visitor: TemplateAstVisitor, asts: TemplateAst[], context: any = null): any[] {
|
visitor: TemplateAstVisitor, asts: TemplateAst[], context: any = null): any[] {
|
||||||
var result: any[] /** TODO #9100 */ = [];
|
var result: any[] = [];
|
||||||
asts.forEach(ast => {
|
asts.forEach(ast => {
|
||||||
var astResult = ast.visit(visitor, context);
|
var astResult = ast.visit(visitor, context);
|
||||||
if (isPresent(astResult)) {
|
if (isPresent(astResult)) {
|
||||||
|
|
|
@ -15,9 +15,9 @@ const NG_NON_BINDABLE_ATTR = 'ngNonBindable';
|
||||||
const NG_PROJECT_AS = 'ngProjectAs';
|
const NG_PROJECT_AS = 'ngProjectAs';
|
||||||
|
|
||||||
export function preparseElement(ast: HtmlElementAst): PreparsedElement {
|
export function preparseElement(ast: HtmlElementAst): PreparsedElement {
|
||||||
var selectAttr: any /** TODO #9100 */ = null;
|
var selectAttr: string = null;
|
||||||
var hrefAttr: any /** TODO #9100 */ = null;
|
var hrefAttr: string = null;
|
||||||
var relAttr: any /** TODO #9100 */ = null;
|
var relAttr: string = null;
|
||||||
var nonBindable = false;
|
var nonBindable = false;
|
||||||
var projectAs: string = null;
|
var projectAs: string = null;
|
||||||
ast.attrs.forEach(attr => {
|
ast.attrs.forEach(attr => {
|
||||||
|
|
|
@ -101,7 +101,7 @@ export function getUrlScheme(url: string): string {
|
||||||
function _buildFromEncodedParts(
|
function _buildFromEncodedParts(
|
||||||
opt_scheme?: string, opt_userInfo?: string, opt_domain?: string, opt_port?: string,
|
opt_scheme?: string, opt_userInfo?: string, opt_domain?: string, opt_port?: string,
|
||||||
opt_path?: string, opt_queryData?: string, opt_fragment?: string): string {
|
opt_path?: string, opt_queryData?: string, opt_fragment?: string): string {
|
||||||
var out: any[] /** TODO #9100 */ = [];
|
var out: string[] = [];
|
||||||
|
|
||||||
if (isPresent(opt_scheme)) {
|
if (isPresent(opt_scheme)) {
|
||||||
out.push(opt_scheme + ':');
|
out.push(opt_scheme + ':');
|
||||||
|
|
|
@ -8,12 +8,12 @@ var DASH_CASE_REGEXP = /-([a-z])/g;
|
||||||
|
|
||||||
export function camelCaseToDashCase(input: string): string {
|
export function camelCaseToDashCase(input: string): string {
|
||||||
return StringWrapper.replaceAllMapped(
|
return StringWrapper.replaceAllMapped(
|
||||||
input, CAMEL_CASE_REGEXP, (m: any /** TODO #9100 */) => { return '-' + m[1].toLowerCase(); });
|
input, CAMEL_CASE_REGEXP, (m: string[]) => { return '-' + m[1].toLowerCase(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
export function dashCaseToCamelCase(input: string): string {
|
export function dashCaseToCamelCase(input: string): string {
|
||||||
return StringWrapper.replaceAllMapped(
|
return StringWrapper.replaceAllMapped(
|
||||||
input, DASH_CASE_REGEXP, (m: any /** TODO #9100 */) => { return m[1].toUpperCase(); });
|
input, DASH_CASE_REGEXP, (m: string[]) => { return m[1].toUpperCase(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
export function splitAtColon(input: string, defaultValues: string[]): string[] {
|
export function splitAtColon(input: string, defaultValues: string[]): string[] {
|
||||||
|
|
|
@ -157,13 +157,13 @@ export function isArray(obj: any): boolean {
|
||||||
return Array.isArray(obj);
|
return Array.isArray(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isDate(obj: any /** TODO #9100 */): boolean {
|
export function isDate(obj: any): obj is Date {
|
||||||
return obj instanceof Date && !isNaN(obj.valueOf());
|
return obj instanceof Date && !isNaN(obj.valueOf());
|
||||||
}
|
}
|
||||||
|
|
||||||
export function noop() {}
|
export function noop() {}
|
||||||
|
|
||||||
export function stringify(token: any /** TODO #9100 */): string {
|
export function stringify(token: any): string {
|
||||||
if (typeof token === 'string') {
|
if (typeof token === 'string') {
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
@ -187,16 +187,15 @@ export function stringify(token: any /** TODO #9100 */): string {
|
||||||
// serialize / deserialize enum exist only for consistency with dart API
|
// serialize / deserialize enum exist only for consistency with dart API
|
||||||
// enums in typescript don't need to be serialized
|
// enums in typescript don't need to be serialized
|
||||||
|
|
||||||
export function serializeEnum(val: any /** TODO #9100 */): number {
|
export function serializeEnum(val: any): number {
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function deserializeEnum(val: any /** TODO #9100 */, values: Map<number, any>): any {
|
export function deserializeEnum(val: any, values: Map<number, any>): any {
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function resolveEnumToken(
|
export function resolveEnumToken(enumValue: any, val: any): string {
|
||||||
enumValue: any /** TODO #9100 */, val: any /** TODO #9100 */): string {
|
|
||||||
return enumValue[val];
|
return enumValue[val];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,7 +245,7 @@ export class StringWrapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
static replaceAllMapped(s: string, from: RegExp, cb: Function): string {
|
static replaceAllMapped(s: string, from: RegExp, cb: Function): string {
|
||||||
return s.replace(from, function(...matches: any[] /** TODO #9100 */) {
|
return s.replace(from, function(...matches: any[]) {
|
||||||
// Remove offset & string from the result array
|
// Remove offset & string from the result array
|
||||||
matches.splice(-2, 2);
|
matches.splice(-2, 2);
|
||||||
// The callback receives match, p1, ..., pn
|
// The callback receives match, p1, ..., pn
|
||||||
|
@ -268,7 +267,7 @@ export class StringWrapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class StringJoiner {
|
export class StringJoiner {
|
||||||
constructor(public parts: any[] /** TODO #9100 */ = []) {}
|
constructor(public parts: string[] = []) {}
|
||||||
|
|
||||||
add(part: string): void { this.parts.push(part); }
|
add(part: string): void { this.parts.push(part); }
|
||||||
|
|
||||||
|
@ -379,7 +378,7 @@ export class FunctionWrapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
// JS has NaN !== NaN
|
// JS has NaN !== NaN
|
||||||
export function looseIdentical(a: any /** TODO #9100 */, b: any /** TODO #9100 */): boolean {
|
export function looseIdentical(a: any, b: any): boolean {
|
||||||
return a === b || typeof a === 'number' && typeof b === 'number' && isNaN(a) && isNaN(b);
|
return a === b || typeof a === 'number' && typeof b === 'number' && isNaN(a) && isNaN(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,8 +448,8 @@ export function setValueOnPath(global: any, path: string, value: any) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// When Symbol.iterator doesn't exist, retrieves the key used in es6-shim
|
// When Symbol.iterator doesn't exist, retrieves the key used in es6-shim
|
||||||
declare var Symbol: any /** TODO #9100 */;
|
declare var Symbol: any;
|
||||||
var _symbolIterator: any /** TODO #9100 */ = null;
|
var _symbolIterator: any = null;
|
||||||
export function getSymbolIterator(): string|symbol {
|
export function getSymbolIterator(): string|symbol {
|
||||||
if (isBlank(_symbolIterator)) {
|
if (isBlank(_symbolIterator)) {
|
||||||
if (isPresent((<any>globalScope).Symbol) && isPresent(Symbol.iterator)) {
|
if (isPresent((<any>globalScope).Symbol) && isPresent(Symbol.iterator)) {
|
||||||
|
@ -461,7 +460,7 @@ export function getSymbolIterator(): string|symbol {
|
||||||
for (var i = 0; i < keys.length; ++i) {
|
for (var i = 0; i < keys.length; ++i) {
|
||||||
var key = keys[i];
|
var key = keys[i];
|
||||||
if (key !== 'entries' && key !== 'size' &&
|
if (key !== 'entries' && key !== 'size' &&
|
||||||
(Map as any /** TODO #9100 */).prototype[key] === Map.prototype['entries']) {
|
(Map as any).prototype[key] === Map.prototype['entries']) {
|
||||||
_symbolIterator = key;
|
_symbolIterator = key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -473,8 +472,8 @@ export function getSymbolIterator(): string|symbol {
|
||||||
export function evalExpression(
|
export function evalExpression(
|
||||||
sourceUrl: string, expr: string, declarations: string, vars: {[key: string]: any}): any {
|
sourceUrl: string, expr: string, declarations: string, vars: {[key: string]: any}): any {
|
||||||
var fnBody = `${declarations}\nreturn ${expr}\n//# sourceURL=${sourceUrl}`;
|
var fnBody = `${declarations}\nreturn ${expr}\n//# sourceURL=${sourceUrl}`;
|
||||||
var fnArgNames: any[] /** TODO #9100 */ = [];
|
var fnArgNames: string[] = [];
|
||||||
var fnArgValues: any[] /** TODO #9100 */ = [];
|
var fnArgValues: any[] = [];
|
||||||
for (var argName in vars) {
|
for (var argName in vars) {
|
||||||
fnArgNames.push(argName);
|
fnArgNames.push(argName);
|
||||||
fnArgValues.push(vars[argName]);
|
fnArgValues.push(vars[argName]);
|
||||||
|
|
|
@ -15,7 +15,7 @@ export class PromiseCompleter<R> {
|
||||||
export class PromiseWrapper {
|
export class PromiseWrapper {
|
||||||
static resolve<T>(obj: T): Promise<T> { return Promise.resolve(obj); }
|
static resolve<T>(obj: T): Promise<T> { return Promise.resolve(obj); }
|
||||||
|
|
||||||
static reject(obj: any, _: any /** TODO #9100 */): Promise<any> { return Promise.reject(obj); }
|
static reject(obj: any, _: any): Promise<any> { return Promise.reject(obj); }
|
||||||
|
|
||||||
// Note: We can't rename this method into `catch`, as this is not a valid
|
// Note: We can't rename this method into `catch`, as this is not a valid
|
||||||
// method name in Dart.
|
// method name in Dart.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// This file intentionally left blank. It is used to load nothing in some cases.
|
// This file intentionally left blank. It is used to load nothing in some cases.
|
||||||
// Such as parse5/index is redirected here instead of loading into browser.
|
// Such as parse5/index is redirected here instead of loading into browser.
|
||||||
|
|
||||||
export var __empty__: any /** TODO #9100 */;
|
export var __empty__: any;
|
||||||
|
|
Loading…
Reference in New Issue