public string Transpile(CompilerContext context) { var code = new StringBuilder(); if (IsVariableCreation) { code.AppendLine( $"{TypeConverter.WhileToCSharp(CompilerScope.GetVariableType(VariableName))} {VariableName};"); } code.AppendLine($"{VariableName} = {Value.Transpile(context)};"); return(code.ToString()); }
public Emit <Func <int> > EmitByteCode(CompilerContext context, Emit <Func <int> > emiter) { Local local = null; if (IsVariableCreation) { local = emiter.DeclareLocal(TypeConverter.WhileToType(CompilerScope.GetVariableType(VariableName)), VariableName); } else { local = emiter.Locals[VariableName]; } Value.EmitByteCode(context, emiter); emiter.StoreLocal(local); return(emiter); }