LibWeb: Replace IDL 'void' return type with 'undefined'

From the Web IDL spec: https://heycam.github.io/webidl/#idl-undefined

[...]
undefined constant values in IDL are represented with the `undefined`
token.
[...]
Note: This value was previously spelled `void`, and more limited in how
it was allowed to be used.
This commit is contained in:
Linus Groh 2020-12-09 21:32:04 +00:00 committed by Andreas Kling
parent c1dfb2d883
commit 5d77a19af5
Notes: sideshowbarker 2024-07-19 00:56:23 +09:00
6 changed files with 23 additions and 23 deletions

View file

@ -741,7 +741,7 @@ static @fully_qualified_name@* impl_from(JS::VM& vm, JS::GlobalObject& global_ob
auto scoped_generator = generator.fork();
scoped_generator.set("return_type", return_type.name);
if (return_type.name == "void") {
if (return_type.name == "undefined") {
scoped_generator.append(R"~~~(
return JS::js_undefined();
)~~~");
@ -918,7 +918,7 @@ JS_DEFINE_NATIVE_FUNCTION(@wrapper_class@::@function.name:snakecase@)
function_generator.set(".arguments", arguments_builder.string_view());
if (function.return_type.name != "void") {
if (function.return_type.name != "undefined") {
function_generator.append(R"~~~(
auto retval = impl->@function.name:snakecase@(@.arguments@);
)~~~");

View file

@ -3,7 +3,7 @@ interface Element : Node {
readonly attribute DOMString tagName;
DOMString? getAttribute(DOMString qualifiedName);
void setAttribute(DOMString qualifiedName, DOMString value);
undefined setAttribute(DOMString qualifiedName, DOMString value);
readonly attribute Element? firstElementChild;
readonly attribute Element? lastElementChild;

View file

@ -7,14 +7,14 @@ interface Event {
readonly attribute unsigned short eventPhase;
void stopPropagation();
undefined stopPropagation();
attribute boolean cancelBubble;
void stopImmediatePropagation();
undefined stopImmediatePropagation();
readonly attribute boolean bubbles;
readonly attribute boolean cancelable;
attribute boolean returnValue;
void preventDefault();
undefined preventDefault();
readonly attribute boolean defaultPrevented;
readonly attribute boolean composed;

View file

@ -1,6 +1,6 @@
interface EventTarget {
void addEventListener(DOMString type, EventListener? callback);
void removeEventListener(DOMString type, EventListener? callback);
undefined addEventListener(DOMString type, EventListener? callback);
undefined removeEventListener(DOMString type, EventListener? callback);
};

View file

@ -1,28 +1,28 @@
interface CanvasRenderingContext2D {
void fillRect(double x, double y, double w, double h);
void strokeRect(double x, double y, double w, double h);
undefined fillRect(double x, double y, double w, double h);
undefined strokeRect(double x, double y, double w, double h);
void scale(double x, double y);
void translate(double x, double y);
void rotate(double radians);
undefined scale(double x, double y);
undefined translate(double x, double y);
undefined rotate(double radians);
void beginPath();
void closePath();
void fill(DOMString fillRule);
void stroke();
void moveTo(double x, double y);
void lineTo(double x, double y);
void quadraticCurveTo(double cpx, double cpy, double x, double y);
undefined beginPath();
undefined closePath();
undefined fill(DOMString fillRule);
undefined stroke();
undefined moveTo(double x, double y);
undefined lineTo(double x, double y);
undefined quadraticCurveTo(double cpx, double cpy, double x, double y);
void drawImage(HTMLImageElement image, double dx, double dy);
undefined drawImage(HTMLImageElement image, double dx, double dy);
attribute DOMString fillStyle;
attribute DOMString strokeStyle;
attribute double lineWidth;
ImageData createImageData(double sw, double sh);
void putImageData(ImageData imagedata, double dx, double dy);
undefined putImageData(ImageData imagedata, double dx, double dy);
readonly attribute HTMLCanvasElement canvas;

View file

@ -5,6 +5,6 @@ interface HTMLFormElement : HTMLElement {
[Reflect=accept-charset] attribute DOMString acceptCharset;
[Reflect=novalidate] attribute boolean noValidate;
void submit();
undefined submit();
};