1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:18:11 +00:00

LibJS: Implement void operator

This commit is contained in:
Linus Groh 2020-04-15 17:55:03 +01:00 committed by Andreas Kling
parent beda751d33
commit d30db07048
4 changed files with 34 additions and 1 deletions

View file

@ -391,7 +391,11 @@ Value UnaryExpression::execute(Interpreter& interpreter) const
return js_string(interpreter, "object");
case Value::Type::Boolean:
return js_string(interpreter, "boolean");
default:
ASSERT_NOT_REACHED();
}
case UnaryOp::Void:
return js_undefined();
}
ASSERT_NOT_REACHED();
@ -539,6 +543,9 @@ void UnaryExpression::dump(int indent) const
case UnaryOp::Typeof:
op_string = "typeof ";
break;
case UnaryOp::Void:
op_string = "void ";
break;
}
print_indent(indent);