Add a function to query a global object, including JS classes, from C++

The latter are not properties of the global object but stored within the
global lexical environment.
This is not currently needed, but will be useful for future diffs.
Update Vector2D/3D querying.

Taken from D2746

This was SVN commit r24406.
This commit is contained in:
wraitii
2020-12-17 17:51:18 +00:00
parent 25b8cfc6b8
commit e22a915351
3 changed files with 41 additions and 2 deletions
+9
View File
@@ -233,6 +233,15 @@ public:
*/
bool HasProperty(JS::HandleValue obj, const char* name) const;
/**
* Get an object from the global scope or any lexical scope.
* This can return globally accessible objects even if they are not properties
* of the global object (e.g. ES6 class definitions).
* @param name - Name of the property.
* @param out The object or null.
*/
static bool GetGlobalProperty(const ScriptRequest& rq, const std::string& name, JS::MutableHandleValue out);
/**
* Returns all properties of the object, both own properties and inherited.
* This is essentially equivalent to calling Object.getOwnPropertyNames()