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; }
public override void VisitMemberHandleExpression(MemberHandleExpression node) { throw new NotSupportedException(); }
public virtual void VisitMemberHandleExpression(MemberHandleExpression node) { }
public override bool Equals(Expression other) { MemberHandleExpression otherExpression = other as MemberHandleExpression; return(otherExpression != null && this.MemberReference.FullName == otherExpression.MemberReference.FullName); }