/// <summary> /// /// </summary> /// <param name="cont"></param> /// <returns></returns> public override bool Compile(DNET_EXECUTABLE_GENERATION_CONTEXT cont) { if (m_formals != null) { int i = 0; foreach (SYMBOL_INFO b in m_formals) { System.Type type = (b.Type == TYPE_INFO.TYPE_BOOL) ? typeof(bool) : (b.Type == TYPE_INFO.TYPE_NUMERIC) ? typeof(double) : typeof(string); int s = cont.DeclareLocal(type); b.loc_position = s; cont.TABLE.Add(b); cont.CodeOutput.Emit(OpCodes.Ldarg, i); cont.CodeOutput.Emit(OpCodes.Stloc, cont.GetLocal(s)); i++; } } foreach (Stmt e1 in m_statements) { e1.Compile(cont); } cont.CodeOutput.Emit(OpCodes.Ret); return(true); }
public override bool Compile(DNET_EXECUTABLE_GENERATION_CONTEXT cont) { if (!exp1.Compile(cont)) { throw new Exception("Compilation in error string"); } SYMBOL_INFO info = cont.TABLE.Get(variable.Name); LocalBuilder lb = cont.GetLocal(info.loc_position); cont.CodeOutput.Emit(OpCodes.Stloc, lb); return(true); }
/// <summary> /// /// </summary> /// <param name="cont"></param> /// <returns></returns> public override bool Compile(DNET_EXECUTABLE_GENERATION_CONTEXT cont) { // // Retrieve the Symbol information from the // Symbol Table. Symbol name is the key here.. // SYMBOL_INFO info = cont.TABLE.Get(m_name); // // Give the Position to retrieve the Local Variable // Builder. // LocalBuilder lb = cont.GetLocal(info.loc_position); // // LDLOC => Load Local... we need to give // a Local Builder as parameter // cont.CodeOutput.Emit(OpCodes.Ldloc, lb); return(true); }