Closed Bug 1582567 Opened 2 months ago Closed 2 months ago

webidl-example shouldn't generate virtual and override at the same time

Categories

(Core :: DOM: Bindings (WebIDL), defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla71
Tracking Status
firefox71 --- fixed

People

(Reporter: chunmin, Assigned: bzbarsky)

Details

Attachments

(1 file)

Given a .webidl file like

interface Foo {
  void bar();
};

The generated example .h file will have a function that marks virtual and override at the same time.

virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;

The virtual can be omitted if the function has override.

The virtual can be omitted if the function has override.

Not only can, but should: see https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style#Methods where is says:

Method declarations must use, at most, one of the following keywords: virtual, override, or final.

Priority: -- → P1

Should we clear this wrong pattern in the codebase either in this bug? For example, I see

virtual JSObject* WrapObject(JSContext* aCx,
                             JS::Handle<JSObject*> aGivenProto) override;

in DOMMediaStream.h

Pushed by bzbarsky@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/63c45794f766
Stop emitting 'virtual' in codegen if we're already emitting 'override'.  r=edgar
Status: NEW → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla71
Assignee: nobody → bzbarsky
You need to log in before you can comment on or make changes to this bug.