Пример #1
0
 internal override Type calcularTipo()
 {
     if (e1.calcularTipo().Equals(typeof(Numero)) && e2.calcularTipo().Equals(typeof(Numero)))
     {
         return(typeof(Numero));
     }
     else if (e1.calcularTipo().Equals(typeof(Decimal)) && e2.calcularTipo().Equals(typeof(Numero)))
     {
         return(typeof(Decimal));
     }
     else if (e1.calcularTipo().Equals(typeof(Numero)) && e2.calcularTipo().Equals(typeof(Decimal)))
     {
         return(typeof(Decimal));
     }
     else if (e1.calcularTipo().Equals(typeof(Decimal)) && e2.calcularTipo().Equals(typeof(Decimal)))
     {
         return(typeof(Decimal));
     }
     else if (typeof(Moneda).IsSubclassOf(e1.calcularTipo()) && e1.calcularTipo().Equals(e2.calcularTipo()))
     {
         return(e1.calcularTipo());
     }
     else if (e1.calcularTipo().Equals(typeof(Hilera)) || this.CoersionHilera)
     {
         return(typeof(Hilera));
     }
     return(typeof(Objeto));
 }
Пример #2
0
 internal override Type calcularTipo()
 {
     if (e.calcularTipo().Equals(typeof(Decimal)) || e.calcularTipo().Equals(typeof(Numero)) || typeof(Moneda).IsSubclassOf(e.calcularTipo()))
     {
         return(e.calcularTipo());
     }
     return(typeof(Objeto));
 }
Пример #3
0
 internal override void validarEstaticamente()
 {
     if (!e.calcularTipo().Equals(typeof(EventSourcing.Libraries.Boolean)))
     {
         throw new LanguageException(string.Format("La expresi�n {0} al lado derecho del NOT debe retornar un valor true o false.", e.GetType().Name));
     }
 }
Пример #4
0
        internal override Type calcularTipo()
        {
            Type tipoE1 = e1.calcularTipo();
            Type tipoE2 = e2.calcularTipo();

            if (tipoE1.Equals(typeof(Numero)) && tipoE2.Equals(typeof(Numero)))
            {
                return(typeof(Numero));
            }
            else if (tipoE1.Equals(typeof(Decimal)) && tipoE2.Equals(typeof(Decimal)))
            {
                return(typeof(Decimal));
            }
            else if (typeof(Moneda).IsAssignableFrom(tipoE1) || tipoE2.Equals(typeof(Decimal)))
            {
                return(tipoE1);
            }
            else if (typeof(Moneda).IsAssignableFrom(tipoE2) || tipoE1.Equals(typeof(Decimal)))
            {
                return(tipoE2);
            }
            else if (typeof(Moneda).IsAssignableFrom(tipoE1) || tipoE2.Equals(typeof(Numero)))
            {
                return(tipoE1);
            }
            else if (typeof(Moneda).IsAssignableFrom(tipoE2) || tipoE1.Equals(typeof(Numero)))
            {
                return(tipoE2);
            }
            return(typeof(Objeto));
        }
Пример #5
0
        public override void ValidarEstaticamente()
        {
            expresion.validarEstaticamente();
            Type tipoExpresion = expresion.calcularTipo();

            if (tipoExpresion != typeof(Hilera))
            {
                throw new LanguageException("Sólo es posible ejecutar un Eval cuando la expresión es de tipo Hilera");
            }
        }
Пример #6
0
        public override void ValidarEstaticamente()
        {
            Type tipoExpresion = expression.calcularTipo();

            if (tipoExpresion.Equals(typeof(void)))
            {
                throw new LanguageException(string.Format("Al parecer intenta mostar un procedimiento o accion, pero que el comando show solo permite mostrar valores"));
            }
            expression.validarEstaticamente();
        }
Пример #7
0
        public override void ValidarEstaticamente()
        {
            expresion.validarEstaticamente();
            Type tipoExpresion = expresion.calcularTipo();

            if (!tipoExpresion.Equals(typeof(Lista)))
            {
                throw new LanguageException("Sólo es posible ejecutar un For cuando la expresión es de tipo Lista");
            }
            tablaDeSimbolos.AbrirBloque();
            cuerpo.ValidarEstaticamente();
            tablaDeSimbolos.CerrarBloque();
        }
Пример #8
0
 private Type[] ObtenerFirmaDeArgumentos()
 {
     Type[] firmas = new Type[0];
     if (argumentos_Renamed != null)
     {
         firmas = new Type[argumentos_Renamed.Length];
         for (int i = 0; i < argumentos_Renamed.Length; i++)
         {
             Expresion e = argumentos_Renamed[i];
             firmas[i] = e.calcularTipo();
         }
     }
     return(firmas);
 }
Пример #9
0
        public override void ValidarEstaticamente()
        {
            expresion.validarEstaticamente();
            Type tipoExpresion = expresion.calcularTipo();

            if (tipoExpresion != typeof(Puppeteer.EventSourcing.Libraries.Boolean))
            {
                throw new LanguageException("Sólo es posible ejecutar un IF cuando la expresión es de tipo Boolean");
            }
            comandosDelIf.ValidarEstaticamente();
            if (comandosDelElse != null)
            {
                comandosDelElse.ValidarEstaticamente();
            }
        }
Пример #10
0
 public override void ValidarEstaticamente()
 {
     if (expresion is NuevaInstancia)
     {
         string nombreProcedimiento = ((NuevaInstancia)expresion).Clase();
         if (!tablaDeSimbolos.ExisteLaDeclaracion(nombreProcedimiento))
         {
             throw new LanguageException(string.Format("No se encontró declarado el procedimiento {0}, debe declararlo primero.", nombreProcedimiento));
         }
     }
     else
     {
         Type tipoExpresion = expresion.calcularTipo();
         expresion.validarEstaticamente();
         if (!tipoExpresion.Equals(typeof(EventSourcing.Libraries.Void)))
         {
             throw new LanguageException(string.Format("Sólo es posible ejecutar procedimientos pero se está intentando ejecutar erróneamente un valor de tipo {0}", tipoExpresion.FullName));
         }
     }
 }