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

Unified Diff: src/objects.cc

Issue 7321006: Add GetPropertyAttribute method for Object in the API (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix the mentioned issues Created 9 years, 5 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/objects.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 26ab64552fc344fff7be569d3f43b365650c4d6f..94ee4ece8bbda91524defc5363edc1daabac5bcf 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -2639,6 +2639,27 @@ PropertyAttributes JSReceiver::GetPropertyAttribute(JSReceiver* receiver,
}
+PropertyAttributes JSReceiver::TryGetPropertyAttribute(
+ Handle<Object> key,
+ bool* has_pending_exception) {
+ Isolate* isolate = GetIsolate();
+ HandleScope scope(isolate);
+ Handle<String> name;
+ if (key->IsString()) {
+ name = Handle<String>::cast(key);
+ } else {
+ Handle<Object> converted =
+ Execution::ToString(key, has_pending_exception);
+ if (*has_pending_exception) return NONE;
+ name = Handle<String>::cast(converted);
+ }
+ PropertyAttributes attr = GetPropertyAttributeWithReceiver(this, *name);
+ // Returns NONE when the property doesn't exist.
+ if (attr == ABSENT) return NONE;
+ return attr;
+}
+
+
PropertyAttributes JSReceiver::GetLocalPropertyAttribute(String* name) {
// Check whether the name is an array index.
uint32_t index = 0;
« no previous file with comments | « src/objects.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698