public override object VisitPropertySetRegion(PropertySetRegion propertySetRegion, object data)
 {
     if (this.CheckNode(propertySetRegion))
     {
         return(null);
     }
     return(base.VisitPropertySetRegion(propertySetRegion, data));
 }
Example #2
0
 public override object VisitPropertySetRegion(PropertySetRegion setRegion, object data)
 {
     setRegion.Block.Parent = setRegion;
     foreach (ParameterDeclarationExpression parameter in setRegion.Parameters)
     {
         parameter.Parent = setRegion;
     }
     return(base.VisitPropertySetRegion(setRegion, data));
 }
        public virtual object Visit(PropertySetRegion propertySetRegion, object data)
        {
            Debug.Assert(propertySetRegion != null);
            Debug.Assert(propertySetRegion.Attributes != null);
            Debug.Assert(propertySetRegion.Block != null);

            foreach (AttributeSection section in propertySetRegion.Attributes)
            {
                Debug.Assert(section != null);
                section.AcceptVisitor(this, data);
            }
            blockStack.Push(propertySetRegion.Block);
            propertySetRegion.Block.AcceptChildren(this, data);
            blockStack.Pop();
            return(data);
        }
Example #4
0
	void AccessorDecls(
#line  1315 "VBNET.ATG" 
out PropertyGetRegion getBlock, out PropertySetRegion setBlock) {

#line  1317 "VBNET.ATG" 
		List<AttributeSection> attributes = new List<AttributeSection>();
		AttributeSection section;
		getBlock = null;
		setBlock = null; 
		
		while (la.kind == 28) {
			AttributeSection(
#line  1322 "VBNET.ATG" 
out section);

#line  1322 "VBNET.ATG" 
			attributes.Add(section); 
		}
		if (StartOf(24)) {
			GetAccessorDecl(
#line  1324 "VBNET.ATG" 
out getBlock, attributes);
			if (StartOf(25)) {

#line  1326 "VBNET.ATG" 
				attributes = new List<AttributeSection>(); 
				while (la.kind == 28) {
					AttributeSection(
#line  1327 "VBNET.ATG" 
out section);

#line  1327 "VBNET.ATG" 
					attributes.Add(section); 
				}
				SetAccessorDecl(
#line  1328 "VBNET.ATG" 
out setBlock, attributes);
			}
		} else if (StartOf(26)) {
			SetAccessorDecl(
#line  1331 "VBNET.ATG" 
out setBlock, attributes);
			if (StartOf(27)) {

#line  1333 "VBNET.ATG" 
				attributes = new List<AttributeSection>(); 
				while (la.kind == 28) {
					AttributeSection(
#line  1334 "VBNET.ATG" 
out section);

#line  1334 "VBNET.ATG" 
					attributes.Add(section); 
				}
				GetAccessorDecl(
#line  1335 "VBNET.ATG" 
out getBlock, attributes);
			}
		} else SynErr(251);
	}
Example #5
0
 public override object VisitPropertySetRegion(PropertySetRegion propertySetRegion, object data)
 {
     return(base.VisitPropertySetRegion(propertySetRegion, data));
 }
Example #6
0
	void SetAccessorDecl(
#line  1214 "cs.ATG" 
out PropertySetRegion setBlock, List<AttributeSection> attributes) {

#line  1215 "cs.ATG" 
		Statement stmt = null; 
		Expect(129);

#line  1218 "cs.ATG" 
		Location startLocation = t.Location; 
		if (la.kind == 16) {
			Block(
#line  1219 "cs.ATG" 
out stmt);
		} else if (la.kind == 11) {
			lexer.NextToken();
		} else SynErr(190);

#line  1220 "cs.ATG" 
		setBlock = new PropertySetRegion((BlockStatement)stmt, attributes); 

#line  1221 "cs.ATG" 
		setBlock.StartLocation = startLocation; setBlock.EndLocation = t.EndLocation; 
	}
