Skip to content

Commit

Permalink
Merge pull request #3120 from sorig/enums
Browse files Browse the repository at this point in the history
Meta-Language: Fix C# enum translation rule and uncaught bugs in tran…
  • Loading branch information
karlnapf committed Mar 26, 2016
2 parents 161431c + 8be3005 commit 71c1eca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/meta/generator/targets/csharp.json
Expand Up @@ -48,7 +48,7 @@
"NumberLiteral": "$number",
"MethodCall": "$object.$method($arguments)",
"Identifier": "$identifier",
"Enum":"$value"
"Enum":"$type.$value"
},
"Print": "Console.Write($expr)",
"OutputDirectoryName": "csharp",
Expand Down
4 changes: 2 additions & 2 deletions examples/meta/generator/translate.py
Expand Up @@ -302,7 +302,7 @@ def translateExpr(self, expr):
# Add enum to dependencies in case they need to be imported explicitly
self.dependencies["Enums"].add((expr[key][0]["Identifier"], expr[key][1]["Identifier"]))
template = Template(self.targetDict["Expr"]["Enum"])
return template.substitute(type=expr[key][0],value=expr[key][1]["Identifier"])
return template.substitute(type=expr[key][0]["Identifier"],value=expr[key][1]["Identifier"])

raise Exception("Unknown expression type: " + key)

Expand Down Expand Up @@ -394,4 +394,4 @@ def loadTargetDict(targetJsonPath):
else:
programObject = json.load(sys.stdin)

print(translate(programObject, targetDict))
print(translate(programObject, targetDict, tags={}, storeVars=False))

0 comments on commit 71c1eca

Please sign in to comment.