From 5a6390d33bc347056943ccadbea1fed16f626dac Mon Sep 17 00:00:00 2001 From: Aman Goel Date: Thu, 18 Apr 2024 23:58:25 +0000 Subject: [PATCH] [PExplicit] Correct local var names in IR --- .../CompilerCore/Backend/PExplicit/CompilationContext.cs | 4 ++-- .../CompilerCore/Backend/PExplicit/PExplicitCodeGenerator.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Src/PCompiler/CompilerCore/Backend/PExplicit/CompilationContext.cs b/Src/PCompiler/CompilerCore/Backend/PExplicit/CompilationContext.cs index 3e1f98af4..fb7982cb6 100644 --- a/Src/PCompiler/CompilerCore/Backend/PExplicit/CompilationContext.cs +++ b/Src/PCompiler/CompilerCore/Backend/PExplicit/CompilationContext.cs @@ -92,14 +92,14 @@ internal object GetMachineName(Machine machine) internal static string GetVar(string rawName) { - return $"{rawName}"; + return $"var_{rawName}"; } internal string FreshTempVar() { var id = nextTempVarId; nextTempVarId++; - return $"temp_{id}"; + return $"temp_var_{id}"; } private static bool IsAsciiAlphabetic(char c) diff --git a/Src/PCompiler/CompilerCore/Backend/PExplicit/PExplicitCodeGenerator.cs b/Src/PCompiler/CompilerCore/Backend/PExplicit/PExplicitCodeGenerator.cs index 637e107e9..e23847801 100644 --- a/Src/PCompiler/CompilerCore/Backend/PExplicit/PExplicitCodeGenerator.cs +++ b/Src/PCompiler/CompilerCore/Backend/PExplicit/PExplicitCodeGenerator.cs @@ -1071,7 +1071,7 @@ private void WriteContinuation(CompilationContext context, StringWriter output, var arg =caseFun.Signature.Parameters[0]; var argValue = new Variable($"{arg.Name}_payload", continuation.SourceLocation, VariableRole.Param); argValue.Type = PrimitiveType.Any; - context.WriteLine(output, $"PValue {arg.Name}_payload = {messageName}.getPayload();"); + context.WriteLine(output, $"PValue var_{arg.Name}_payload = {messageName}.getPayload();"); var assignMsg = new AssignStmt(continuation.SourceLocation, new VariableAccessExpr(continuation.SourceLocation, arg), new VariableAccessExpr(continuation.SourceLocation, argValue)); context.WriteLine(output, $"{GetPExplicitType(arg.Type)} {CompilationContext.GetVar(arg.Name)} = {GetDefaultValue(arg.Type)};"); WriteStmt(continuation, context, output, caseContext, assignMsg);