Skip to content

Commit 9251697

Browse files
committed
no conflicted property
1 parent 01571a1 commit 9251697

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

src/emitter.ts

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -573,21 +573,12 @@ export function emitWebIdl(webidl: Browser.WebIdl, flavor: Flavor) {
573573
!!iNameToEhList[i.name].find(e => e.name === p.name));
574574
}
575575

576-
function emitProperty(prefix: string, i: Browser.Interface, emitScope: EmitScope, p: Browser.Property, conflictedMembers: Set<string>) {
577-
function printLine(content: string) {
578-
if (conflictedMembers.has(p.name)) {
579-
printer.printLineToStack(content);
580-
}
581-
else {
582-
printer.printLine(content);
583-
}
584-
}
585-
586-
emitComments(p, printLine);
576+
function emitProperty(prefix: string, i: Browser.Interface, emitScope: EmitScope, p: Browser.Property) {
577+
emitComments(p, printer.printLine);
587578

588579
// Treat window.name specially because of https://github.com/Microsoft/TypeScript/issues/9850
589580
if (p.name === "name" && i.name === "Window" && emitScope === EmitScope.All) {
590-
printLine("declare const name: never;");
581+
printer.printLine("declare const name: never;");
591582
}
592583
else {
593584
let pType: string;
@@ -610,7 +601,7 @@ export function emitWebIdl(webidl: Browser.WebIdl, flavor: Flavor) {
610601
const requiredModifier = p.required === undefined || p.required === 1 ? "" : "?";
611602
pType = p.nullable ? makeNullable(pType) : pType;
612603
const readOnlyModifier = p["read-only"] === 1 && prefix === "" ? "readonly " : "";
613-
printLine(`${prefix}${readOnlyModifier}${p.name}${requiredModifier}: ${pType};`);
604+
printer.printLine(`${prefix}${readOnlyModifier}${p.name}${requiredModifier}: ${pType};`);
614605
}
615606
}
616607

@@ -623,13 +614,13 @@ export function emitWebIdl(webidl: Browser.WebIdl, flavor: Flavor) {
623614
}
624615
}
625616

626-
function emitProperties(prefix: string, emitScope: EmitScope, i: Browser.Interface, conflictedMembers: Set<string>) {
617+
function emitProperties(prefix: string, emitScope: EmitScope, i: Browser.Interface) {
627618
if (i.properties) {
628619
mapToArray(i.properties.property)
629620
.filter(m => matchScope(emitScope, m))
630621
.filter(p => !isCovariantEventHandler(i, p))
631622
.sort(compareName)
632-
.forEach(p => emitProperty(prefix, i, emitScope, p, conflictedMembers));
623+
.forEach(p => emitProperty(prefix, i, emitScope, p));
633624
}
634625
}
635626

@@ -708,7 +699,7 @@ export function emitWebIdl(webidl: Browser.WebIdl, flavor: Flavor) {
708699
/// Emit the properties and methods of a given interface
709700
function emitMembers(prefix: string, emitScope: EmitScope, i: Browser.Interface) {
710701
const conflictedMembers = extendConflictsBaseTypes[i.name] ? extendConflictsBaseTypes[i.name].memberNames : new Set();
711-
emitProperties(prefix, emitScope, i, conflictedMembers);
702+
emitProperties(prefix, emitScope, i);
712703
const methodPrefix = prefix.startsWith("declare var") ? "declare function " : "";
713704
emitMethods(methodPrefix, emitScope, i, conflictedMembers);
714705
if (emitScope === EmitScope.InstanceOnly) {

0 commit comments

Comments
 (0)