Use Argument[this] instead of Argument[-1]

This commit is contained in:
Anders Starcke Henriksen
2023-06-07 13:14:31 +02:00
parent e14b4c3040
commit 15c2a86725
2 changed files with 10 additions and 8 deletions

View File

@@ -53,6 +53,8 @@ export function createAutoModelRequest(
argumentIndex < numberOfArguments;
argumentIndex++
) {
const argumentInput: string =
argumentIndex === -1 ? "Argument[this]" : `Argument[${argumentIndex}]`;
const method: Method = {
package: externalApiUsage.packageName,
type: externalApiUsage.typeName,
@@ -63,7 +65,7 @@ export function createAutoModelRequest(
? undefined
: toMethodClassification(modeledMethod),
usages: usagesForMethod.slice(0, 6), // At most 6 usages per argument
input: `Argument[${argumentIndex}]`,
input: argumentInput,
};
// A method that is supported is modeled outside of the model file, so it is not a candidate.

View File

@@ -266,7 +266,7 @@ describe("createAutoModelRequest", () => {
explanation: "",
},
usages: usages["org.sql2o.Sql2o#open()"],
input: "Argument[-1]",
input: "Argument[this]",
},
{
package: "org.sql2o",
@@ -279,7 +279,7 @@ describe("createAutoModelRequest", () => {
explanation: "",
},
usages: usages["org.sql2o.Sql2o#Sql2o(String)"],
input: "Argument[-1]",
input: "Argument[this]",
},
{
package: "org.sql2o",
@@ -302,7 +302,7 @@ describe("createAutoModelRequest", () => {
name: "createQuery",
signature: "(String)",
usages: usages["org.sql2o.Connection#createQuery(String)"],
input: "Argument[-1]",
input: "Argument[this]",
classification: undefined,
},
{
@@ -320,7 +320,7 @@ describe("createAutoModelRequest", () => {
name: "executeScalar",
signature: "(Class)",
usages: usages["org.sql2o.Query#executeScalar(Class)"],
input: "Argument[-1]",
input: "Argument[this]",
classification: undefined,
},
{
@@ -341,7 +341,7 @@ describe("createAutoModelRequest", () => {
usages[
"org.springframework.boot.SpringApplication#run(Class,String[])"
],
input: "Argument[-1]",
input: "Argument[this]",
classification: undefined,
},
{
@@ -374,7 +374,7 @@ describe("createAutoModelRequest", () => {
name: "println",
signature: "(String)",
usages: usages["java.io.PrintStream#println(String)"],
input: "Argument[-1]",
input: "Argument[this]",
classification: undefined,
},
{
@@ -392,7 +392,7 @@ describe("createAutoModelRequest", () => {
name: "Sql2o",
signature: "(String,String,String)",
usages: usages["org.sql2o.Sql2o#Sql2o(String,String,String)"],
input: "Argument[-1]",
input: "Argument[this]",
classification: undefined,
},
{