From 8d12cf54ec95c950278db9bd7e9eddd1fbba1ff2 Mon Sep 17 00:00:00 2001 From: Teiki RAIHAUTI Date: Thu, 24 Oct 2024 17:02:39 +1300 Subject: [PATCH 1/2] modify the assignment for list in c# --- .vscode/launch.json | 18 ++++++++++++++++++ .../transpiler/generators/csharpGenerator.py | 6 ++++-- 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..1edced7 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,18 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Python Debugger: Current File with Arguments", + "type": "debugpy", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal", + "args": [ + "${command:pickArgs}" + ] + } + ] +} \ No newline at end of file diff --git a/src/pycropml/transpiler/generators/csharpGenerator.py b/src/pycropml/transpiler/generators/csharpGenerator.py index 8a8ee4f..33df2e6 100644 --- a/src/pycropml/transpiler/generators/csharpGenerator.py +++ b/src/pycropml/transpiler/generators/csharpGenerator.py @@ -278,9 +278,11 @@ def visit_assignment(self, node): else: if node.target.type=="index" and node.target.sequence.pseudo_type[0]=="list": self.visit(node.target.sequence) - self.write(".Add(") + self.write("[") + self.visit(node.target.index) + self.write("]=") self.visit(node.value) - self.write(");") + self.write(";") elif node.value.type == "standard_call" and node.value.function=="integr": self.write("%s = new List<%s>(%s);"%(node.target.name,self.types[node.target.pseudo_type[1]], node.value.args[0].name)) From dbcbc47369399258997db29ca9d891c031822b39 Mon Sep 17 00:00:00 2001 From: Christophe Pradal Date: Fri, 25 Oct 2024 08:46:01 +1300 Subject: [PATCH 2/2] Delete .vscode/launch.json --- .vscode/launch.json | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 1edced7..0000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Python Debugger: Current File with Arguments", - "type": "debugpy", - "request": "launch", - "program": "${file}", - "console": "integratedTerminal", - "args": [ - "${command:pickArgs}" - ] - } - ] -} \ No newline at end of file