Example #7
0
	void InterfaceAccessors(
#line  1245 "cs.ATG" 
out PropertyGetRegion getBlock, out PropertySetRegion setBlock) {

#line  1247 "cs.ATG" 
		AttributeSection section;
		List<AttributeSection> attributes = new List<AttributeSection>();
		getBlock = null; setBlock = null;
		PropertyGetSetRegion lastBlock = null;
		
		while (la.kind == 18) {
			AttributeSection(
#line  1253 "cs.ATG" 
out section);

#line  1253 "cs.ATG" 
			attributes.Add(section); 
		}

#line  1254 "cs.ATG" 
		Location startLocation = la.Location; 
		if (la.kind == 128) {
			lexer.NextToken();

#line  1256 "cs.ATG" 
			getBlock = new PropertyGetRegion(null, attributes); 
		} else if (la.kind == 129) {
			lexer.NextToken();

#line  1257 "cs.ATG" 
			setBlock = new PropertySetRegion(null, attributes); 
		} else SynErr(187);
		Expect(11);

#line  1260 "cs.ATG" 
		if (getBlock != null) { getBlock.StartLocation = startLocation; getBlock.EndLocation = t.EndLocation; }
		if (setBlock != null) { setBlock.StartLocation = startLocation; setBlock.EndLocation = t.EndLocation; }
		attributes = new List<AttributeSection>(); 
		if (la.kind == 18 || la.kind == 128 || la.kind == 129) {
			while (la.kind == 18) {
				AttributeSection(
#line  1264 "cs.ATG" 
out section);

#line  1264 "cs.ATG" 
				attributes.Add(section); 
			}

#line  1265 "cs.ATG" 
			startLocation = la.Location; 
			if (la.kind == 128) {
				lexer.NextToken();

#line  1267 "cs.ATG" 
				if (getBlock != null) Error("get already declared");
				                 else { getBlock = new PropertyGetRegion(null, attributes); lastBlock = getBlock; }
				              
			} else if (la.kind == 129) {
				lexer.NextToken();

#line  1270 "cs.ATG" 
				if (setBlock != null) Error("set already declared");
				                 else { setBlock = new PropertySetRegion(null, attributes); lastBlock = setBlock; }
				              
			} else SynErr(188);
			Expect(11);

#line  1275 "cs.ATG" 
			if (lastBlock != null) { lastBlock.StartLocation = startLocation; lastBlock.EndLocation = t.EndLocation; } 
		}
	}
		public sealed override object VisitPropertySetRegion(PropertySetRegion propertySetRegion, object data) {
			BeginVisit(propertySetRegion);
			object result = TrackedVisitPropertySetRegion(propertySetRegion, data);
			EndVisit(propertySetRegion);
			return result;
		}
 public virtual object VisitPropertySetRegion(PropertySetRegion propertySetRegion, object data)
 {
     throw new global::System.NotImplementedException("PropertySetRegion");
 }
 private bool IsMatch(PropertySetRegion left, PropertySetRegion data)
 {
     return(true);
 }
		public virtual object VisitPropertySetRegion(PropertySetRegion propertySetRegion, object data) {
			throw new global::System.NotImplementedException("PropertySetRegion");
		}
Example #12
0
 private void SetAccessorDecl(out PropertySetRegion setBlock, List<ICSharpCode.NRefactory.Parser.AST.AttributeSection> attributes)
 {
     ICSharpCode.NRefactory.Parser.AST.Statement stmt = null;
     base.Expect(1);
     if (this.t.val != "set")
     {
         this.Error("set expected");
     }
     Point location = this.t.Location;
     if (this.la.kind == 0x10)
     {
         this.Block(out stmt);
     }
     else if (this.la.kind == 11)
     {
         base.lexer.NextToken();
     }
     else
     {
         base.SynErr(0xa6);
     }
     setBlock = new PropertySetRegion((BlockStatement) stmt, attributes);
     setBlock.StartLocation = location;
     setBlock.EndLocation = this.t.EndLocation;
 }
