public override void VisitTypeofExpression <TTypeReference>(ITypeofExpression <TTypeReference> typeofExpression)
 {
     Steps.Add(new WriteTypeofKeyword());
     Steps.Add(new WriteStartParenthesis());
     Steps.Add(new WriteChildNode <TTypeReference>(typeofExpression.Type));
     Steps.Add(new WriteEndParenthesis());
 }
Ejemplo n.º 2
0
 public override void VisitTypeofExpression <TTypeReference>(ITypeofExpression <TTypeReference> typeofExpression)
 {
     Value = new Expression()
     {
         TypeofExpression = new TypeofExpressionFactory(typeofExpression).Value
     };
 }
        private static ITypeElement GetTypeof(ITypeofExpression typeofExpression)
        {
            if (typeofExpression != null)
            {
                var scalarType = typeofExpression.ArgumentType.GetScalarType();
                if (scalarType != null)
                    return scalarType.GetTypeElement();
            }

            return null;
        }
Ejemplo n.º 4
0
        private static ITypeElement GetTypeof(ITypeofExpression typeofExpression)
        {
            if (typeofExpression != null)
            {
                var scalarType = typeofExpression.ArgumentType.GetScalarType();
                if (scalarType != null)
                {
                    return(scalarType.GetTypeElement());
                }
            }

            return(null);
        }
Ejemplo n.º 5
0
            public override Expression VisitTypeofExpression(ITypeofExpression typeofExpressionParam, IMetadataResolver context)
            {
                IDeclaredType declaredType = typeofExpressionParam.ArgumentType.GetScalarType();

                if (declaredType == null || !declaredType.IsValid())
                {
                    return(base.VisitTypeofExpression(typeofExpressionParam, context));
                }

                string assemblyName = GetTypeAssemblyFullName(declaredType);

#if DEBUG
                if (string.IsNullOrWhiteSpace(assemblyName))
                {
                    Console.WriteLine(assemblyName);
                }
#endif

                string fullyQualifiedTypeName = string.Format("{0}, {1}", declaredType.GetClrName().FullName, assemblyName);

                Type value = Type.GetType(fullyQualifiedTypeName);

                return(Expression.Constant(value, typeof(Type)));
            }
 public virtual void VisitTypeofExpression <TTypeReference>(ITypeofExpression <TTypeReference> typeofExpression)
     where TTypeReference : ITypeReference
 {
     Visit(typeofExpression);
 }
 public override IAssignableExpression VisitTypeofExpression(ITypeofExpression expr, IList <IStatement> body)
 {
     return(new ConstantValueExpression {
         Value = ConstantValueExpression.Typeof
     });
 }