Skip to content

Commit

Permalink
Update hasDynamicName to take well known symbols into account
Browse files Browse the repository at this point in the history
  • Loading branch information
JsonFreeman committed Feb 7, 2015
1 parent d788624 commit 07f3641
Show file tree
Hide file tree
Showing 19 changed files with 84 additions and 82 deletions.
4 changes: 3 additions & 1 deletion src/compiler/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,9 @@ module ts {
* Symbol.
*/
export function hasDynamicName(declaration: Declaration): boolean {
return declaration.name && declaration.name.kind === SyntaxKind.ComputedPropertyName;
return declaration.name &&
declaration.name.kind === SyntaxKind.ComputedPropertyName &&
!isWellKnownSymbolSyntactically((<ComputedPropertyName>declaration.name).expression);
}

export function isWellKnownSymbolSyntactically(node: Node): boolean {
Expand Down
9 changes: 0 additions & 9 deletions tests/baselines/reference/parserSymbolProperty1.errors.txt

This file was deleted.

9 changes: 9 additions & 0 deletions tests/baselines/reference/parserSymbolProperty1.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty1.ts ===
interface I {
>I : I

[Symbol.iterator]: string;
>Symbol.iterator : Symbol
>Symbol : SymbolConstructor
>iterator : Symbol
}
9 changes: 0 additions & 9 deletions tests/baselines/reference/parserSymbolProperty2.errors.txt

This file was deleted.

9 changes: 9 additions & 0 deletions tests/baselines/reference/parserSymbolProperty2.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty2.ts ===
interface I {
>I : I

[Symbol.unscopables](): string;
>Symbol.unscopables : Symbol
>Symbol : SymbolConstructor
>unscopables : Symbol
}
9 changes: 0 additions & 9 deletions tests/baselines/reference/parserSymbolProperty3.errors.txt

This file was deleted.

9 changes: 9 additions & 0 deletions tests/baselines/reference/parserSymbolProperty3.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty3.ts ===
declare class C {
>C : C

[Symbol.unscopables](): string;
>Symbol.unscopables : Symbol
>Symbol : SymbolConstructor
>unscopables : Symbol
}
9 changes: 0 additions & 9 deletions tests/baselines/reference/parserSymbolProperty4.errors.txt

This file was deleted.

9 changes: 9 additions & 0 deletions tests/baselines/reference/parserSymbolProperty4.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty4.ts ===
declare class C {
>C : C

[Symbol.isRegExp]: string;
>Symbol.isRegExp : Symbol
>Symbol : SymbolConstructor
>isRegExp : Symbol
}
9 changes: 0 additions & 9 deletions tests/baselines/reference/parserSymbolProperty5.errors.txt

This file was deleted.

9 changes: 9 additions & 0 deletions tests/baselines/reference/parserSymbolProperty5.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty5.ts ===
class C {
>C : C

[Symbol.isRegExp]: string;
>Symbol.isRegExp : Symbol
>Symbol : SymbolConstructor
>isRegExp : Symbol
}
9 changes: 0 additions & 9 deletions tests/baselines/reference/parserSymbolProperty6.errors.txt

This file was deleted.

9 changes: 9 additions & 0 deletions tests/baselines/reference/parserSymbolProperty6.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty6.ts ===
class C {
>C : C

[Symbol.toStringTag]: string = "";
>Symbol.toStringTag : Symbol
>Symbol : SymbolConstructor
>toStringTag : Symbol
}
9 changes: 0 additions & 9 deletions tests/baselines/reference/parserSymbolProperty7.errors.txt

This file was deleted.

9 changes: 9 additions & 0 deletions tests/baselines/reference/parserSymbolProperty7.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty7.ts ===
class C {
>C : C

[Symbol.toStringTag](): void { }
>Symbol.toStringTag : Symbol
>Symbol : SymbolConstructor
>toStringTag : Symbol
}
9 changes: 0 additions & 9 deletions tests/baselines/reference/parserSymbolProperty8.errors.txt

This file was deleted.

9 changes: 9 additions & 0 deletions tests/baselines/reference/parserSymbolProperty8.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty8.ts ===
var x: {
>x : {}

[Symbol.toPrimitive](): string
>Symbol.toPrimitive : Symbol
>Symbol : SymbolConstructor
>toPrimitive : Symbol
}
9 changes: 0 additions & 9 deletions tests/baselines/reference/parserSymbolProperty9.errors.txt

This file was deleted.

9 changes: 9 additions & 0 deletions tests/baselines/reference/parserSymbolProperty9.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty9.ts ===
var x: {
>x : {}

[Symbol.toPrimitive]: string
>Symbol.toPrimitive : Symbol
>Symbol : SymbolConstructor
>toPrimitive : Symbol
}

1 comment on commit 07f3641

@yuit
Copy link
Contributor

@yuit yuit commented on 07f3641 Feb 10, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Please sign in to comment.