Example #13
0
 private void AccessorDecls(out PropertyGetRegion getBlock, out PropertySetRegion setBlock)
 {
     ICSharpCode.NRefactory.Parser.AST.AttributeSection section;
     List<ICSharpCode.NRefactory.Parser.AST.AttributeSection> attributes = new List<ICSharpCode.NRefactory.Parser.AST.AttributeSection>();
     getBlock = null;
     setBlock = null;
     Modifiers m = null;
     while (this.la.kind == 0x12)
     {
         this.AttributeSection(out section);
         attributes.Add(section);
     }
     if (((this.la.kind == 0x53) || (this.la.kind == 0x5f)) || (this.la.kind == 0x60))
     {
         this.AccessorModifiers(out m);
     }
     if (this.IdentIsGet())
     {
         this.GetAccessorDecl(out getBlock, attributes);
         if (m != null)
         {
             getBlock.Modifier = m.Modifier;
         }
         if (this.StartOf(0x16))
         {
             attributes = new List<ICSharpCode.NRefactory.Parser.AST.AttributeSection>();
             m = null;
             while (this.la.kind == 0x12)
             {
                 this.AttributeSection(out section);
                 attributes.Add(section);
             }
             if (((this.la.kind == 0x53) || (this.la.kind == 0x5f)) || (this.la.kind == 0x60))
             {
                 this.AccessorModifiers(out m);
             }
             this.SetAccessorDecl(out setBlock, attributes);
             if (m != null)
             {
                 setBlock.Modifier = m.Modifier;
             }
         }
     }
     else if (this.IdentIsSet())
     {
         this.SetAccessorDecl(out setBlock, attributes);
         if (m != null)
         {
             setBlock.Modifier = m.Modifier;
         }
         if (this.StartOf(0x16))
         {
             attributes = new List<ICSharpCode.NRefactory.Parser.AST.AttributeSection>();
             m = null;
             while (this.la.kind == 0x12)
             {
                 this.AttributeSection(out section);
                 attributes.Add(section);
             }
             if (((this.la.kind == 0x53) || (this.la.kind == 0x5f)) || (this.la.kind == 0x60))
             {
                 this.AccessorModifiers(out m);
             }
             this.GetAccessorDecl(out getBlock, attributes);
             if (m != null)
             {
                 getBlock.Modifier = m.Modifier;
             }
         }
     }
     else if (this.la.kind == 1)
     {
         base.lexer.NextToken();
         this.Error("get or set accessor declaration expected");
     }
     else
     {
         base.SynErr(0xa2);
     }
 }
