-
Notifications
You must be signed in to change notification settings - Fork 688
Implement @@toStringTag well-known symbol related features #2739
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
LaszloLango
merged 1 commit into
jerryscript-project:master
from
rerobika:symbol_to_string_tag
Feb 1, 2019
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| // Copyright JS Foundation and other contributors, http://js.foundation | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| /* Symbol prototype @@toStringTag */ | ||
| assert (Symbol.prototype[Symbol.toStringTag] === "Symbol"); | ||
| assert (Object.prototype.toString.call (Symbol ()) === "[object Symbol]"); | ||
|
|
||
| assert (delete Symbol.prototype[Symbol.toStringTag]); | ||
| assert (Symbol.prototype[Symbol.toStringTag] === undefined); | ||
| Symbol.prototype[Symbol.toStringTag] = "myStringTag1"; | ||
| assert (Object.prototype.toString.call (Symbol ()) === "[object myStringTag1]"); | ||
| Symbol.prototype[Symbol.toStringTag] = {}; | ||
| assert (Object.prototype.toString.call (Symbol ()) === "[object Symbol]"); | ||
|
|
||
| /* Math @@toStringTag */ | ||
| assert (Math[Symbol.toStringTag] === "Math"); | ||
| assert (Object.prototype.toString.call (Math) === "[object Math]"); | ||
|
|
||
| assert (delete Math[Symbol.toStringTag]); | ||
| assert (Math[Symbol.toStringTag] === undefined); | ||
| Math[Symbol.toStringTag] = "myStringTag2"; | ||
| assert (Object.prototype.toString.call (Math) === "[object myStringTag2]"); | ||
| Math[Symbol.toStringTag] = {}; | ||
| assert (Object.prototype.toString.call (Math) === "[object Math]"); | ||
|
|
||
| /* ArrayBuffer.prototype @@toStringTag */ | ||
| assert (ArrayBuffer.prototype[Symbol.toStringTag] === "ArrayBuffer"); | ||
| assert (Object.prototype.toString.call (new ArrayBuffer ()) === "[object ArrayBuffer]"); | ||
|
|
||
| assert (delete ArrayBuffer.prototype[Symbol.toStringTag]); | ||
| assert (ArrayBuffer.prototype[Symbol.toStringTag] === undefined); | ||
| ArrayBuffer.prototype[Symbol.toStringTag] = "myStringTag3"; | ||
| assert (Object.prototype.toString.call (new ArrayBuffer ()) === "[object myStringTag3]"); | ||
| ArrayBuffer.prototype[Symbol.toStringTag] = {}; | ||
| assert (ArrayBuffer.prototype.toString.call (new ArrayBuffer ()) === "[object ArrayBuffer]"); | ||
|
|
||
| /* Promise.prototype @@toStringTag */ | ||
| assert (Promise.prototype[Symbol.toStringTag] === "Promise"); | ||
| assert (Object.prototype.toString.call (new Promise (function () {})) === "[object Promise]"); | ||
|
|
||
| assert (delete Promise.prototype[Symbol.toStringTag]); | ||
| assert (Promise.prototype[Symbol.toStringTag] === undefined); | ||
| Promise.prototype[Symbol.toStringTag] = "myStringTag4"; | ||
| assert (Object.prototype.toString.call (new Promise (function () {})) === "[object myStringTag4]"); | ||
| Promise.prototype[Symbol.toStringTag] = {}; | ||
| assert (Promise.prototype.toString.call (new Promise (function () {})) === "[object Promise]"); | ||
|
|
||
| /* Map.prototype @@toStringTag */ | ||
| assert (Map.prototype[Symbol.toStringTag] === "Map"); | ||
| assert (Object.prototype.toString.call (new Map ()) === "[object Map]"); | ||
| assert (Object.prototype.toString.call (Map) === "[object Function]"); | ||
|
|
||
| assert (delete Map.prototype[Symbol.toStringTag]); | ||
| assert (Map.prototype[Symbol.toStringTag] === undefined); | ||
| Map.prototype[Symbol.toStringTag] = "myStringTag5"; | ||
| assert (Map.prototype.toString.call (new Map ()) === "[object myStringTag5]"); | ||
| assert (Object.prototype.toString.call (Map) === "[object Function]"); | ||
| Map.prototype[Symbol.toStringTag] = {}; | ||
| assert (Map.prototype.toString.call (new Map) === "[object Map]"); | ||
|
|
||
| /* JSON @@toStringTag */ | ||
| assert (JSON[Symbol.toStringTag] === "JSON"); | ||
| assert (Object.prototype.toString.call (JSON) === "[object JSON]"); | ||
|
|
||
| assert (delete JSON[Symbol.toStringTag]); | ||
| assert (JSON[Symbol.toStringTag] === undefined); | ||
| JSON[Symbol.toStringTag] = "myStringTag6"; | ||
| assert (Map.prototype.toString.call (JSON) === "[object myStringTag6]"); | ||
| JSON[Symbol.toStringTag] = {}; | ||
| assert (Object.prototype.toString.call (JSON) === "[object JSON]"); | ||
|
|
||
| var typedArrayTypes = ["Int8Array", | ||
| "Uint8Array", | ||
| "Uint8ClampedArray", | ||
| "Int16Array", | ||
| "Uint16Array", | ||
| "Int32Array", | ||
| "Uint32Array", | ||
| "Float32Array", | ||
| "Float64Array"]; | ||
|
|
||
| for (var i = 0; i < typedArrayTypes.length; i++) { | ||
| var typedArray = this[typedArrayTypes[i]]; | ||
| assert (typedArray.prototype[Symbol.toStringTag] === undefined); | ||
| assert (Object.prototype.toString.call (typedArray) === "[object Function]"); | ||
| assert (Object.prototype.toString.call (typedArray.prototype) === "[object Object]"); | ||
|
|
||
| var newArray = new typedArray (); | ||
| assert (newArray[Symbol.toStringTag] === typedArrayTypes[i]); | ||
| assert (Object.prototype.toString.call (newArray) === "[object " + typedArrayTypes[i] + "]"); | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.