Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Unified Diff: src/symbol.js

Issue 108083005: ES6: Add Object.getOwnPropertySymbols (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comment and formatting based on code review Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime.cc ('k') | src/v8natives.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/symbol.js
diff --git a/src/symbol.js b/src/symbol.js
index 050e7d918a02e83934883f280ec75be9424ba9db..baf861c142b3d86d0d3dd854f6b38fe3a54e426d 100644
--- a/src/symbol.js
+++ b/src/symbol.js
@@ -68,6 +68,19 @@ function SymbolValueOf() {
return %_ValueOf(this);
}
+// ES6 19.1.2.8
+function ObjectGetOwnPropertySymbols(obj) {
+ if (!IS_SPEC_OBJECT(obj)) {
+ throw MakeTypeError("called_on_non_object",
+ ["Object.getOwnPropertySymbols"]);
+ }
+
+ // TODO(arv): Proxies use a shared trap for String and Symbol keys.
+
+ return ObjectGetOwnPropertyKeys(obj, true);
+}
+
+
//-------------------------------------------------------------------
function SetUpSymbol() {
@@ -85,3 +98,13 @@ function SetUpSymbol() {
}
SetUpSymbol();
+
+function ExtendObject() {
+ %CheckIsBootstrapping();
+
+ InstallFunctions($Object, DONT_ENUM, $Array(
+ "getOwnPropertySymbols", ObjectGetOwnPropertySymbols
+ ));
+}
+
+ExtendObject();
« no previous file with comments | « src/runtime.cc ('k') | src/v8natives.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698