コード例 #1
0
        protected internal override object ObtenerElObjeto()
        {
            if (!tablaDeSimbolos.ExisteLaVariable(instancia_Renamed))
            {
                throw new LanguageException("La variable '" + instancia_Renamed + "' es desconocida");
            }
            Objeto objetoInstancia = tablaDeSimbolos.Valor(instancia_Renamed);

            return((object)objetoInstancia);
        }
コード例 #2
0
ファイル: Id.cs プロジェクト: NcuboIdeas/EventSourcing
 internal override Type calcularTipo()
 {
     if (tablaDeSimbolos.ExisteLaVariable(id))
     {
         return(ejecutar().GetType());
     }
     else
     {
         return(Nulo.NULO.GetType());
     }
 }
コード例 #3
0
        public override void Ejecutar()
        {
            if (lValue is IdConPunto)
            {
                IdConPunto referencia = (IdConPunto)lValue;

                string instancia = referencia.instancia();
                if (!tablaDeSimbolos.ExisteLaVariable(instancia))
                {
                    throw new LanguageException(string.Format("No se ha definido la variable {0}. Verifique el nombre", instancia));
                }
                Objeto objeto = tablaDeSimbolos.Valor(instancia);
                Objeto valorDeLaExpresionDerecha = rValue.ejecutar();

                FieldInfo fieldInfo = ObtenerElFieldDelObjetoSiExiste();
                if (fieldInfo != null)
                {
                    fieldInfo.SetValue(objeto, ImplicitCast(UnBoxing(valorDeLaExpresionDerecha), fieldInfo.FieldType));
                    return;
                }

                PropertyInfo propertyInfo = ObtenerElPropertyDelObjetoSiExiste();
                if (propertyInfo != null)
                {
                    propertyInfo.SetValue(objeto, ImplicitCast(UnBoxing(valorDeLaExpresionDerecha), propertyInfo.PropertyType));
                    return;
                }
                else
                {
                    objeto.setAtributo(referencia.Propiedad(), valorDeLaExpresionDerecha);
                }
            }
            else if (lValue is PuntoConPunto)
            {
            }
            else
            {
                string nuevaVariable             = ((Id)lValue).Valor;
                Objeto valorDeLaExpresionDerecha = rValue.ejecutar();
                tablaDeSimbolos.GuardarVariable(nuevaVariable, valorDeLaExpresionDerecha);
            }
        }