microsoft / react-native-winrt

Windows Runtime projection for React Native for Windows
MIT License
87 stars 11 forks source link

Property setters result in an exception with Chakra in 'strict' mode #8

Open dunhor opened 3 years ago

dunhor commented 3 years ago

E.g. if a file has 'use strict' and then tries to use the "putter", an exception will get thrown by Chakra (although the "putting" will actually succeed) because the set call returns undefined. I'd assume that this is for support of a = b = c syntax so that a and b both get assigned the value of c, e.g. similar to C++'s operator=.

This isn't actually our problem since the virtual function in JSI returns void, which then gets translated into undefined by the JSI implementation. It's unclear if this is a problem with the JSI implementation for Chakra (e.g. perhaps it should just returns what it was given as input) or JSI itself (e.g. have the return value be jsi::Value). This will however affect our consumers, so we should probably track down exactly whose issue it is. It's also unknown to me what the behavior to me is for v8/Hermes

dunhor commented 3 years ago

Although curiously enough - if you disable strict mode - the following works as expected:

var assignedValue;
assignedValue = winrtObject.boolProperty = false;