Example #14
0
 private void InterfaceAccessors(out PropertyGetRegion getBlock, out PropertySetRegion setBlock)
 {
     ICSharpCode.NRefactory.Parser.AST.AttributeSection section;
     List<ICSharpCode.NRefactory.Parser.AST.AttributeSection> attributes = new List<ICSharpCode.NRefactory.Parser.AST.AttributeSection>();
     getBlock = null;
     setBlock = null;
     PropertyGetSetRegion region = null;
     while (this.la.kind == 0x12)
     {
         this.AttributeSection(out section);
         attributes.Add(section);
     }
     Point location = this.la.Location;
     if (this.IdentIsGet())
     {
         base.Expect(1);
         getBlock = new PropertyGetRegion(null, attributes);
     }
     else if (this.IdentIsSet())
     {
         base.Expect(1);
         setBlock = new PropertySetRegion(null, attributes);
     }
     else if (this.la.kind == 1)
     {
         base.lexer.NextToken();
         this.Error("set or get expected");
     }
     else
     {
         base.SynErr(0xa3);
     }
     base.Expect(11);
     if (getBlock != null)
     {
         getBlock.StartLocation = location;
         getBlock.EndLocation = this.t.EndLocation;
     }
     if (setBlock != null)
     {
         setBlock.StartLocation = location;
         setBlock.EndLocation = this.t.EndLocation;
     }
     attributes = new List<ICSharpCode.NRefactory.Parser.AST.AttributeSection>();
     if ((this.la.kind == 1) || (this.la.kind == 0x12))
     {
         while (this.la.kind == 0x12)
         {
             this.AttributeSection(out section);
             attributes.Add(section);
         }
         location = this.la.Location;
         if (this.IdentIsGet())
         {
             base.Expect(1);
             if (getBlock != null)
             {
                 this.Error("get already declared");
             }
             else
             {
                 getBlock = new PropertyGetRegion(null, attributes);
                 region = getBlock;
             }
         }
         else if (this.IdentIsSet())
         {
             base.Expect(1);
             if (setBlock != null)
             {
                 this.Error("set already declared");
             }
             else
             {
                 setBlock = new PropertySetRegion(null, attributes);
                 region = setBlock;
             }
         }
         else if (this.la.kind == 1)
         {
             base.lexer.NextToken();
             this.Error("set or get expected");
         }
         else
         {
             base.SynErr(0xa4);
         }
         base.Expect(11);
         if (region != null)
         {
             region.StartLocation = location;
             region.EndLocation = this.t.EndLocation;
         }
     }
 }
		public virtual object VisitPropertySetRegion(PropertySetRegion propertySetRegion, object data) {
			Debug.Assert((propertySetRegion != null));
			Debug.Assert((propertySetRegion.Attributes != null));
			Debug.Assert((propertySetRegion.Block != null));
			Debug.Assert((propertySetRegion.Parameters != null));
			for (int i = 0; i < propertySetRegion.Attributes.Count; i++) {
				AttributeSection o = propertySetRegion.Attributes[i];
				Debug.Assert(o != null);
				nodeStack.Push(o);
				o.AcceptVisitor(this, data);
				o = (AttributeSection)nodeStack.Pop();
				if (o == null)
					propertySetRegion.Attributes.RemoveAt(i--);
				else
					propertySetRegion.Attributes[i] = o;
			}
			nodeStack.Push(propertySetRegion.Block);
			propertySetRegion.Block.AcceptVisitor(this, data);
			propertySetRegion.Block = ((BlockStatement)(nodeStack.Pop()));
			for (int i = 0; i < propertySetRegion.Parameters.Count; i++) {
				ParameterDeclarationExpression o = propertySetRegion.Parameters[i];
				Debug.Assert(o != null);
				nodeStack.Push(o);
				o.AcceptVisitor(this, data);
				o = (ParameterDeclarationExpression)nodeStack.Pop();
				if (o == null)
					propertySetRegion.Parameters.RemoveAt(i--);
				else
					propertySetRegion.Parameters[i] = o;
			}
			return null;
		}
