Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/build/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,7 @@ export function emitWebIdl(
printer.printLine("/** @deprecated */");
printer.printLine("declare const name: void;");
} else {
const propertyName = p.name.includes("-") ? `"${p.name}"` : p.name;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this before optionalModifier so that it's closer to where it's used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done @saschanaz

let pType: string;
if (!p.overrideType && isEventHandler(p)) {
// Sometimes event handlers with the same name may actually handle different
Expand All @@ -884,7 +885,9 @@ export function emitWebIdl(
const canPutForward =
compilerBehavior.allowUnrelatedSetterType || !p.readonly;
if (!prefix && canPutForward && p.putForwards) {
printer.printLine(`get ${p.name}${optionalModifier}(): ${pType};`);
printer.printLine(
`get ${propertyName}${optionalModifier}(): ${pType};`,
);

const forwardingProperty = getPropertyFromInterface(
allInterfacesMap[pType],
Expand All @@ -898,12 +901,12 @@ export function emitWebIdl(
setterType += ` | ${pType}`;
}
printer.printLine(
`set ${p.name}${optionalModifier}(${p.putForwards}: ${setterType});`,
`set ${propertyName}${optionalModifier}(${p.putForwards}: ${setterType});`,
);
} else {
const readOnlyModifier = p.readonly && prefix === "" ? "readonly " : "";
printer.printLine(
`${prefix}${readOnlyModifier}${p.name}${optionalModifier}: ${pType};`,
`${prefix}${readOnlyModifier}${propertyName}${optionalModifier}: ${pType};`,
);
}
}
Expand Down