From 40629c892f87237a27f2d1dcb9b007080bd74825 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Fri, 7 Aug 2020 00:00:49 +0200 Subject: [PATCH 1/5] feat: support `undefined` type --- lib/productions/helpers.js | 2 +- lib/productions/type.js | 21 ++++++++++++++++++++- lib/tokeniser.js | 1 + test/autofix.js | 36 ++++++++++++++++++++++++++---------- 4 files changed, 48 insertions(+), 12 deletions(-) diff --git a/lib/productions/helpers.js b/lib/productions/helpers.js index d0c97eb6..b2abf67a 100644 --- a/lib/productions/helpers.js +++ b/lib/productions/helpers.js @@ -102,7 +102,7 @@ export function primitive_type(tokeniser) { const { source } = tokeniser; const num_type = integer_type(tokeniser) || decimal_type(tokeniser); if (num_type) return num_type; - const base = tokeniser.consume("boolean", "byte", "octet"); + const base = tokeniser.consume("boolean", "byte", "octet", "undefined"); if (base) { return new Type({ source, tokens: { base } }); } diff --git a/lib/productions/type.js b/lib/productions/type.js index 39f853d0..d6717139 100644 --- a/lib/productions/type.js +++ b/lib/productions/type.js @@ -151,6 +151,16 @@ export class Type extends Base { *validate(defs) { yield* this.extAttrs.validate(defs); + + if (this.idlType === "void") { + const message = `\`void\` is now replaced by \`undefined\`. Refer to the \ +[relevant GitHub issue](https://github.com/heycam/webidl/issues/60) \ +for more information.`; + yield validationError(this.tokens.base, this, "replace-void", message, { + autofix: replaceVoid(this) + }); + } + /* * If a union is nullable, its subunions cannot include a dictionary * If not, subunions may include dictionaries if each union is not nullable @@ -165,7 +175,7 @@ export class Type extends Base { const { reference } = idlTypeIncludesDictionary(target, defs) || {}; if (reference) { const targetToken = (this.union ? reference : this).tokens.base; - const message = `Nullable union cannot include a dictionary type`; + const message = "Nullable union cannot include a dictionary type."; yield validationError(targetToken, this, "no-nullable-union-dict", message); } } else { @@ -176,3 +186,12 @@ export class Type extends Base { } } } + +/** + * @param {Type} type + */ +function replaceVoid(type) { + return () => { + type.tokens.base.value = "undefined"; + }; +} diff --git a/lib/tokeniser.js b/lib/tokeniser.js index 02a038d0..a08f5455 100644 --- a/lib/tokeniser.js +++ b/lib/tokeniser.js @@ -87,6 +87,7 @@ const nonRegexTerminals = [ "sequence", "short", "true", + "undefined", "unsigned", "void" ].concat(argumentNameKeywords, stringTypes, typeNameKeywords); diff --git a/test/autofix.js b/test/autofix.js index ca64bbe2..633ff8ed 100644 --- a/test/autofix.js +++ b/test/autofix.js @@ -20,14 +20,14 @@ describe("Writer template functions", () => { dictionary A {}; [Exposed=Window] interface B { - void op(optional A a); + undefined op(optional A a); }; `; const output = ` dictionary A {}; [Exposed=Window] interface B { - void op(optional A a = {}); + undefined op(optional A a = {}); }; `; expect(autofix(input)).toBe(output); @@ -195,7 +195,7 @@ describe("Writer template functions", () => { [Exposed=Window, Constructor] interface C { \t// tabbed indentation - \tvoid koala(); + \tundefined koala(); }; `; const outputTabOp = ` @@ -203,7 +203,7 @@ describe("Writer template functions", () => { interface C { \tconstructor(); \t// tabbed indentation - \tvoid koala(); + \tundefined koala(); }; `; expect(autofix(inputTabOp)).toBe(outputTabOp); @@ -212,7 +212,7 @@ describe("Writer template functions", () => { [Exposed=Window, Constructor] interface C { \t// tabbed indentation - \tstatic void koala(); + \tstatic undefined koala(); }; `; const outputTabSpecialOp = ` @@ -220,7 +220,7 @@ describe("Writer template functions", () => { interface C { \tconstructor(); \t// tabbed indentation - \tstatic void koala(); + \tstatic undefined koala(); }; `; expect(autofix(inputTabSpecialOp)).toBe(outputTabSpecialOp); @@ -270,7 +270,7 @@ describe("Writer template functions", () => { }; interface mixin Container { - void op( + undefined op( DOMString str, Optional arg ); @@ -282,7 +282,7 @@ describe("Writer template functions", () => { }; interface mixin Container { - void op( + undefined op( DOMString str, optional Optional arg = {} ); @@ -305,7 +305,7 @@ describe("Writer template functions", () => { }; [TreatNonObjectAsNull] - callback TreatsNonObjectAsNull = void (DOMString s); + callback TreatsNonObjectAsNull = undefined (DOMString s); `; const output = ` [Exposed=Window, @@ -320,7 +320,23 @@ describe("Writer template functions", () => { }; [LegacyTreatNonObjectAsNull] - callback TreatsNonObjectAsNull = void (DOMString s); + callback TreatsNonObjectAsNull = undefined (DOMString s); + `; + expect(autofix(input)).toBe(output); + }); + + it("should replace undefined into undefined", () => { + const input = ` + [Exposed=Window] + interface Foo { + void foo(); + }; + `; + const output = ` + [Exposed=Window] + interface Foo { + undefined foo(); + }; `; expect(autofix(input)).toBe(output); }); From 06b22a39586a27a5e4bef1655718a339cd19b3c8 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Fri, 7 Aug 2020 00:00:57 +0200 Subject: [PATCH 2/5] add tests --- .../baseline/argument-dict-default.txt | 8 +++---- .../baseline/argument-dict-nullable.txt | 10 ++++---- .../baseline/argument-dict-optional.txt | 16 ++++++------- .../baseline/nullable-union-dictionary.txt | 22 ++++++++--------- test/invalid/baseline/overloads.txt | 24 +++++++++---------- test/invalid/baseline/recursive-type.txt | 8 +++---- test/invalid/baseline/void-keyword.txt | 3 +++ test/invalid/idl/argument-dict-default.webidl | 14 +++++------ .../invalid/idl/argument-dict-nullable.webidl | 10 ++++---- .../invalid/idl/argument-dict-optional.webidl | 20 ++++++++-------- test/invalid/idl/duplicate.webidl | 2 +- .../idl/nullable-union-dictionary.webidl | 2 +- test/invalid/idl/overloads.webidl | 20 ++++++++-------- test/invalid/idl/recursive-type.webidl | 4 ++-- .../idl/renamed-legacy-extattrs.webidl | 2 +- test/invalid/idl/void-keyword.webidl | 4 ++++ test/syntax/baseline/allowany.json | 8 +++---- .../syntax/baseline/argument-constructor.json | 2 +- test/syntax/baseline/argument-extattrs.json | 2 +- test/syntax/baseline/async-name.json | 2 +- test/syntax/baseline/callback.json | 4 ++-- test/syntax/baseline/enum.json | 2 +- test/syntax/baseline/equivalent-decl.json | 8 +++---- test/syntax/baseline/getter-setter.json | 4 ++-- .../baseline/identifier-qualified-names.json | 2 +- test/syntax/baseline/includes-name.json | 2 +- test/syntax/baseline/indexed-properties.json | 8 +++---- test/syntax/baseline/nullableobjects.json | 6 ++--- test/syntax/baseline/obsolete-keywords.json | 4 ++-- test/syntax/baseline/overloading.json | 12 +++++----- test/syntax/baseline/record.json | 2 +- test/syntax/baseline/reg-operations.json | 6 ++--- test/syntax/baseline/replaceable.json | 4 ++-- test/syntax/baseline/sequence.json | 4 ++-- test/syntax/baseline/typesuffixes.json | 2 +- test/syntax/baseline/variadic-operations.json | 6 ++--- test/syntax/idl/allowany.webidl | 8 +++---- test/syntax/idl/argument-constructor.webidl | 2 +- test/syntax/idl/argument-extattrs.webidl | 2 +- test/syntax/idl/async-name.webidl | 2 +- test/syntax/idl/callback.webidl | 4 ++-- test/syntax/idl/enum.webidl | 2 +- test/syntax/idl/equivalent-decl.webidl | 8 +++---- test/syntax/idl/getter-setter.webidl | 4 ++-- .../idl/identifier-qualified-names.webidl | 2 +- test/syntax/idl/includes-name.webidl | 2 +- test/syntax/idl/indexed-properties.webidl | 8 +++---- test/syntax/idl/nullableobjects.webidl | 6 ++--- test/syntax/idl/obsolete-keywords.webidl | 4 ++-- test/syntax/idl/overloading.webidl | 12 +++++----- test/syntax/idl/record.webidl | 2 +- test/syntax/idl/reg-operations.webidl | 6 ++--- test/syntax/idl/replaceable.webidl | 4 ++-- test/syntax/idl/sequence.webidl | 4 ++-- test/syntax/idl/typesuffixes.webidl | 2 +- test/syntax/idl/variadic-operations.webidl | 6 ++--- 56 files changed, 178 insertions(+), 171 deletions(-) create mode 100644 test/invalid/baseline/void-keyword.txt create mode 100644 test/invalid/idl/void-keyword.webidl diff --git a/test/invalid/baseline/argument-dict-default.txt b/test/invalid/baseline/argument-dict-default.txt index 62fdff35..fd714514 100644 --- a/test/invalid/baseline/argument-dict-default.txt +++ b/test/invalid/baseline/argument-dict-default.txt @@ -2,14 +2,14 @@ constructor(optional Union union); ^ Optional dictionary arguments must have a default value of `{}`. (dict-arg-default) Validation error at line 14 in argument-dict-default.webidl, inside `interface X -> operation x -> argument dict`: - void x(optional Dict dict); - ^ Optional dictionary arguments must have a default value of `{}`. + undefined x(optional Dict dict); + ^ Optional dictionary arguments must have a default value of `{}`. (dict-arg-default) Validation error at line 16 in argument-dict-default.webidl, inside `interface X -> operation y -> argument union`: (boolean or Dict) union); ^ Optional dictionary arguments must have a default value of `{}`. (dict-arg-default) Validation error at line 18 in argument-dict-default.webidl, inside `interface X -> operation z -> argument union`: - void z(optional Union union); - ^ Optional dictionary arguments must have a default value of `{}`. + undefined z(optional Union union); + ^ Optional dictionary arguments must have a default value of `{}`. (dict-arg-default) Validation error at line 22 in argument-dict-default.webidl, inside `interface X -> iterable -> argument union`: DOMString>(optional Union union); ^ Optional dictionary arguments must have a default value of `{}`. diff --git a/test/invalid/baseline/argument-dict-nullable.txt b/test/invalid/baseline/argument-dict-nullable.txt index aa178f9a..9ade1218 100644 --- a/test/invalid/baseline/argument-dict-nullable.txt +++ b/test/invalid/baseline/argument-dict-nullable.txt @@ -6,19 +6,19 @@ ^ Dictionary arguments cannot be nullable. (no-nullable-union-dict) Validation error at line 15 in argument-dict-nullable.webidl: (optional (boolean or Dict)? union = - ^ Nullable union cannot include a dictionary type + ^ Nullable union cannot include a dictionary type. (no-nullable-dict-arg) Validation error at line 15 in argument-dict-nullable.webidl, inside `interface X -> operation y2 -> argument union`: boolean or Dict)? union = {}) ^ Dictionary arguments cannot be nullable. (no-nullable-union-dict) Validation error at line 16 in argument-dict-nullable.webidl: - void z2(optional Union? union = { - ^ Nullable union cannot include a dictionary type + undefined z2(optional Union? union = { + ^ Nullable union cannot include a dictionary type. (no-nullable-dict-arg) Validation error at line 16 in argument-dict-nullable.webidl, inside `interface X -> operation z2 -> argument union`: z2(optional Union? union = {}) ^ Dictionary arguments cannot be nullable. (no-nullable-dict-arg) Validation error at line 17 in argument-dict-nullable.webidl, inside `interface X -> operation r -> argument req`: - void r(Required? req); - ^ Dictionary arguments cannot be nullable. + undefined r(Required? req); + ^ Dictionary arguments cannot be nullable. (no-nullable-dict-arg) Validation error at line 19 in argument-dict-nullable.webidl, inside `interface X -> iterable -> argument dict`: >(optional Dict? dict); ^ Dictionary arguments cannot be nullable. diff --git a/test/invalid/baseline/argument-dict-optional.txt b/test/invalid/baseline/argument-dict-optional.txt index 76d111e4..c7ff790b 100644 --- a/test/invalid/baseline/argument-dict-optional.txt +++ b/test/invalid/baseline/argument-dict-optional.txt @@ -1,18 +1,18 @@ (dict-arg-optional) Validation error at line 25 in argument-dict-optional.webidl, inside `interface mixin Container -> operation op1 -> argument shouldBeOptional`: - void op1(Optional shouldBeOptional); - ^ Dictionary argument must be optional if it has no required fields + undefined op1(Optional shouldBeOptional); + ^ Dictionary argument must be optional if it has no required fields (dict-arg-optional) Validation error at line 29 in argument-dict-optional.webidl, inside `interface mixin Container -> operation op3 -> argument union`: (Optional or boolean) union); ^ Dictionary argument must be optional if it has no required fields (dict-arg-optional) Validation error at line 30 in argument-dict-optional.webidl, inside `interface mixin Container -> operation op4 -> argument union`: - void op4(OptionalUnion union); - ^ Dictionary argument must be optional if it has no required fields + undefined op4(OptionalUnion union); + ^ Dictionary argument must be optional if it has no required fields (dict-arg-optional) Validation error at line 33 in argument-dict-optional.webidl, inside `interface mixin Container -> operation op6 -> argument recursive`: - void op6(Recursive recursive); - ^ Dictionary argument must be optional if it has no required fields + undefined op6(Recursive recursive); + ^ Dictionary argument must be optional if it has no required fields (dict-arg-optional) Validation error at line 36 in argument-dict-optional.webidl, inside `interface mixin Container -> operation op8 -> argument lastRequired`: - void op8(Optional lastRequired, optional DOMString yay - ^ Dictionary argument must be optional if it has no required fields + undefined op8(Optional lastRequired, optional DOMString yay + ^ Dictionary argument must be optional if it has no required fields (dict-arg-optional) Validation error at line 42 in argument-dict-optional.webidl, inside `interface ContainerInterface -> iterable -> argument shouldBeOptional`: (Optional shouldBeOptional); ^ Dictionary argument must be optional if it has no required fields diff --git a/test/invalid/baseline/nullable-union-dictionary.txt b/test/invalid/baseline/nullable-union-dictionary.txt index bc0238db..0a71f479 100644 --- a/test/invalid/baseline/nullable-union-dictionary.txt +++ b/test/invalid/baseline/nullable-union-dictionary.txt @@ -1,36 +1,36 @@ (no-nullable-union-dict) Validation error at line 4 in nullable-union-dictionary.webidl: typedef (boolean or Dict)? NullableBooleanDict; - ^ Nullable union cannot include a dictionary type + ^ Nullable union cannot include a dictionary type. (no-nullable-union-dict) Validation error at line 6 in nullable-union-dictionary.webidl: boolean or (short or Dict))? NullableNestedBooleanDict - ^ Nullable union cannot include a dictionary type + ^ Nullable union cannot include a dictionary type. (no-nullable-union-dict) Validation error at line 7 in nullable-union-dictionary.webidl: boolean or (short or Dict)?) NestedNullableBooleanDict - ^ Nullable union cannot include a dictionary type + ^ Nullable union cannot include a dictionary type. (no-nullable-union-dict) Validation error at line 8 in nullable-union-dictionary.webidl: typedef BooleanDict? ReferencingNullableBooleanDict; - ^ Nullable union cannot include a dictionary type + ^ Nullable union cannot include a dictionary type. (no-nullable-union-dict) Validation error at line 9 in nullable-union-dictionary.webidl: typedef (boolean or RecursiveBooleanDict? or Dict) - ^ Nullable union cannot include a dictionary type + ^ Nullable union cannot include a dictionary type. (no-nullable-union-dict) Validation error at line 16 in nullable-union-dictionary.webidl: Callback = (boolean or Dict)? () - ^ Nullable union cannot include a dictionary type + ^ Nullable union cannot include a dictionary type. (no-nullable-union-dict) Validation error at line 19 in nullable-union-dictionary.webidl: (boolean or Dict)? op( - ^ Nullable union cannot include a dictionary type + ^ Nullable union cannot include a dictionary type. (no-nullable-union-dict) Validation error at line 20 in nullable-union-dictionary.webidl: voidOp((boolean or Dict)? arg) - ^ Nullable union cannot include a dictionary type + ^ Nullable union cannot include a dictionary type. (no-nullable-dict-arg) Validation error at line 20 in nullable-union-dictionary.webidl, inside `interface Interface -> operation voidOp -> argument arg`: boolean or Dict)? arg); ^ Dictionary arguments cannot be nullable. (no-nullable-union-dict) Validation error at line 21 in nullable-union-dictionary.webidl: attribute (boolean or Dict)? attr; - ^ Nullable union cannot include a dictionary type + ^ Nullable union cannot include a dictionary type. (no-nullable-union-dict) Validation error at line 23 in nullable-union-dictionary.webidl: iterable<(boolean or Dict)?>; - ^ Nullable union cannot include a dictionary type + ^ Nullable union cannot include a dictionary type. (no-nullable-union-dict) Validation error at line 27 in nullable-union-dictionary.webidl: (boolean or Dict)? dict; - ^ Nullable union cannot include a dictionary type + ^ Nullable union cannot include a dictionary type. diff --git a/test/invalid/baseline/overloads.txt b/test/invalid/baseline/overloads.txt index 926ff8f3..f483961e 100644 --- a/test/invalid/baseline/overloads.txt +++ b/test/invalid/baseline/overloads.txt @@ -1,18 +1,18 @@ (no-cross-overload) Validation error at line 8 in overloads.webidl, inside `partial interface Base`: - void unique(short num) - ^ The operation "unique" has already been defined for the base interface "Base" either in itself or in a mixin + undefined unique(short num) + ^ The operation "unique" has already been defined for the base interface "Base" either in itself or in a mixin (no-cross-overload) Validation error at line 12 in overloads.webidl, inside `interface mixin Extension`: - void unique(string str) - ^ The operation "unique" has already been defined for the base interface "Base" either in itself or in a mixin + undefined unique(string str) + ^ The operation "unique" has already been defined for the base interface "Base" either in itself or in a mixin (no-cross-overload) Validation error at line 22 in overloads.webidl, inside `interface mixin WebGL2RenderingContextBase`: - void bufferData(GLenum target, - ^ The operation "bufferData" has already been defined for the base interface "WebGL2RenderingContext" either in itself or in a mixin + undefined bufferData(GLenum target, + ^ The operation "bufferData" has already been defined for the base interface "WebGL2RenderingContext" either in itself or in a mixin (no-cross-overload) Validation error at line 23 in overloads.webidl, inside `interface mixin WebGL2RenderingContextBase`: - void bufferData(GLenum target, - ^ The operation "bufferData" has already been defined for the base interface "WebGL2RenderingContext" either in itself or in a mixin + undefined bufferData(GLenum target, + ^ The operation "bufferData" has already been defined for the base interface "WebGL2RenderingContext" either in itself or in a mixin (no-cross-overload) Validation error at line 24 in overloads.webidl, inside `interface mixin WebGL2RenderingContextBase`: - void bufferData(GLenum target, - ^ The operation "bufferData" has already been defined for the base interface "WebGL2RenderingContext" either in itself or in a mixin + undefined bufferData(GLenum target, + ^ The operation "bufferData" has already been defined for the base interface "WebGL2RenderingContext" either in itself or in a mixin (no-cross-overload) Validation error at line 26 in overloads.webidl, inside `interface mixin WebGL2RenderingContextBase`: - void bufferData(GLenum target, - ^ The operation "bufferData" has already been defined for the base interface "WebGL2RenderingContext" either in itself or in a mixin + undefined bufferData(GLenum target, + ^ The operation "bufferData" has already been defined for the base interface "WebGL2RenderingContext" either in itself or in a mixin diff --git a/test/invalid/baseline/recursive-type.txt b/test/invalid/baseline/recursive-type.txt index b3579a64..9414180a 100644 --- a/test/invalid/baseline/recursive-type.txt +++ b/test/invalid/baseline/recursive-type.txt @@ -1,6 +1,6 @@ (dict-arg-default) Validation error at line 9 in recursive-type.webidl, inside `interface X -> operation recursive -> argument r`: - void recursive(optional Recursive r); - ^ Optional dictionary arguments must have a default value of `{}`. + undefined recursive(optional Recursive r); + ^ Optional dictionary arguments must have a default value of `{}`. (dict-arg-default) Validation error at line 10 in recursive-type.webidl, inside `interface X -> operation recursive2 -> argument f`: - void recursive2(optional FriendX f); - ^ Optional dictionary arguments must have a default value of `{}`. + undefined recursive2(optional FriendX f); + ^ Optional dictionary arguments must have a default value of `{}`. diff --git a/test/invalid/baseline/void-keyword.txt b/test/invalid/baseline/void-keyword.txt new file mode 100644 index 00000000..37f4c118 --- /dev/null +++ b/test/invalid/baseline/void-keyword.txt @@ -0,0 +1,3 @@ +(replace-void) Validation error at line 3 in void-keyword.webidl: + void foo(); + ^ `void` is now replaced by `undefined`. Refer to the [relevant GitHub issue](https://github.com/heycam/webidl/issues/60) for more information. diff --git a/test/invalid/idl/argument-dict-default.webidl b/test/invalid/idl/argument-dict-default.webidl index 19aaa8b0..188ca762 100644 --- a/test/invalid/idl/argument-dict-default.webidl +++ b/test/invalid/idl/argument-dict-default.webidl @@ -11,13 +11,13 @@ typedef (short or Dict) Union; [Exposed=Window] interface X { constructor(optional Union union); - void x(optional Dict dict); - void x2(optional Dict dict = {}); - void y(optional (boolean or Dict) union); - void y2(optional (boolean or Dict) union = {}); - void z(optional Union union); - void z2(optional Union union = {}); - void r(Required req); + undefined x(optional Dict dict); + undefined x2(optional Dict dict = {}); + undefined y(optional (boolean or Dict) union); + undefined y2(optional (boolean or Dict) union = {}); + undefined z(optional Union union); + undefined z2(optional Union union = {}); + undefined r(Required req); async iterable(optional Union union); }; diff --git a/test/invalid/idl/argument-dict-nullable.webidl b/test/invalid/idl/argument-dict-nullable.webidl index 6d6b64c2..087fe8ea 100644 --- a/test/invalid/idl/argument-dict-nullable.webidl +++ b/test/invalid/idl/argument-dict-nullable.webidl @@ -10,11 +10,11 @@ typedef (short or Dict) Union; [Exposed=Window] interface X { - void x1(optional Dict? dict); - void x2(optional Dict? dict = {}); - void y2(optional (boolean or Dict)? union = {}); - void z2(optional Union? union = {}); - void r(Required? req); + undefined x1(optional Dict? dict); + undefined x2(optional Dict? dict = {}); + undefined y2(optional (boolean or Dict)? union = {}); + undefined z2(optional Union? union = {}); + undefined r(Required? req); async iterable(optional Dict? dict); }; diff --git a/test/invalid/idl/argument-dict-optional.webidl b/test/invalid/idl/argument-dict-optional.webidl index fbf52b7b..db180540 100644 --- a/test/invalid/idl/argument-dict-optional.webidl +++ b/test/invalid/idl/argument-dict-optional.webidl @@ -22,19 +22,19 @@ typedef (DOMString or Optional) OptionalUnion; typedef (DOMString or Optional?) NullableUnion; interface mixin Container { - void op1(Optional shouldBeOptional); - void op2(Required noNeedToBeOptional); - void op22(Required2 noNeedToBeOptional); + undefined op1(Optional shouldBeOptional); + undefined op2(Required noNeedToBeOptional); + undefined op22(Required2 noNeedToBeOptional); - void op3((Optional or boolean) union); - void op4(OptionalUnion union); - void op5(NullableUnion union); + undefined op3((Optional or boolean) union); + undefined op4(OptionalUnion union); + undefined op5(NullableUnion union); - void op6(Recursive recursive); - void op7(SuperDictUnknown unknown); + undefined op6(Recursive recursive); + undefined op7(SuperDictUnknown unknown); - void op8(Optional lastRequired, optional DOMString yay); - void op9(Optional notLast, DOMString yay); + undefined op8(Optional lastRequired, optional DOMString yay); + undefined op9(Optional notLast, DOMString yay); }; [Exposed=Window] diff --git a/test/invalid/idl/duplicate.webidl b/test/invalid/idl/duplicate.webidl index 60b71065..8e02f7f2 100644 --- a/test/invalid/idl/duplicate.webidl +++ b/test/invalid/idl/duplicate.webidl @@ -2,5 +2,5 @@ typedef int Test; [Exposed=Window] interface Test { - void foo(); + undefined foo(); }; diff --git a/test/invalid/idl/nullable-union-dictionary.webidl b/test/invalid/idl/nullable-union-dictionary.webidl index 7e14ce71..74cdc040 100644 --- a/test/invalid/idl/nullable-union-dictionary.webidl +++ b/test/invalid/idl/nullable-union-dictionary.webidl @@ -17,7 +17,7 @@ callback Callback = (boolean or Dict)? (); [Exposed=Window] interface Interface { (boolean or Dict)? op(); - void voidOp((boolean or Dict)? arg); + undefined voidOp((boolean or Dict)? arg); attribute (boolean or Dict)? attr; iterable<(boolean or Dict)?>; diff --git a/test/invalid/idl/overloads.webidl b/test/invalid/idl/overloads.webidl index 5e20b160..7154bd95 100644 --- a/test/invalid/idl/overloads.webidl +++ b/test/invalid/idl/overloads.webidl @@ -1,15 +1,15 @@ [Exposed=Window] interface Base { // Operations cannot be overloaded across partial interfaces and mixins - void unique(); + undefined unique(); }; partial interface Base { - void unique(short num); + undefined unique(short num); }; interface mixin Extension { - void unique(string str); + undefined unique(string str); }; Base includes Extension; Base includes Unknown; @@ -19,19 +19,19 @@ Base includes Unknown; interface mixin WebGL2RenderingContextBase { // WebGL1: - void bufferData(GLenum target, GLsizeiptr size, GLenum usage); - void bufferData(GLenum target, ArrayBuffer? srcData, GLenum usage); - void bufferData(GLenum target, ArrayBufferView srcData, GLenum usage); + undefined bufferData(GLenum target, GLsizeiptr size, GLenum usage); + undefined bufferData(GLenum target, ArrayBuffer? srcData, GLenum usage); + undefined bufferData(GLenum target, ArrayBufferView srcData, GLenum usage); // WebGL2: - void bufferData(GLenum target, ArrayBufferView srcData, GLenum usage, GLuint srcOffset, + undefined bufferData(GLenum target, ArrayBufferView srcData, GLenum usage, GLuint srcOffset, optional GLuint length = 0); }; interface mixin WebGLRenderingContextBase { - void bufferData(GLenum target, GLsizeiptr size, GLenum usage); - void bufferData(GLenum target, ArrayBuffer? data, GLenum usage); - void bufferData(GLenum target, ArrayBufferView data, GLenum usage); + undefined bufferData(GLenum target, GLsizeiptr size, GLenum usage); + undefined bufferData(GLenum target, ArrayBuffer? data, GLenum usage); + undefined bufferData(GLenum target, ArrayBufferView data, GLenum usage); }; [Exposed=(Window,Worker)] diff --git a/test/invalid/idl/recursive-type.webidl b/test/invalid/idl/recursive-type.webidl index d16c444e..e627d47f 100644 --- a/test/invalid/idl/recursive-type.webidl +++ b/test/invalid/idl/recursive-type.webidl @@ -6,6 +6,6 @@ dictionary Y {}; [Exposed=Window] interface X { - void recursive(optional Recursive r); - void recursive2(optional FriendX f); + undefined recursive(optional Recursive r); + undefined recursive2(optional FriendX f); }; diff --git a/test/invalid/idl/renamed-legacy-extattrs.webidl b/test/invalid/idl/renamed-legacy-extattrs.webidl index da131c2e..0c997ea0 100644 --- a/test/invalid/idl/renamed-legacy-extattrs.webidl +++ b/test/invalid/idl/renamed-legacy-extattrs.webidl @@ -10,4 +10,4 @@ interface HTMLTimeCapsule : HTMLElement { }; [TreatNonObjectAsNull] -callback TreatsNonObjectAsNull = void (DOMString s); +callback TreatsNonObjectAsNull = undefined (DOMString s); diff --git a/test/invalid/idl/void-keyword.webidl b/test/invalid/idl/void-keyword.webidl new file mode 100644 index 00000000..99b518d0 --- /dev/null +++ b/test/invalid/idl/void-keyword.webidl @@ -0,0 +1,4 @@ +[Exposed=Window] +interface Foo { + void foo(); +}; diff --git a/test/syntax/baseline/allowany.json b/test/syntax/baseline/allowany.json index 24fb1df7..63e9e9c1 100644 --- a/test/syntax/baseline/allowany.json +++ b/test/syntax/baseline/allowany.json @@ -13,7 +13,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [], "extAttrs": [], @@ -28,7 +28,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [ { @@ -60,7 +60,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [ { @@ -97,6 +97,6 @@ { "type": "eof", "value": "", - "trivia": "" + "trivia": "\n" } ] diff --git a/test/syntax/baseline/argument-constructor.json b/test/syntax/baseline/argument-constructor.json index fd4d1d23..5e76f557 100644 --- a/test/syntax/baseline/argument-constructor.json +++ b/test/syntax/baseline/argument-constructor.json @@ -13,7 +13,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [ { diff --git a/test/syntax/baseline/argument-extattrs.json b/test/syntax/baseline/argument-extattrs.json index 44655164..fefae5be 100644 --- a/test/syntax/baseline/argument-extattrs.json +++ b/test/syntax/baseline/argument-extattrs.json @@ -13,7 +13,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [ { diff --git a/test/syntax/baseline/async-name.json b/test/syntax/baseline/async-name.json index 6b995fd3..e48c2ebb 100644 --- a/test/syntax/baseline/async-name.json +++ b/test/syntax/baseline/async-name.json @@ -28,7 +28,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [ { diff --git a/test/syntax/baseline/callback.json b/test/syntax/baseline/callback.json index 44fdfcf9..4cd17902 100644 --- a/test/syntax/baseline/callback.json +++ b/test/syntax/baseline/callback.json @@ -8,7 +8,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [ { @@ -44,7 +44,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [ { diff --git a/test/syntax/baseline/enum.json b/test/syntax/baseline/enum.json index ea2c37c5..cfbd54f7 100644 --- a/test/syntax/baseline/enum.json +++ b/test/syntax/baseline/enum.json @@ -62,7 +62,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [ { diff --git a/test/syntax/baseline/equivalent-decl.json b/test/syntax/baseline/equivalent-decl.json index 9611a117..c420f419 100644 --- a/test/syntax/baseline/equivalent-decl.json +++ b/test/syntax/baseline/equivalent-decl.json @@ -60,7 +60,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [ { @@ -164,7 +164,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [ { @@ -244,7 +244,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [ { @@ -290,6 +290,6 @@ { "type": "eof", "value": "", - "trivia": "" + "trivia": "\n" } ] diff --git a/test/syntax/baseline/getter-setter.json b/test/syntax/baseline/getter-setter.json index 32b14f32..2d8fbe26 100644 --- a/test/syntax/baseline/getter-setter.json +++ b/test/syntax/baseline/getter-setter.json @@ -60,7 +60,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [ { @@ -106,6 +106,6 @@ { "type": "eof", "value": "", - "trivia": "" + "trivia": "\n" } ] diff --git a/test/syntax/baseline/identifier-qualified-names.json b/test/syntax/baseline/identifier-qualified-names.json index fd8d6971..9e0e38db 100644 --- a/test/syntax/baseline/identifier-qualified-names.json +++ b/test/syntax/baseline/identifier-qualified-names.json @@ -138,7 +138,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [ { diff --git a/test/syntax/baseline/includes-name.json b/test/syntax/baseline/includes-name.json index a6653ff6..8e98b3d1 100644 --- a/test/syntax/baseline/includes-name.json +++ b/test/syntax/baseline/includes-name.json @@ -13,7 +13,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [], "extAttrs": [], diff --git a/test/syntax/baseline/indexed-properties.json b/test/syntax/baseline/indexed-properties.json index 6ac5b738..8b769d46 100644 --- a/test/syntax/baseline/indexed-properties.json +++ b/test/syntax/baseline/indexed-properties.json @@ -60,7 +60,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [ { @@ -108,7 +108,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [ { @@ -172,7 +172,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [ { @@ -220,7 +220,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [ { diff --git a/test/syntax/baseline/nullableobjects.json b/test/syntax/baseline/nullableobjects.json index 69c80928..d6b04aee 100644 --- a/test/syntax/baseline/nullableobjects.json +++ b/test/syntax/baseline/nullableobjects.json @@ -29,7 +29,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [ { @@ -61,7 +61,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [ { @@ -91,6 +91,6 @@ { "type": "eof", "value": "", - "trivia": "" + "trivia": "\n" } ] diff --git a/test/syntax/baseline/obsolete-keywords.json b/test/syntax/baseline/obsolete-keywords.json index bd8824cb..15196578 100644 --- a/test/syntax/baseline/obsolete-keywords.json +++ b/test/syntax/baseline/obsolete-keywords.json @@ -13,7 +13,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [], "extAttrs": [], @@ -28,7 +28,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [], "extAttrs": [], diff --git a/test/syntax/baseline/overloading.json b/test/syntax/baseline/overloading.json index 0650762e..dc472b4c 100644 --- a/test/syntax/baseline/overloading.json +++ b/test/syntax/baseline/overloading.json @@ -29,7 +29,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [ { @@ -61,7 +61,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [ { @@ -102,7 +102,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [ { @@ -134,7 +134,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [ { @@ -205,7 +205,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [], "extAttrs": [], @@ -220,7 +220,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [ { diff --git a/test/syntax/baseline/record.json b/test/syntax/baseline/record.json index ec6d3de8..d54c0ae1 100644 --- a/test/syntax/baseline/record.json +++ b/test/syntax/baseline/record.json @@ -13,7 +13,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [ { diff --git a/test/syntax/baseline/reg-operations.json b/test/syntax/baseline/reg-operations.json index af8b6b5f..73cb6398 100644 --- a/test/syntax/baseline/reg-operations.json +++ b/test/syntax/baseline/reg-operations.json @@ -67,7 +67,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [ { @@ -99,7 +99,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [ { @@ -145,6 +145,6 @@ { "type": "eof", "value": "", - "trivia": "" + "trivia": "\n" } ] diff --git a/test/syntax/baseline/replaceable.json b/test/syntax/baseline/replaceable.json index dc252a79..d31f058d 100644 --- a/test/syntax/baseline/replaceable.json +++ b/test/syntax/baseline/replaceable.json @@ -35,7 +35,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [], "extAttrs": [], @@ -48,6 +48,6 @@ { "type": "eof", "value": "", - "trivia": "" + "trivia": "\n" } ] diff --git a/test/syntax/baseline/sequence.json b/test/syntax/baseline/sequence.json index b680df20..243b71ef 100644 --- a/test/syntax/baseline/sequence.json +++ b/test/syntax/baseline/sequence.json @@ -13,7 +13,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [ { @@ -87,7 +87,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [ { diff --git a/test/syntax/baseline/typesuffixes.json b/test/syntax/baseline/typesuffixes.json index 136486cc..1f66dd2b 100644 --- a/test/syntax/baseline/typesuffixes.json +++ b/test/syntax/baseline/typesuffixes.json @@ -13,7 +13,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [ { diff --git a/test/syntax/baseline/variadic-operations.json b/test/syntax/baseline/variadic-operations.json index 991ac502..a96b28d4 100644 --- a/test/syntax/baseline/variadic-operations.json +++ b/test/syntax/baseline/variadic-operations.json @@ -28,7 +28,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [ { @@ -60,7 +60,7 @@ "generic": "", "nullable": false, "union": false, - "idlType": "void" + "idlType": "undefined" }, "arguments": [ { @@ -90,6 +90,6 @@ { "type": "eof", "value": "", - "trivia": "" + "trivia": "\n" } ] diff --git a/test/syntax/idl/allowany.webidl b/test/syntax/idl/allowany.webidl index 2343bb96..3cf61650 100644 --- a/test/syntax/idl/allowany.webidl +++ b/test/syntax/idl/allowany.webidl @@ -1,6 +1,6 @@ // Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06 interface B { - void g(); - void g(B b); - void g([AllowAny] DOMString s); -}; \ No newline at end of file + undefined g(); + undefined g(B b); + undefined g([AllowAny] DOMString s); +}; diff --git a/test/syntax/idl/argument-constructor.webidl b/test/syntax/idl/argument-constructor.webidl index f8a94dc3..e6a984c3 100644 --- a/test/syntax/idl/argument-constructor.webidl +++ b/test/syntax/idl/argument-constructor.webidl @@ -1,4 +1,4 @@ [Exposed=Window] interface Foo { - void foo(object constructor); + undefined foo(object constructor); }; diff --git a/test/syntax/idl/argument-extattrs.webidl b/test/syntax/idl/argument-extattrs.webidl index 483b2b46..1578bf76 100644 --- a/test/syntax/idl/argument-extattrs.webidl +++ b/test/syntax/idl/argument-extattrs.webidl @@ -1,3 +1,3 @@ interface Foo { - void foo([ExtAttr] optional [Clamp] short argname); + undefined foo([ExtAttr] optional [Clamp] short argname); }; diff --git a/test/syntax/idl/async-name.webidl b/test/syntax/idl/async-name.webidl index 5c2b25e6..42a414ba 100644 --- a/test/syntax/idl/async-name.webidl +++ b/test/syntax/idl/async-name.webidl @@ -2,5 +2,5 @@ [Exposed=Window] interface Async { attribute boolean async; - void asyncOp(boolean async); + undefined asyncOp(boolean async); }; diff --git a/test/syntax/idl/callback.webidl b/test/syntax/idl/callback.webidl index adaf75e0..d1449925 100644 --- a/test/syntax/idl/callback.webidl +++ b/test/syntax/idl/callback.webidl @@ -1,7 +1,7 @@ -callback AsyncOperationCallback = void (DOMString status); +callback AsyncOperationCallback = undefined (DOMString status); callback interface EventHandler { - void eventOccurred(DOMString details); + undefined eventOccurred(DOMString details); }; callback SortCallback = boolean (any a, any b); diff --git a/test/syntax/idl/enum.webidl b/test/syntax/idl/enum.webidl index 9ea3d747..822bbe67 100644 --- a/test/syntax/idl/enum.webidl +++ b/test/syntax/idl/enum.webidl @@ -4,7 +4,7 @@ interface Meal { attribute MealType type; attribute float size; // in grams - void initialize(MealType type, float size); + undefined initialize(MealType type, float size); }; enum _AltMealType { "rice", "noodles", "other", }; diff --git a/test/syntax/idl/equivalent-decl.webidl b/test/syntax/idl/equivalent-decl.webidl index 6ffeb3c2..bb9d0c09 100644 --- a/test/syntax/idl/equivalent-decl.webidl +++ b/test/syntax/idl/equivalent-decl.webidl @@ -3,7 +3,7 @@ interface Dictionary { readonly attribute unsigned long propertyCount; getter float getProperty(DOMString propertyName); - setter void setProperty(DOMString propertyName, float propertyValue); + setter undefined setProperty(DOMString propertyName, float propertyValue); }; @@ -11,8 +11,8 @@ interface Dictionary2 { readonly attribute unsigned long propertyCount; float getProperty(DOMString propertyName); - void setProperty(DOMString propertyName, float propertyValue); + undefined setProperty(DOMString propertyName, float propertyValue); getter float (DOMString propertyName); - setter void (DOMString propertyName, float propertyValue); -}; \ No newline at end of file + setter undefined (DOMString propertyName, float propertyValue); +}; diff --git a/test/syntax/idl/getter-setter.webidl b/test/syntax/idl/getter-setter.webidl index bdf87e1c..8d6c25c9 100644 --- a/test/syntax/idl/getter-setter.webidl +++ b/test/syntax/idl/getter-setter.webidl @@ -3,5 +3,5 @@ interface Dictionary { readonly attribute unsigned long propertyCount; getter float (DOMString propertyName); - setter void (DOMString propertyName, float propertyValue); -}; \ No newline at end of file + setter undefined (DOMString propertyName, float propertyValue); +}; diff --git a/test/syntax/idl/identifier-qualified-names.webidl b/test/syntax/idl/identifier-qualified-names.webidl index c39f84b4..8255fb17 100644 --- a/test/syntax/idl/identifier-qualified-names.webidl +++ b/test/syntax/idl/identifier-qualified-names.webidl @@ -29,5 +29,5 @@ interface FooEventTarget { // Argument names allow some selected keywords - void addEventListener(EventListener? callback); + undefined addEventListener(EventListener? callback); }; diff --git a/test/syntax/idl/includes-name.webidl b/test/syntax/idl/includes-name.webidl index cb31431f..7c88a5ef 100644 --- a/test/syntax/idl/includes-name.webidl +++ b/test/syntax/idl/includes-name.webidl @@ -1,4 +1,4 @@ [Exposed=Window] interface Includes { - void includes(); + undefined includes(); }; diff --git a/test/syntax/idl/indexed-properties.webidl b/test/syntax/idl/indexed-properties.webidl index 4b8aa9e3..707200ba 100644 --- a/test/syntax/idl/indexed-properties.webidl +++ b/test/syntax/idl/indexed-properties.webidl @@ -3,10 +3,10 @@ interface OrderedMap { readonly attribute unsigned long size; getter any getByIndex(unsigned long index); - setter void setByIndex(unsigned long index, any value); - deleter void removeByIndex(unsigned long index); + setter undefined setByIndex(unsigned long index, any value); + deleter undefined removeByIndex(unsigned long index); getter any get(DOMString name); - setter void set(DOMString name, any value); - deleter void remove(DOMString name); + setter undefined set(DOMString name, any value); + deleter undefined remove(DOMString name); }; diff --git a/test/syntax/idl/nullableobjects.webidl b/test/syntax/idl/nullableobjects.webidl index 83d1d40b..32655b79 100644 --- a/test/syntax/idl/nullableobjects.webidl +++ b/test/syntax/idl/nullableobjects.webidl @@ -7,7 +7,7 @@ interface B { // ... }; interface C { - void f(A? x); - void f(B? x); + undefined f(A? x); + undefined f(B? x); -}; \ No newline at end of file +}; diff --git a/test/syntax/idl/obsolete-keywords.webidl b/test/syntax/idl/obsolete-keywords.webidl index 0d22c458..f482cf02 100644 --- a/test/syntax/idl/obsolete-keywords.webidl +++ b/test/syntax/idl/obsolete-keywords.webidl @@ -1,6 +1,6 @@ // Keywords that have been removed from the spec // can be used as an identifier interface Keywords { - void implements(); - void legacyiterable(); + undefined implements(); + undefined legacyiterable(); }; diff --git a/test/syntax/idl/overloading.webidl b/test/syntax/idl/overloading.webidl index 52d8d15c..0827bd05 100644 --- a/test/syntax/idl/overloading.webidl +++ b/test/syntax/idl/overloading.webidl @@ -8,13 +8,13 @@ interface B { }; interface C { - void f(A x); - void f(B x); + undefined f(A x); + undefined f(B x); }; interface D { - /* f1 */ void f(DOMString a); - /* f2 */ void f([AllowAny] DOMString a, DOMString b, float... c); - /* f3 */ void f(); - /* f4 */ void f(long a, DOMString b, optional DOMString c, float... d); + /* f1 */ undefined f(DOMString a); + /* f2 */ undefined f([AllowAny] DOMString a, DOMString b, float... c); + /* f3 */ undefined f(); + /* f4 */ undefined f(long a, DOMString b, optional DOMString c, float... d); }; diff --git a/test/syntax/idl/record.webidl b/test/syntax/idl/record.webidl index dbfad3af..19b59227 100644 --- a/test/syntax/idl/record.webidl +++ b/test/syntax/idl/record.webidl @@ -1,6 +1,6 @@ [Constructor(record init)] interface Foo { - void foo(sequence> param); + undefined foo(sequence> param); record bar(); }; diff --git a/test/syntax/idl/reg-operations.webidl b/test/syntax/idl/reg-operations.webidl index 338c8d42..1bc35b01 100644 --- a/test/syntax/idl/reg-operations.webidl +++ b/test/syntax/idl/reg-operations.webidl @@ -10,6 +10,6 @@ interface Button { boolean isMouseOver(); // Overloaded operations. - void setDimensions(Dimensions size); - void setDimensions(unsigned long width, unsigned long height); -}; \ No newline at end of file + undefined setDimensions(Dimensions size); + undefined setDimensions(unsigned long width, unsigned long height); +}; diff --git a/test/syntax/idl/replaceable.webidl b/test/syntax/idl/replaceable.webidl index c14d0c37..d04dd8fb 100644 --- a/test/syntax/idl/replaceable.webidl +++ b/test/syntax/idl/replaceable.webidl @@ -1,5 +1,5 @@ // Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06 interface Counter { [Replaceable] readonly attribute unsigned long value; - void increment(); -}; \ No newline at end of file + undefined increment(); +}; diff --git a/test/syntax/idl/sequence.webidl b/test/syntax/idl/sequence.webidl index b47c9822..76cfa763 100644 --- a/test/syntax/idl/sequence.webidl +++ b/test/syntax/idl/sequence.webidl @@ -1,7 +1,7 @@ // Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06 // edited to remove sequence as attributes, now invalid interface Canvas { - void drawPolygon(sequence coordinates); + undefined drawPolygon(sequence coordinates); sequence getInflectionPoints(); // ... }; @@ -9,5 +9,5 @@ interface Canvas { // Extracted from https://heycam.github.io/webidl/#idl-type-extended-attribute-associated-with on 2017-07-01 interface I { - void f1(sequence<[XAttr] long> arg); + undefined f1(sequence<[XAttr] long> arg); }; diff --git a/test/syntax/idl/typesuffixes.webidl b/test/syntax/idl/typesuffixes.webidl index beaaa872..0986f226 100644 --- a/test/syntax/idl/typesuffixes.webidl +++ b/test/syntax/idl/typesuffixes.webidl @@ -1,3 +1,3 @@ interface Suffixes { - void test(sequence? foo); + undefined test(sequence? foo); }; diff --git a/test/syntax/idl/variadic-operations.webidl b/test/syntax/idl/variadic-operations.webidl index 51fae4cc..4a811394 100644 --- a/test/syntax/idl/variadic-operations.webidl +++ b/test/syntax/idl/variadic-operations.webidl @@ -2,6 +2,6 @@ interface IntegerSet { readonly attribute unsigned long cardinality; - void union(long... ints); - void intersection(long... ints); -}; \ No newline at end of file + undefined union(long... ints); + undefined intersection(long... ints); +}; From 56376c1d74a5dfe965c73c05b6f82bb0e077fb6c Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Fri, 7 Aug 2020 00:03:24 +0200 Subject: [PATCH 3/5] update docs --- README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 53a964de..da8a56a7 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ # webidl2.js [![NPM version](https://badge.fury.io/js/webidl2.svg)](http://badge.fury.io/js/webidl2) [![Known Vulnerabilities](https://snyk.io/test/github/w3c/webidl2.js/badge.svg)](https://snyk.io/test/github/w3c/webidl2.js/) -[![Financial Contributors on Open Collective](https://opencollective.com/webidl2js/all/badge.svg?label=financial+contributors)](https://opencollective.com/webidl2js) +[![Financial Contributors on Open Collective](https://opencollective.com/webidl2js/all/badge.svg?label=financial+contributors)](https://opencollective.com/webidl2js) ## Purpose @@ -174,8 +174,8 @@ properties: * `message`: the error message with its context. Below is what it looks like. ``` Syntax error at line 1 in callback-noparen.webidl, since `callback YourCall`: - callback YourCall = void; - ^ Callback lacks parentheses for arguments + callback YourCall = undefined; + ^ Callback lacks parentheses for arguments ``` * `bareMessage`: the error message without any context description like below. ``` @@ -196,6 +196,7 @@ properties: * `no-cross-overload`: Overloading must be done within a single interface or namespace. * `no-constructible-global`: Interfaces with `[Global]` cannot have constructors. * `renamed-legacy`: Legacy extended attributes must use their new names. + * `replace-void`: `void` type is replaced by `undefined` type. * `input`: a short peek at the text at the point where the error happened * `tokens`: the five tokens at the point of error, as understood by the tokeniser (this is the same content as `input`, but seen from the tokeniser's point of view) @@ -339,7 +340,7 @@ A callback looks like this: "generic": "", "nullable": false, "union": false, - "idlType": "void", + "idlType": "undefined", "extAttrs": [] }, "arguments": [...], @@ -508,7 +509,7 @@ An operation looks like this: "generic": "", "nullable": false, "union": false, - "idlType": "void", + "idlType": "undefined", "extAttrs": [] }, "name": "intersection", From 4b4bf97a6329bffca8c8d1e4967cca2ffe3a6058 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Fri, 7 Aug 2020 01:19:57 +0200 Subject: [PATCH 4/5] add new test --- test/syntax/baseline/undefined.json | 82 +++++++++++++++++++++++++++++ test/syntax/idl/undefined.webidl | 5 ++ 2 files changed, 87 insertions(+) create mode 100644 test/syntax/baseline/undefined.json create mode 100644 test/syntax/idl/undefined.webidl diff --git a/test/syntax/baseline/undefined.json b/test/syntax/baseline/undefined.json new file mode 100644 index 00000000..8ce6fd91 --- /dev/null +++ b/test/syntax/baseline/undefined.json @@ -0,0 +1,82 @@ +[ + { + "type": "interface", + "name": "Foo", + "inheritance": null, + "members": [ + { + "type": "operation", + "name": "foo", + "idlType": { + "type": "return-type", + "extAttrs": [], + "generic": "", + "nullable": false, + "union": false, + "idlType": "undefined" + }, + "arguments": [], + "extAttrs": [], + "special": "" + }, + { + "type": "operation", + "name": "foo", + "idlType": { + "type": "return-type", + "extAttrs": [], + "generic": "Promise", + "nullable": false, + "union": false, + "idlType": [ + { + "type": "return-type", + "extAttrs": [], + "generic": "", + "nullable": false, + "union": true, + "idlType": [ + { + "type": null, + "extAttrs": [], + "generic": "", + "nullable": false, + "union": false, + "idlType": "DOMString" + }, + { + "type": null, + "extAttrs": [], + "generic": "", + "nullable": false, + "union": false, + "idlType": "undefined" + } + ] + } + ] + }, + "arguments": [], + "extAttrs": [], + "special": "" + } + ], + "extAttrs": [ + { + "type": "extended-attribute", + "name": "Exposed", + "rhs": { + "type": "identifier", + "value": "Window" + }, + "arguments": [] + } + ], + "partial": false + }, + { + "type": "eof", + "value": "", + "trivia": "\n" + } +] diff --git a/test/syntax/idl/undefined.webidl b/test/syntax/idl/undefined.webidl new file mode 100644 index 00000000..5ca81237 --- /dev/null +++ b/test/syntax/idl/undefined.webidl @@ -0,0 +1,5 @@ +[Exposed=Window] +interface Foo { + undefined foo(); + Promise<(DOMString or undefined)> foo(); +}; From 0d1ac91aa0ade541cfc75e2dc0a97f182f89cbea Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Fri, 7 Aug 2020 01:20:46 +0200 Subject: [PATCH 5/5] test update --- test/syntax/baseline/undefined.json | 34 ++++++++++++++++++++++++++++- test/syntax/idl/undefined.webidl | 3 ++- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/test/syntax/baseline/undefined.json b/test/syntax/baseline/undefined.json index 8ce6fd91..1cec5fce 100644 --- a/test/syntax/baseline/undefined.json +++ b/test/syntax/baseline/undefined.json @@ -21,7 +21,7 @@ }, { "type": "operation", - "name": "foo", + "name": "bar", "idlType": { "type": "return-type", "extAttrs": [], @@ -59,6 +59,38 @@ "arguments": [], "extAttrs": [], "special": "" + }, + { + "type": "operation", + "name": "baz", + "idlType": { + "type": "return-type", + "extAttrs": [], + "generic": "", + "nullable": false, + "union": false, + "idlType": "float" + }, + "arguments": [ + { + "type": "argument", + "name": "boo", + "extAttrs": [], + "idlType": { + "type": "argument-type", + "extAttrs": [], + "generic": "", + "nullable": false, + "union": false, + "idlType": "undefined" + }, + "default": null, + "optional": false, + "variadic": false + } + ], + "extAttrs": [], + "special": "" } ], "extAttrs": [ diff --git a/test/syntax/idl/undefined.webidl b/test/syntax/idl/undefined.webidl index 5ca81237..ae7b9632 100644 --- a/test/syntax/idl/undefined.webidl +++ b/test/syntax/idl/undefined.webidl @@ -1,5 +1,6 @@ [Exposed=Window] interface Foo { undefined foo(); - Promise<(DOMString or undefined)> foo(); + Promise<(DOMString or undefined)> bar(); + float baz(undefined boo); };