Example #16
0
	void SetAccessorDecl(
#line  1357 "VBNET.ATG" 
out PropertySetRegion setBlock, List<AttributeSection> attributes) {

#line  1359 "VBNET.ATG" 
		Statement stmt = null;
		List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
		Modifiers m;
		
		PropertyAccessorAccessModifier(
#line  1364 "VBNET.ATG" 
out m);
		Expect(183);

#line  1366 "VBNET.ATG" 
		Location startLocation = t.Location; 
		if (la.kind == 25) {
			lexer.NextToken();
			if (StartOf(4)) {
				FormalParameterList(
#line  1367 "VBNET.ATG" 
p);
			}
			Expect(26);
		}
		Expect(1);
		Block(
#line  1369 "VBNET.ATG" 
out stmt);

#line  1371 "VBNET.ATG" 
		setBlock = new PropertySetRegion((BlockStatement)stmt, attributes);
		setBlock.Modifier = m;
		setBlock.Parameters = p;
		
		Expect(100);
		Expect(183);

#line  1376 "VBNET.ATG" 
		setBlock.StartLocation = startLocation; setBlock.EndLocation = t.EndLocation; 
		EndOfStmt();
	}
        public override List <Change> PerformChanges(RefactoringOptions options, object prop)
        {
            List <Change>          result        = new List <Change> ();
            TextEditorData         data          = options.GetTextEditorData();
            MemberResolveResult    resolveResult = options.ResolveResult as MemberResolveResult;
            IProperty              property      = resolveResult.ResolvedMember as IProperty;
            INRefactoryASTProvider astProvider   = options.GetASTProvider();
            string backingStoreName = RetrieveBackingStore(options, astProvider, property);

            int    backinStoreStart;
            int    backinStoreEnd;
            IField backingStore = GetBackingStoreField(options, backingStoreName, out backinStoreStart, out backinStoreEnd);

            if (backingStore != null)
            {
                foreach (MemberReference memberRef in GetReferences(options, backingStore))
                {
                    result.Add(new TextReplaceChange()
                    {
                        FileName     = memberRef.FileName,
                        Offset       = memberRef.Position,
                        RemovedChars = memberRef.Name.Length,
                        InsertedText = property.Name
                    });
                }

                result.RemoveAll(c => backinStoreStart <= ((TextReplaceChange)c).Offset && ((TextReplaceChange)c).Offset <= backinStoreEnd);
                result.Add(new TextReplaceChange()
                {
                    FileName     = options.Document.FileName,
                    Offset       = backinStoreStart,
                    RemovedChars = backinStoreEnd - backinStoreStart
                });
            }

            if (property.HasGet)
            {
                int startOffset = data.Document.LocationToOffset(property.GetRegion.Start.ToDocumentLocation(data.Document));
                int endOffset   = data.Document.LocationToOffset(property.GetRegion.End.ToDocumentLocation(data.Document));

                string text = astProvider.OutputNode(options.Dom, new PropertyGetRegion(null, null), options.GetIndent(property) + "\t").Trim();

                result.RemoveAll(c => startOffset <= ((TextReplaceChange)c).Offset && ((TextReplaceChange)c).Offset <= endOffset);
                result.Add(new TextReplaceChange()
                {
                    FileName     = options.Document.FileName,
                    Offset       = startOffset,
                    RemovedChars = endOffset - startOffset,
                    InsertedText = text
                });
            }

            int setStartOffset;
            int setEndOffset;
            PropertySetRegion setRegion = new PropertySetRegion(null, null);
            string            setText;

            if (property.HasSet)
            {
                setStartOffset = data.Document.LocationToOffset(property.SetRegion.Start.ToDocumentLocation(data.Document));
                setEndOffset   = data.Document.LocationToOffset(property.SetRegion.End.ToDocumentLocation(data.Document));
                setText        = astProvider.OutputNode(options.Dom, setRegion, options.GetIndent(property) + "\t").Trim();
            }
            else
            {
                setEndOffset       = setStartOffset = data.Document.LocationToOffset(property.GetRegion.End.ToDocumentLocation(data.Document));
                setRegion.Modifier = ICSharpCode.NRefactory.Ast.Modifiers.Private;
                setText            = Environment.NewLine + astProvider.OutputNode(options.Dom, setRegion, options.GetIndent(property) + "\t").TrimEnd();
            }
            result.RemoveAll(c => setStartOffset <= ((TextReplaceChange)c).Offset && ((TextReplaceChange)c).Offset <= setEndOffset);
            result.Add(new TextReplaceChange()
            {
                FileName     = options.Document.FileName,
                Offset       = setStartOffset,
                RemovedChars = setEndOffset - setStartOffset,
                InsertedText = setText
            });
            return(result);
        }
 public object VisitPropertySetRegion(PropertySetRegion propertySetRegion, object data)
 {
     throw new NotImplementedException();
 }
		public virtual object VisitPropertySetRegion(PropertySetRegion propertySetRegion, object data) {
			Debug.Assert((propertySetRegion != null));
			Debug.Assert((propertySetRegion.Attributes != null));
			Debug.Assert((propertySetRegion.Block != null));
			Debug.Assert((propertySetRegion.Parameters != null));
			foreach (AttributeSection o in propertySetRegion.Attributes) {
				Debug.Assert(o != null);
				o.AcceptVisitor(this, data);
			}
			propertySetRegion.Block.AcceptVisitor(this, data);
			foreach (ParameterDeclarationExpression o in propertySetRegion.Parameters) {
				Debug.Assert(o != null);
				o.AcceptVisitor(this, data);
			}
			return null;
		}
