chore(dotnet): handle setters and ordering bug (#5654)
This commit is contained in:
parent
6c9e806672
commit
86c7d77967
|
|
@ -30,7 +30,7 @@ Optional error code. Defaults to `failed`, could be one of the following:
|
||||||
|
|
||||||
## async method: Route.continue
|
## async method: Route.continue
|
||||||
* langs:
|
* langs:
|
||||||
- alias-csharp: resume
|
- alias-csharp: ResumeAsync
|
||||||
- alias-java: resume
|
- alias-java: resume
|
||||||
- alias-python: continue_
|
- alias-python: continue_
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -194,11 +194,6 @@ function translateMemberName(memberKind, name, member = null) {
|
||||||
// like, when generating classes inside methods for params
|
// like, when generating classes inside methods for params
|
||||||
name = name.replace(/[@-]/g, '');
|
name = name.replace(/[@-]/g, '');
|
||||||
|
|
||||||
// we sanitize some common abbreviations to ensure consistency
|
|
||||||
name = name.replace(/(HTTP[S]?)/g, (m, g) => {
|
|
||||||
return g[0].toUpperCase() + g.substring(1).toLowerCase();
|
|
||||||
});
|
|
||||||
|
|
||||||
if (memberKind === 'argument') {
|
if (memberKind === 'argument') {
|
||||||
if (['params', 'event'].includes(name)) { // just in case we want to add others
|
if (['params', 'event'].includes(name)) { // just in case we want to add others
|
||||||
return `@${name}`;
|
return `@${name}`;
|
||||||
|
|
@ -206,6 +201,7 @@ function translateMemberName(memberKind, name, member = null) {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if there's an alias in the docs, in which case
|
// check if there's an alias in the docs, in which case
|
||||||
// we return that, otherwise, we apply our dotnet magic to it
|
// we return that, otherwise, we apply our dotnet magic to it
|
||||||
if (member) {
|
if (member) {
|
||||||
|
|
@ -214,6 +210,11 @@ function translateMemberName(memberKind, name, member = null) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// we sanitize some common abbreviations to ensure consistency
|
||||||
|
name = name.replace(/(HTTP[S]?)/g, (m, g) => {
|
||||||
|
return g[0].toUpperCase() + g.substring(1).toLowerCase();
|
||||||
|
});
|
||||||
|
|
||||||
let assumedName = name.charAt(0).toUpperCase() + name.substring(1);
|
let assumedName = name.charAt(0).toUpperCase() + name.substring(1);
|
||||||
|
|
||||||
switch (memberKind) {
|
switch (memberKind) {
|
||||||
|
|
@ -384,11 +385,12 @@ function renderMethod(member, parent, output, name) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type = type || typeResolve(member.type); //translateType(member.type, parent);
|
type = type || typeResolve(member.type);
|
||||||
// TODO: this is something that will probably go into the docs
|
// TODO: this is something that will probably go into the docs
|
||||||
|
// translate simple getters into read-only properties, and simple
|
||||||
|
// set-only methods to settable properties
|
||||||
if (member.args.size == 0
|
if (member.args.size == 0
|
||||||
&& type !== 'void'
|
&& type !== 'void'
|
||||||
&& !name.startsWith('Is')
|
|
||||||
&& !name.startsWith('Get')) {
|
&& !name.startsWith('Get')) {
|
||||||
if (!member.async) {
|
if (!member.async) {
|
||||||
if (member.spec)
|
if (member.spec)
|
||||||
|
|
@ -397,6 +399,15 @@ function renderMethod(member, parent, output, name) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
name = `Get${name}`;
|
name = `Get${name}`;
|
||||||
|
} else if (member.args.size == 1
|
||||||
|
&& type === 'void'
|
||||||
|
&& name.startsWith('Set')
|
||||||
|
&& !member.async) {
|
||||||
|
name = name.substring(3); // remove the 'Set'
|
||||||
|
if (member.spec)
|
||||||
|
output(XmlDoc.renderXmlDoc(member.spec, maxDocumentationColumnWidth));
|
||||||
|
output(`${translateType(member.argsArray[0].type, parent)} ${name} { set; }`);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// HACK: special case for generics handling!
|
// HACK: special case for generics handling!
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue