コード例 #1
0
        public override void VisitMemberHandleExpression(MemberHandleExpression node)
        {
            WriteKeyword("__ldtoken__");
            WriteToken("(");

            if (node.MemberReference is MethodReference)
            {
                MethodReference methodRef = node.MemberReference as MethodReference;
                WriteReference(GetTypeName(methodRef.DeclaringType), methodRef.DeclaringType);
                WriteToken(".");
                WriteReference(GetMethodName(methodRef), methodRef);
            }
            else if (node.MemberReference is FieldReference)
            {
                FieldReference fieldRef = node.MemberReference as FieldReference;
                WriteReference(GetTypeName(fieldRef.DeclaringType), fieldRef.DeclaringType);
                WriteToken(".");
                WriteReference(GetFieldName(fieldRef), fieldRef);
            }
            else if (node.MemberReference is TypeReference)
            {
                TypeReference typeRef = node.MemberReference as TypeReference;
                WriteReference(GetTypeName(typeRef), typeRef);
            }
            else
            {
                Write(string.Format("Invalid member reference: {0} {1}.", node.MemberReference.GetType(), node.MemberReference.FullName));
            }

            WriteToken(")");
        }
 private bool TryFillInitializer(ArrayCreationExpression expression, MemberHandleExpression values)
 {
     if (!(values.MemberReference is FieldDefinition))
     {
         return false;
     }
     ExpressionCollection convertedExpressions = ConvertInitialValues((values.MemberReference as FieldDefinition).InitialValue, expression.ElementType.Name);
     if(convertedExpressions == null || CheckElementsCount(convertedExpressions, expression.Dimensions) == false)
     {
         return false;
     }
     RebuildDimensions(ref convertedExpressions, expression.Dimensions);
     expression.Initializer.Expressions = convertedExpressions;
     return true;
 }
コード例 #3
0
 public override void VisitMemberHandleExpression(MemberHandleExpression node)
 {
     throw new NotSupportedException();
 }
コード例 #4
0
 public virtual void VisitMemberHandleExpression(MemberHandleExpression node)
 {
 }
コード例 #5
0
        public override bool Equals(Expression other)
        {
            MemberHandleExpression otherExpression = other as MemberHandleExpression;

            return(otherExpression != null && this.MemberReference.FullName == otherExpression.MemberReference.FullName);
        }