mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
api(dotnet): use lists, not collections (#6746)
This commit is contained in:
parent
9b5bcba1d7
commit
24a2326031
@ -73,9 +73,6 @@ documentation.setLinkRenderer(item => {
|
|||||||
// get the template for a class
|
// get the template for a class
|
||||||
const template = fs.readFileSync(path.join(__dirname, 'templates', 'interface.cs'), 'utf-8');
|
const template = fs.readFileSync(path.join(__dirname, 'templates', 'interface.cs'), 'utf-8');
|
||||||
|
|
||||||
// we have some "predefined" types, like the mixed state enum, that we can map in advance
|
|
||||||
enumTypes.set("MixedState", ["On", "Off", "Mixed"]);
|
|
||||||
|
|
||||||
// map the name to a C# friendly one (we prepend an I to denote an interface)
|
// map the name to a C# friendly one (we prepend an I to denote an interface)
|
||||||
const classNameMap = new Map(documentation.classesArray.map(x => [x.name, `I${toTitleCase(x.name)}`]));
|
const classNameMap = new Map(documentation.classesArray.map(x => [x.name, `I${toTitleCase(x.name)}`]));
|
||||||
|
|
||||||
@ -532,7 +529,7 @@ function renderMethod(member, parent, name, options, out) {
|
|||||||
if (!type)
|
if (!type)
|
||||||
type = resolveType(innerType);
|
type = resolveType(innerType);
|
||||||
if (isArray)
|
if (isArray)
|
||||||
type = `IReadOnlyCollection<${type}>`;
|
type = `IReadOnlyList<${type}>`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -767,8 +764,6 @@ function translateType(type, parent, generateNameCallback = t => t.name, optiona
|
|||||||
// a few special cases we can fix automatically
|
// a few special cases we can fix automatically
|
||||||
if (type.expression === '[null]|[Error]')
|
if (type.expression === '[null]|[Error]')
|
||||||
return 'void';
|
return 'void';
|
||||||
else if (type.expression === '[boolean]|"mixed"')
|
|
||||||
return 'MixedState';
|
|
||||||
|
|
||||||
if (type.union) {
|
if (type.union) {
|
||||||
if (type.union[0].name === 'null' && type.union.length === 2)
|
if (type.union[0].name === 'null' && type.union.length === 2)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user