public override void VisitFieldReferenceExpression(FieldReferenceExpression node)
 {
     if (node.Field.Resolve() == theField)
     {
         this.searchResult = UsageFinderSearchResult.Used;
     }
 }
        private bool CheckFieldReferenceExpression(FieldReferenceExpression fieldRefExpression)
        {
            if (fieldRefExpression.Field == null)
            {
                return false;
            }

            if (propertyFieldDef != null)
            {
                return fieldRefExpression.Field.Resolve() == this.propertyFieldDef;
            }

            FieldDefinition fieldDef = fieldRefExpression.Field.Resolve();
            if (fieldDef == null || fieldDef.DeclaringType != propertyDef.DeclaringType)
            {
                return false;
            }

            if (!fieldDef.HasCompilerGeneratedAttribute())
            {
                return false;
            }

            propertyFieldDef = fieldDef;
            return true;
        }
		public ArrayAssignmentFieldReferenceExpression(FieldReferenceExpression field, TypeReference arrayType, ExpressionCollection dimensions, bool hasInitializer, IEnumerable<Instruction> instructions) 
			: base(instructions)
		{
			this.Field = field;
			this.ArrayType = arrayType;
			this.Dimensions = dimensions;
			this.HasInitializer = hasInitializer;
		}
 public ArrayAssignmentFieldReferenceExpression(FieldReferenceExpression field, TypeReference arrayType, ExpressionCollection dimensions, bool hasInitializer, IEnumerable <Instruction> instructions)
 {
     base(instructions);
     this.set_Field(field);
     this.set_ArrayType(arrayType);
     this.set_Dimensions(dimensions);
     this.set_HasInitializer(hasInitializer);
     return;
 }
        public override ICodeNode VisitFieldReferenceExpression(FieldReferenceExpression node)
        {
            ICodeNode result = base.VisitFieldReferenceExpression(node);
            if (result.CodeNodeType == CodeNodeType.VariableReferenceExpression)
            {
                return Visit(result);
            }

            return result;
        }
        public ICodeNode VisitFieldReferenceExpression(FieldReferenceExpression node)
        {
            PropertyDefinition property;
            if (IsAutoPropertyConstructorInitializerExpression(node.Field, out property))
            {
                return new AutoPropertyConstructorInitializerExpression(property, node.Target, node.MappedInstructions);
            }

            return node;
        }
        public override ICodeNode VisitFieldReferenceExpression(FieldReferenceExpression node)
        {
            Expression fieldValue;
            FieldDefinition theFieldDef = node.Field.Resolve();
            if (theFieldDef != null && fieldsToRemove.TryGetValue(theFieldDef, out fieldValue))
            {
                return fieldValue.CloneExpressionOnlyAndAttachInstructions(node.UnderlyingSameMethodInstructions);
            }

            return base.VisitFieldReferenceExpression(node);
        }
        public override Expression CloneExpressionOnly()
        {
            Expression clonedTarget = Target != null?Target.CloneExpressionOnly() : null;

            FieldReferenceExpression result = new FieldReferenceExpression(clonedTarget, this.Field, null)
            {
                IsSimpleStore = this.IsSimpleStore
            };

            return(result);
        }
 public override Expression CloneExpressionOnly()
 {
     if (this.get_Target() != null)
     {
         stackVariable4 = this.get_Target().CloneExpressionOnly();
     }
     else
     {
         stackVariable4 = null;
     }
     stackVariable8 = new FieldReferenceExpression(stackVariable4, this.get_Field(), null);
     stackVariable8.set_IsSimpleStore(this.get_IsSimpleStore());
     return(stackVariable8);
 }
 public override Expression Clone()
 {
     if (this.get_Target() != null)
     {
         stackVariable4 = this.get_Target().Clone();
     }
     else
     {
         stackVariable4 = null;
     }
     stackVariable9 = new FieldReferenceExpression(stackVariable4, this.get_Field(), this.instructions);
     stackVariable9.set_IsSimpleStore(this.get_IsSimpleStore());
     return(stackVariable9);
 }
        public override bool Equals(Expression other)
        {
            if (!(other is FieldReferenceExpression))
            {
                return(false);
            }
            FieldReferenceExpression fieldRef = other as FieldReferenceExpression;

            if (this.Target == null)
            {
                if (fieldRef.Target != null)
                {
                    return(false);
                }
            }
            else if (!this.Target.Equals(fieldRef.Target))
            {
                return(false);
            }
            return(this.Field.FullName == fieldRef.Field.FullName);
        }
		public override void VisitFieldReferenceExpression(FieldReferenceExpression node)
		{
			if (node.Target != null)
			{
				bool isComplexTarget = IsComplexTarget(node.Target);
				if (isComplexTarget)
				{
					WriteToken("(");
				}

				Visit(node.Target);

				if (isComplexTarget)
				{
					WriteToken(")");
				}
			}
			else
			{
				WriteReferenceAndNamespaceIfInCollision(node.Field.DeclaringType);
			}

			WriteToken(".");
			WriteFieldName(node.Field);
		}
        public override ICodeNode VisitFieldReferenceExpression(FieldReferenceExpression node)
        {
            if (Method.IsConstructor && node.Field.DeclaringType.FullName == Method.DeclaringType.FullName)
            {
                return propertyRecognizer.VisitFieldReferenceExpression(node);
            }

            return base.VisitFieldReferenceExpression(node);
        }
 public override Expression CloneExpressionOnly()
 {
     Expression clonedTarget = Target != null ? Target.CloneExpressionOnly() : null;
     FieldReferenceExpression result = new FieldReferenceExpression(clonedTarget, this.Field, null) { IsSimpleStore = this.IsSimpleStore };
     return result;
 }
		public override void VisitFieldReferenceExpression(FieldReferenceExpression node)
		{
			TypesDependingOn.UnionWith(Utilities.GetTypeReferenceTypesDepedningOn(node.Field.DeclaringType));
			base.VisitFieldReferenceExpression(node);
		}
            public override ICodeNode VisitFieldReferenceExpression(FieldReferenceExpression node)
            {
                if (node.Target != null && node.Target.CodeNodeType == CodeNodeType.VariableReferenceExpression)
                {
                    VariableReference variable = (node.Target as VariableReferenceExpression).Variable;
                    Dictionary<FieldDefinition, Expression> fieldToExpressionMap;
                    if (this.methodContext.ClosureVariableToFieldValue.TryGetValue(variable, out fieldToExpressionMap))
                    {
                        FieldDefinition fieldDef = node.Field.Resolve();
                        Expression result;
                        if (fieldDef != null && fieldToExpressionMap.TryGetValue(fieldDef, out result))
                        {
                            return result.CloneExpressionOnly();
                        }
                    }
                }

                return base.VisitFieldReferenceExpression(node);
            }
		public override void VisitFieldReferenceExpression(FieldReferenceExpression node)
        {
            if (node.Target is TypeReferenceExpression)
            {
                var typeReference = ((TypeReferenceExpression)node.Target).Type;
                if (typeReference is TypeDefinition)
                {
                    var typeDefinition = (TypeDefinition)typeReference;
                    if (typeDefinition.IsEnum)
                    {
                        base.VisitFieldReferenceExpression(node);
						return;
                    }
                }
            }

            FieldDefinition field = node.Field.Resolve();
            string fieldName;
            if (field != null && this.typeContext.BackingFieldToNameMap.ContainsKey(field))
            {
                fieldName = this.typeContext.BackingFieldToNameMap[field];
            }
            else
            {
                fieldName = node.Field.Name;
            }

            TrySetPendingName(fieldName, true);

            base.VisitFieldReferenceExpression(node);
        }
        public override ICodeNode VisitFieldReferenceExpression(FieldReferenceExpression node)
        {
            if (node.Field.DeclaringType.Resolve() != stateMachineTypeDef)
            {
                return base.VisitFieldReferenceExpression(node);
            }

            FieldDefinition fieldDef = node.Field.Resolve();
            if (parameterMappings.ContainsKey(fieldDef))
            {
                return parameterMappings[fieldDef].CloneExpressionOnlyAndAttachInstructions(node.UnderlyingSameMethodInstructions);
            }

            VariableDefinition variableDefinition = new VariableDefinition(GetFriendlyName(fieldDef.Name), fieldDef.FieldType);
            this.methodContext.Variables.Add(variableDefinition);
            this.methodContext.VariableAssignmentData.Add(variableDefinition, asyncData.FieldAssignmentData[fieldDef]);
            this.methodContext.VariablesToRename.Add(variableDefinition);

            VariableReferenceExpression variableReferenceExpression = new VariableReferenceExpression(variableDefinition, node.UnderlyingSameMethodInstructions);
            parameterMappings[fieldDef] = variableReferenceExpression;
            return variableReferenceExpression;
        }
 public virtual void VisitFieldReferenceExpression(FieldReferenceExpression node)
 {
     Visit(node.Target);
 }
 public override ICodeNode VisitFieldReferenceExpression(FieldReferenceExpression node)
 {
     node.Target = (Expression)VisitTargetExpression(node.Target);
     return node;
 }
 private void CheckFieldReference(FieldReferenceExpression node)
 {
     if(node != assignedReference && node.Target != null && node.Target.CodeNodeType == CodeNodeType.VariableReferenceExpression &&
         delegateVariableCopies.Contains((node.Target as VariableReferenceExpression).Variable) && node.Field.Resolve() == this.fieldDef)
     {
         this.foundUsage = true;
     }
 }
 public bool CheckForAnotherAssignment(FieldDefinition fieldDef, FieldReferenceExpression assignedReference,
     HashSet<VariableReference> delegateVariableCopies)
 {
     this.fieldDef = fieldDef;
     this.assignedReference = assignedReference;
     this.delegateVariableCopies = delegateVariableCopies;
     this.foundUsage = false;
     base.Visit(theBlockStatement);
     return foundUsage;
 }
            public override ICodeNode VisitFieldReferenceExpression(FieldReferenceExpression node)
            {
                if (state == State.ReplaceFields)
                {
                    Expression value;
                    FieldDefinition resolvedField = node.Field.Resolve();
                    if (resolvedField == null)
                    {
                        return base.VisitFieldReferenceExpression(node);
                    }

                    if (fieldDefToAssignedValueMap.TryGetValue(resolvedField, out value))
                    {
                        return value.CloneExpressionOnlyAndAttachInstructions(node.UnderlyingSameMethodInstructions);
                    }

                    base.VisitFieldReferenceExpression(node);
                    if (node.Target == null || node.Target.CodeNodeType != CodeNodeType.VariableReferenceExpression)
                    {
                        return node;
                    }

                    VariableReference variable = (node.Target as VariableReferenceExpression).Variable;
                    Dictionary<FieldDefinition, Expression> fieldToValueMap;
                    return closuresArchive.TryGetValue(variable, out fieldToValueMap) && fieldToValueMap.TryGetValue(resolvedField, out value) ?
                        value.CloneExpressionOnlyAndAttachInstructions(node.UnderlyingSameMethodInstructions) : node;
                }

                return base.VisitFieldReferenceExpression(node);
            }