diff options
author | Andreas Kling <kling@serenityos.org> | 2020-03-27 12:54:18 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-03-27 12:56:05 +0100 |
commit | c60dc84a333a85bd859d284cea72b9c02682a392 (patch) | |
tree | 97cd62730ea66b3ad4f07813cde51ea014cba23f /Libraries/LibJS/Runtime/Object.h | |
parent | 04ced9e24a7015c867060478c3418cde81f93214 (diff) | |
download | serenity-c60dc84a333a85bd859d284cea72b9c02682a392.zip |
LibJS: Allow function calls with missing arguments
We were interpreting "undefined" as a variable lookup failure in some
cases and throwing a ReferenceError exception instead of treating it
as the valid value "undefined".
This patch wraps the result of variable lookup in Optional<>, which
allows us to only throw ReferenceError when lookup actually fails.
Diffstat (limited to 'Libraries/LibJS/Runtime/Object.h')
-rw-r--r-- | Libraries/LibJS/Runtime/Object.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Libraries/LibJS/Runtime/Object.h b/Libraries/LibJS/Runtime/Object.h index 149255139e..041ea089ba 100644 --- a/Libraries/LibJS/Runtime/Object.h +++ b/Libraries/LibJS/Runtime/Object.h @@ -40,7 +40,7 @@ public: Object(); virtual ~Object(); - Value get(const FlyString& property_name) const; + Optional<Value> get(const FlyString& property_name) const; void put(const FlyString& property_name, Value); virtual Optional<Value> get_own_property(const Object& this_object, const FlyString& property_name) const; |