Browse Source

LibWeb: Add basic support for boolean IDL attributes :^)

Andreas Kling 4 years ago
parent
commit
5782099106
1 changed files with 4 additions and 0 deletions
  1. 4 0
      Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp

+ 4 - 0
Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp

@@ -541,6 +541,8 @@ void generate_implementation(const IDL::Interface& interface)
             out() << "    auto " << cpp_name << " = " << js_name << js_suffix << ".to_double(interpreter);";
             out() << "    if (interpreter.exception())";
             generate_return();
+        } else if (parameter.type.name == "boolean") {
+            out() << "    auto " << cpp_name << " = " << js_name << js_suffix << ".to_boolean();";
         } else {
             dbg() << "Unimplemented JS-to-C++ conversion: " << parameter.type.name;
             ASSERT_NOT_REACHED();
@@ -589,6 +591,8 @@ void generate_implementation(const IDL::Interface& interface)
             out() << "    return JS::Value(retval);";
         } else if (return_type.name == "Uint8ClampedArray") {
             out() << "    return retval;";
+        } else  if (return_type.name == "boolean") {
+            out() << "    return JS::Value(retval);";
         } else {
             out() << "    return wrap(global_object, const_cast<" << return_type.name << "&>(*retval));";
         }