public NuevoProcedimiento(string nombre, Procedimiento procedimiento,int linea, int columna) { this.nombre = nombre; this.procedimiento = procedimiento; this.linea = linea; this.columna = columna; }
public override object ejecutar(Entorno entorno, Reporte reporte) { Funcion funcion = entorno.existeFuncion(nombre); if (funcion == null) { goto esProcedimiento; } //Comprobar variables if (funcion.varTipos.Count != valores.Count) { throw new util.ErrorPascal(0, 0, "Numero de entradas incorrectas para la funcion \"" + nombre + "\"", "semantico", reporte); } //Asignar los valores funcion.valoresParametros = valores; Simbolo retorno = (Simbolo)funcion.ejecutar(entorno, reporte); //Aca if (retorno == null) { throw new util.ErrorPascal(0, 0, "La funcion \"" + this.nombre + "\" no devolvio ningun valor", "semantico", reporte); } return(retorno); esProcedimiento: Procedimiento procedimiento = entorno.existeProcedimiento(nombre); if (procedimiento == null) { throw new util.ErrorPascal(0, 0, "La funcion/procedimiento \"" + nombre + "\" no existe", "semantico", reporte); } //Comprobar variables if (procedimiento.varTipos.Count != valores.Count) { throw new util.ErrorPascal(0, 0, "Numero de entradas incorrectas para la funcion \"" + nombre + "\"", "semantico", reporte); } //Asignar los valores procedimiento.valoresParametros = valores; procedimiento.ejecutar(entorno, reporte); //Aca return(null); }