Replace uses of 'Symbol.isRegExp' with 'Symbol.toPrimitive'.

This commit is contained in:
Daniel Rosenwasser 2015-04-09 14:06:57 -07:00
parent f75c9a6624
commit 33028d5199
15 changed files with 24 additions and 24 deletions

10
src/lib/es6.d.ts vendored
View File

@ -52,19 +52,19 @@ interface SymbolConstructor {
/**
* A method that returns the default iterator for an object.Called by the semantics of the
* for-of statement.
* for-of statement.
*/
iterator: symbol;
/**
* A method that converts an object to a corresponding primitive value.Called by the ToPrimitive
* abstract operation.
* abstract operation.
*/
toPrimitive: symbol;
/**
* A String value that is used in the creation of the default string description of an object.
* Called by the built- in method Object.prototype.toString.
* A String value that is used in the creation of the default string description of an object.
* Called by the built-in method Object.prototype.toString.
*/
toStringTag: symbol;
@ -106,7 +106,7 @@ interface ObjectConstructor {
getOwnPropertySymbols(o: any): symbol[];
/**
* Returns true if the values are the same value, false otherwise.
* Returns true if the values are the same value, false otherwise.
* @param value1 The first value.
* @param value2 The second value.
*/

View File

@ -1,5 +1,5 @@
//@target: ES6
//@declaration: true
class C {
[Symbol.isRegExp]: number;
[Symbol.toPrimitive]: number;
}

View File

@ -3,6 +3,6 @@
class C {
static [Symbol.iterator] = 0;
static [Symbol.toPrimitive]() { }
static get [Symbol.isRegExp]() { return ""; }
static set [Symbol.isRegExp](x) { }
static get [Symbol.toPrimitive]() { return ""; }
static set [Symbol.toPrimitive](x) { }
}

View File

@ -8,7 +8,7 @@ module M {
[Symbol.isConcatSpreadable](): I {
return undefined
}
get [Symbol.isRegExp]() { return undefined; }
set [Symbol.isRegExp](x: I) { }
get [Symbol.toPrimitive]() { return undefined; }
set [Symbol.toPrimitive](x: I) { }
}
}

View File

@ -1,6 +1,6 @@
//@target: ES6
//@declaration: true
class C {
get [Symbol.isRegExp]() { return ""; }
get [Symbol.toPrimitive]() { return ""; }
set [Symbol.toStringTag](x) { }
}

View File

@ -1,6 +1,6 @@
//@target: ES6
//@declaration: true
class C {
get [Symbol.isRegExp]() { return ""; }
get [Symbol.toPrimitive]() { return ""; }
get [Symbol.toStringTag]() { return ""; }
}

View File

@ -1,5 +1,5 @@
//@target: ES6
//@declaration: true
class C {
[Symbol.isRegExp] = "";
[Symbol.toPrimitive] = "";
}

View File

@ -1,7 +1,7 @@
//@target: ES6
//@declaration: true
class C {
[Symbol.isRegExp](x: number);
[Symbol.isRegExp](x: string);
[Symbol.isRegExp](x: any) { }
[Symbol.toPrimitive](x: number);
[Symbol.toPrimitive](x: string);
[Symbol.toPrimitive](x: any) { }
}

View File

@ -1,6 +1,6 @@
//@target: ES6
//@declaration: true
class C {
get [Symbol.isRegExp]() { return ""; }
set [Symbol.isRegExp](x) { }
get [Symbol.toPrimitive]() { return ""; }
set [Symbol.toPrimitive](x) { }
}

View File

@ -8,6 +8,6 @@ declare function foo<T, U>(p: I<T, U>): { t: T; u: U };
foo({
[Symbol.isConcatSpreadable]: "",
[Symbol.isRegExp]: 0,
[Symbol.toPrimitive]: 0,
[Symbol.unscopables]: true
});

View File

@ -1,7 +1,7 @@
//@target: ES6
var x = {
[Symbol.iterator]: 0,
[Symbol.isRegExp]() { },
[Symbol.toPrimitive]() { },
get [Symbol.toStringTag]() {
return 0;
}

View File

@ -2,7 +2,7 @@
class C {
[Symbol.iterator] = 0;
[Symbol.unscopables]: number;
[Symbol.isRegExp]() { }
[Symbol.toPrimitive]() { }
get [Symbol.toStringTag]() {
return 0;
}

View File

@ -1,5 +1,5 @@
//@target: ES6
interface I {
[Symbol.unscopables]: number;
[Symbol.isRegExp]();
[Symbol.toPrimitive]();
}

View File

@ -1,4 +1,4 @@
//@target: ES6
declare class C {
[Symbol.isRegExp]: string;
[Symbol.toPrimitive]: string;
}

View File

@ -1,4 +1,4 @@
//@target: ES6
class C {
[Symbol.isRegExp]: string;
[Symbol.toPrimitive]: string;
}