Example #20
0
	void AccessorDecls(
#line  1171 "cs.ATG" 
out PropertyGetRegion getBlock, out PropertySetRegion setBlock) {

#line  1173 "cs.ATG" 
		List<AttributeSection> attributes = new List<AttributeSection>(); 
		AttributeSection section;
		getBlock = null;
		setBlock = null; 
		ModifierList modifiers = null;
		
		while (la.kind == 18) {
			AttributeSection(
#line  1180 "cs.ATG" 
out section);

#line  1180 "cs.ATG" 
			attributes.Add(section); 
		}
		if (la.kind == 84 || la.kind == 96 || la.kind == 97) {
			AccessorModifiers(
#line  1181 "cs.ATG" 
out modifiers);
		}
		if (la.kind == 128) {
			GetAccessorDecl(
#line  1183 "cs.ATG" 
out getBlock, attributes);

#line  1184 "cs.ATG" 
			if (modifiers != null) {getBlock.Modifier = modifiers.Modifier; } 
			if (StartOf(27)) {

#line  1185 "cs.ATG" 
				attributes = new List<AttributeSection>(); modifiers = null; 
				while (la.kind == 18) {
					AttributeSection(
#line  1186 "cs.ATG" 
out section);

#line  1186 "cs.ATG" 
					attributes.Add(section); 
				}
				if (la.kind == 84 || la.kind == 96 || la.kind == 97) {
					AccessorModifiers(
#line  1187 "cs.ATG" 
out modifiers);
				}
				SetAccessorDecl(
#line  1188 "cs.ATG" 
out setBlock, attributes);

#line  1189 "cs.ATG" 
				if (modifiers != null) {setBlock.Modifier = modifiers.Modifier; } 
			}
		} else if (la.kind == 129) {
			SetAccessorDecl(
#line  1192 "cs.ATG" 
out setBlock, attributes);

#line  1193 "cs.ATG" 
			if (modifiers != null) {setBlock.Modifier = modifiers.Modifier; } 
			if (StartOf(28)) {

#line  1194 "cs.ATG" 
				attributes = new List<AttributeSection>(); modifiers = null; 
				while (la.kind == 18) {
					AttributeSection(
#line  1195 "cs.ATG" 
out section);

#line  1195 "cs.ATG" 
					attributes.Add(section); 
				}
				if (la.kind == 84 || la.kind == 96 || la.kind == 97) {
					AccessorModifiers(
#line  1196 "cs.ATG" 
out modifiers);
				}
				GetAccessorDecl(
#line  1197 "cs.ATG" 
out getBlock, attributes);

#line  1198 "cs.ATG" 
				if (modifiers != null) {getBlock.Modifier = modifiers.Modifier; } 
			}
		} else if (StartOf(19)) {
			Identifier();

#line  1200 "cs.ATG" 
			Error("get or set accessor declaration expected"); 
		} else SynErr(186);
	}
 public object VisitPropertySetRegion(PropertySetRegion propertySetRegion, object data)
 {
     throw new ApplicationException("PropertySetRegion visited.");
 }
		public virtual object TrackedVisitPropertySetRegion(PropertySetRegion propertySetRegion, object data) {
			return base.VisitPropertySetRegion(propertySetRegion, data);
		}