File tree 3 files changed +17
-0
lines changed
3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -151,6 +151,7 @@ class JSCRuntime : public jsi::Runtime {
151
151
jsi::PropNameID createPropNameIDFromUtf8 (const uint8_t *utf8, size_t length)
152
152
override ;
153
153
jsi::PropNameID createPropNameIDFromString (const jsi::String &str) override ;
154
+ jsi::PropNameID createPropNameIDFromSymbol (const jsi::Symbol &sym) override ;
154
155
std::string utf8 (const jsi::PropNameID &) override ;
155
156
bool compare (const jsi::PropNameID &, const jsi::PropNameID &) override ;
156
157
@@ -653,6 +654,13 @@ jsi::PropNameID JSCRuntime::createPropNameIDFromString(const jsi::String &str) {
653
654
return createPropNameID (stringRef (str));
654
655
}
655
656
657
+ jsi::PropNameID JSCRuntime::createPropNameIDFromSymbol (const jsi::Symbol &sym) {
658
+ // TODO: Support for symbols through the native API in JSC is very limited.
659
+ // While we could construct a PropNameID here, we would not be able to get a
660
+ // symbol property through the C++ API.
661
+ throw std::logic_error (" Not implemented" );
662
+ }
663
+
656
664
std::string JSCRuntime::utf8 (const jsi::PropNameID &sym) {
657
665
return JSStringToSTLString (stringRef (sym));
658
666
}
Original file line number Diff line number Diff line change @@ -176,6 +176,9 @@ class RuntimeDecorator : public Base, private jsi::Instrumentation {
176
176
PropNameID createPropNameIDFromString (const String& str) override {
177
177
return plain_.createPropNameIDFromString (str);
178
178
};
179
+ PropNameID createPropNameIDFromSymbol (const Symbol& sym) override {
180
+ return plain_.createPropNameIDFromSymbol (sym);
181
+ };
179
182
std::string utf8 (const PropNameID& id) override {
180
183
return plain_.utf8 (id);
181
184
};
Original file line number Diff line number Diff line change @@ -274,6 +274,7 @@ class JSI_EXPORT Runtime {
274
274
const uint8_t * utf8,
275
275
size_t length) = 0;
276
276
virtual PropNameID createPropNameIDFromString (const String& str) = 0;
277
+ virtual PropNameID createPropNameIDFromSymbol (const Symbol& sym) = 0;
277
278
virtual std::string utf8 (const PropNameID&) = 0;
278
279
virtual bool compare (const PropNameID&, const PropNameID&) = 0;
279
280
@@ -425,6 +426,11 @@ class JSI_EXPORT PropNameID : public Pointer {
425
426
return runtime.createPropNameIDFromString (str);
426
427
}
427
428
429
+ // / Create a PropNameID from a JS symbol.
430
+ static PropNameID forSymbol (Runtime& runtime, const jsi::Symbol& sym) {
431
+ return runtime.createPropNameIDFromSymbol (sym);
432
+ }
433
+
428
434
// Creates a vector of PropNameIDs constructed from given arguments.
429
435
template <typename ... Args>
430
436
static std::vector<PropNameID> names (Runtime& runtime, Args&&... args);
You can’t perform that action at this time.
0 commit comments