private void Generate_Macro_UsingBody(GMacMacro macro, CommandBlock macroBody) { Log.AppendAtNewLine("macro "); Log.Append(macro.SymbolAccessName); Log.AppendLine("("); Log.IncreaseIndentation(); var flag = false; foreach (var parameter in macro.Parameters) { if (flag) { Log.Append(", "); } else { flag = true; } if (parameter.DirectionOut) { Log.AppendAtNewLine("out " + parameter.ObjectName); } else { Log.AppendAtNewLine(parameter.ObjectName); } Log.Append(" : "); Log.Append(parameter.SymbolTypeSignature); } Log.DecreaseIndentation(); Log.AppendAtNewLine(")"); macroBody.AcceptVisitor(this); Log.AppendLineAtNewLine(); }
internal static CommandBlock Compile(CommandBlock macroCommandBlock) { if (!(macroCommandBlock.ParentLanguageSymbol is GMacMacro)) { throw new InvalidOperationException("The given command block is not a macro body"); } var baseMacro = (GMacMacro)macroCommandBlock.ParentLanguageSymbol; var compiler = new HlMacroBodyCompiler(baseMacro); compiler._compiledBlock = CommandBlock.Create(compiler.BaseMacro); foreach (var param in compiler.BaseMacro.Parameters) { compiler.ActiveAr.AddSymbolData(param, param); } macroCommandBlock.AcceptVisitor(compiler); return(compiler._compiledBlock); }