diff options
author | Linus Groh <mail@linusgroh.de> | 2021-10-03 01:35:36 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-10-03 20:14:03 +0100 |
commit | fe86b04b42f58f71e1f46f7a119a994897b4fdd8 (patch) | |
tree | 210c2d40dc7f463e78e8beb189a16e92d6311c5d /Userland/Libraries/LibJS/AST.cpp | |
parent | ebf57df431f3d508d72b72024a3904c7de8e08b2 (diff) | |
download | serenity-fe86b04b42f58f71e1f46f7a119a994897b4fdd8.zip |
LibJS: Convert define_property_or_throw() to ThrowCompletionOr
Diffstat (limited to 'Userland/Libraries/LibJS/AST.cpp')
-rw-r--r-- | Userland/Libraries/LibJS/AST.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/Userland/Libraries/LibJS/AST.cpp b/Userland/Libraries/LibJS/AST.cpp index de88ab719f..d818aa60ea 100644 --- a/Userland/Libraries/LibJS/AST.cpp +++ b/Userland/Libraries/LibJS/AST.cpp @@ -1260,21 +1260,19 @@ ThrowCompletionOr<Value> ClassExpression::class_definition_evaluation(Interprete switch (method.kind()) { case ClassMethod::Kind::Method: - target.define_property_or_throw(property_key, { .value = method_value, .writable = true, .enumerable = false, .configurable = true }); + TRY(target.define_property_or_throw(property_key, { .value = method_value, .writable = true, .enumerable = false, .configurable = true })); break; case ClassMethod::Kind::Getter: update_function_name(method_value, String::formatted("get {}", get_function_name(global_object, key))); - target.define_property_or_throw(property_key, { .get = &method_function, .enumerable = true, .configurable = true }); + TRY(target.define_property_or_throw(property_key, { .get = &method_function, .enumerable = true, .configurable = true })); break; case ClassMethod::Kind::Setter: update_function_name(method_value, String::formatted("set {}", get_function_name(global_object, key))); - target.define_property_or_throw(property_key, { .set = &method_function, .enumerable = true, .configurable = true }); + TRY(target.define_property_or_throw(property_key, { .set = &method_function, .enumerable = true, .configurable = true })); break; default: VERIFY_NOT_REACHED(); } - if (auto* exception = interpreter.exception()) - return throw_completion(exception->value()); } for (auto& field : m_fields) { |