Skip to content

Commit

Permalink
Merge pull request #131 from kasecato/#129/fix_params_keyword
Browse files Browse the repository at this point in the history
Fixed #129 params keyword
  • Loading branch information
kasecato authored May 21, 2022
2 parents 4ffeb63 + e04d0c2 commit 8e0c7ec
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/SyntacticAnalysis/SyntacticAnalysisCSharp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ export class SyntacticAnalysisCSharp {
const removedExtendsCode: string = removedAttrCode.replace(/:.+/, ''); // FIXME:
const removedLamdaCode: string = removedExtendsCode.replace(/=>.*/, ''); // FIXME:
const removedArrayCode: string = removedLamdaCode.replace(/\[.*?\]/g, ''); // FIXME:
const params: RegExpMatchArray = removedArrayCode.match(/\((.+)\)/s);
const removedParamsKeywordCode: string = removedArrayCode.replace(/params/g, ''); // FIXME:
const params: RegExpMatchArray = removedParamsKeywordCode.match(/\((.+)\)/s);

const isMatched = (params === null || params.length !== 2);
if (isMatched) return null;
Expand Down
18 changes: 12 additions & 6 deletions test/TestData/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
{
"version": "0.1.0",
"version": "2.0.0",
"command": "dotnet",
"isShellCommand": true,
"args": [],
"tasks": [
{
"taskName": "build",
"args": [],
"isBuildCommand": true,
"problemMatcher": "$msCompile"
"label": "build",
"type": "shell",
"command": "dotnet",
"args": [
"build"
],
"problemMatcher": "$msCompile",
"group": {
"_id": "build",
"isDefault": false
}
}
]
}
12 changes: 12 additions & 0 deletions test/TestData/X.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,18 @@ bool ArgsValid(
IReadOnlyList<(string name, string value)> namedArgs,
IReadOnlyList<string> argNames
) { }

public static Vector2 averageAcceleration(params (float, Vector2)[] bodies, params object[] list, string value)
{
Vector2 finalAcceleration = Vector2.zero;

for (int i = 0; i < bodies.Length; i++)
{
finalAcceleration += accelearation(bodies[i].Item1, bodies[i].Item2);
}

return finalAcceleration;
}
}

namespace ns {
Expand Down

0 comments on commit 8e0c7ec

Please sign in to comment.