当前位置: 首页>>代码示例>>C#>>正文


C# AstNode.Annotation方法代码示例

本文整理汇总了C#中AstNode.Annotation方法的典型用法代码示例。如果您正苦于以下问题:C# AstNode.Annotation方法的具体用法?C# AstNode.Annotation怎么用?C# AstNode.Annotation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AstNode的用法示例。


在下文中一共展示了AstNode.Annotation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: StartNode

		public override void StartNode(AstNode node)
		{
			base.StartNode(node);
			if (node.Annotation<MethodDebugSymbols>() != null) {
				symbolsStack.Push(node.Annotation<MethodDebugSymbols>());
			}
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:7,代码来源:DebuggerTextOutput.cs

示例2: EndNode

		public override void EndNode(AstNode node)
		{
			base.EndNode(node);
			if (node is EntityDeclaration && node.Annotation<MemberReference>() != null) {
				MemberLocations[XmlDocKeyProvider.GetKey(node.Annotation<MemberReference>())] = node.StartLocation;
			}
			
			// code mappings
			var ranges = node.Annotation<List<ILRange>>();
			if (symbolsStack.Count > 0 && ranges != null && ranges.Count > 0) {
				symbolsStack.Peek().SequencePoints.Add(
					new SequencePoint() {
						ILRanges = ILRange.OrderAndJoin(ranges).ToArray(),
						StartLocation = node.StartLocation,
						EndLocation = node.EndLocation
					});
			}
			
			if (node.Annotation<MethodDebugSymbols>() != null) {
				var symbols = symbolsStack.Pop();
				symbols.SequencePoints = symbols.SequencePoints.OrderBy(s => s.ILOffset).ToList();
				symbols.StartLocation = node.StartLocation;
				symbols.EndLocation = node.EndLocation;
				DebugSymbols[XmlDocKeyProvider.GetKey(symbols.CecilMethod)] = symbols;
			}
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:26,代码来源:DebuggerTextOutput.cs

示例3: StartNode

		public void StartNode(AstNode node) {
			nodeStack.Push(node);

			MethodDebugInfoBuilder mapping = node.Annotation<MethodDebugInfoBuilder>();
			if (mapping != null) {
				parentMethodDebugInfoBuilder.Push(currentMethodDebugInfoBuilder);
				currentMethodDebugInfoBuilder = mapping;
			}
			// For ctor/cctor field initializers
			var mms = node.Annotation<List<Tuple<MethodDebugInfoBuilder, List<BinSpan>>>>();
			if (mms != null) {
				Debug.Assert(multiMappings == null);
				multiMappings = mms;
			}
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:15,代码来源:VBTextOutputFormatter.cs

示例4: EndNode

        public override void EndNode(AstNode node)
        {
            if (nodeStack.Pop() != node)
                throw new InvalidOperationException();

            var startLocation = startLocations.Pop();

            // code mappings
            var ranges = node.Annotation<List<ILRange>>();
            if (symbolsStack.Count > 0 && ranges != null && ranges.Count > 0) {
                // Ignore the newline which was printed at the end of the statement
                TextLocation endLocation = (node is Statement) ? (lastEndOfLine ?? output.Location) : output.Location;
                symbolsStack.Peek().SequencePoints.Add(
                    new SequencePoint() {
                        ILRanges = ILRange.OrderAndJoin(ranges).ToArray(),
                        StartLocation = startLocation,
                        EndLocation = endLocation
                    });
            }

            if (node.Annotation<MethodDebugSymbols>() != null) {
                symbolsStack.Peek().EndLocation = output.Location;
                output.AddDebugSymbols(symbolsStack.Pop());
            }
        }
开发者ID:ichengzi,项目名称:SharpDevelop,代码行数:25,代码来源:TextTokenWriter.cs

示例5: EndNode

		public void EndNode(AstNode node) {
			if (nodeStack.Pop() != node)
				throw new InvalidOperationException();

			if (node.Annotation<MethodDebugInfoBuilder>() != null) {
				output.AddDebugInfo(currentMethodDebugInfoBuilder.Create());
				currentMethodDebugInfoBuilder = parentMethodDebugInfoBuilder.Pop();
			}
			var mms = node.Annotation<List<Tuple<MethodDebugInfoBuilder, List<BinSpan>>>>();
			if (mms != null) {
				Debug.Assert(mms == multiMappings);
				if (mms == multiMappings) {
					foreach (var mm in mms)
						output.AddDebugInfo(mm.Item1.Create());
					multiMappings = null;
				}
			}
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:18,代码来源:VBTextOutputFormatter.cs

示例6: GetInstruction

        public Instruction GetInstruction(AstNode node) {
            var range = node.Annotation<List<ILRange>>();

            if (range != null && range.Count > 0) {
                return _instructions.First(i => i.Offset == range[0].From);
            }

            return null;
        }
开发者ID:sagifogel,项目名称:NJection.LambdaConverter,代码行数:9,代码来源:InstructionsIndexer.cs

示例7: TryGetOpCode

        public bool TryGetOpCode(AstNode node, OpCode[] opCodes, out Instruction instruction) {
            List<ILRange> ilRanges = node.Annotation<List<ILRange>>();

            instruction = null;

            foreach (var opCode in opCodes) {
                if (TryGetInstruction(ilRanges, opCode, out instruction)) {
                    return true;
                }
            }

            return false;
        }
开发者ID:sagifogel,项目名称:NJection.LambdaConverter,代码行数:13,代码来源:InstructionsIndexer.cs

示例8: StartNode

		public void StartNode(AstNode node)
		{
//			var ranges = node.Annotation<List<ILRange>>();
//			if (ranges != null && ranges.Count > 0)
//			{
//				// find the ancestor that has method mapping as annotation
//				if (node.Ancestors != null && node.Ancestors.Count() > 0)
//				{
//					var n = node.Ancestors.FirstOrDefault(a => a.Annotation<MemberMapping>() != null);
//					if (n != null) {
//						MemberMapping mapping = n.Annotation<MemberMapping>();
//
//						// add all ranges
//						foreach (var range in ranges) {
//							mapping.MemberCodeMappings.Add(new SourceCodeMapping {
//							                               	ILInstructionOffset = range,
//							                               	SourceCodeLine = output.CurrentLine,
//							                               	MemberMapping = mapping
//							                               });
//						}
//					}
//				}
//			}
			
			nodeStack.Push(node);
			
			MemberMapping mapping = node.Annotation<MemberMapping>();
			if (mapping != null) {
				parentMemberMappings.Push(currentMemberMapping);
				currentMemberMapping = mapping;
			}
			// For ctor/cctor field initializers
			var mms = node.Annotation<List<Tuple<MemberMapping, List<ILRange>>>>();
			if (mms != null) {
				Debug.Assert(multiMappings == null);
				multiMappings = mms;
			}
		}
开发者ID:nakijun,项目名称:dnSpy,代码行数:38,代码来源:VBTextOutputFormatter.cs

示例9: Run

		public void Run(AstNode node) {
			if (node is EntityDeclaration) {
				IMemberRef mr = node.Annotation<IMemberRef>();
				if (mr != null && mr.Module != null) {
					var xmldoc = XmlDocLoader.LoadDocumentation(mr.Module);
					if (xmldoc != null) {
						string doc = xmldoc.GetDocumentation(XmlDocKeyProvider.GetKey(mr, stringBuilder));
						if (!string.IsNullOrEmpty(doc)) {
							InsertXmlDocumentation(node, doc);
						}
					}
				}
				if (!(node is TypeDeclaration))
					return; // don't recurse into attributed nodes, except for type definitions
			}
			foreach (AstNode child in node.Children)
				Run(child);
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:18,代码来源:AddXmlDocTransform.cs

示例10: EndNode

		public void EndNode(AstNode node) {
			if (nodeStack.Pop() != node)
				throw new InvalidOperationException();

			if (node.Annotation<MemberMapping>() != null) {
				output.AddDebugSymbols(currentMemberMapping);
				currentMemberMapping = parentMemberMappings.Pop();
			}
			var mms = node.Annotation<List<Tuple<MemberMapping, List<ILRange>>>>();
			if (mms != null) {
				Debug.Assert(mms == multiMappings);
				if (mms == multiMappings) {
					foreach (var mm in mms)
						output.AddDebugSymbols(mm.Item1);
					multiMappings = null;
				}
			}
		}
开发者ID:GreenDamTan,项目名称:dnSpy,代码行数:18,代码来源:VBTextOutputFormatter.cs

示例11: Run

		public static void Run(AstNode node)
		{
			if (node is AttributedNode) {
				MemberReference mr = node.Annotation<MemberReference>();
				if (mr != null && mr.Module != null) {
					var xmldoc = XmlDocLoader.LoadDocumentation(mr.Module);
					if (xmldoc != null) {
						string doc = xmldoc.GetDocumentation(XmlDocKeyProvider.GetKey(mr));
						if (doc != null) {
							InsertXmlDocumentation(node, new StringReader(doc));
						}
					}
				}
				if (!(node is TypeDeclaration))
					return; // don't recurse into attributed nodes, except for type definitions
			}
			foreach (AstNode child in node.Children)
				Run(child);
		}
开发者ID:constructor-igor,项目名称:cudafy,代码行数:19,代码来源:AddXmlDocTransform.cs

示例12: TryGetInstruction

        public bool TryGetInstruction(AstNode node, OpCode opCode, out Instruction instruction) {
            List<ILRange> ilRanges = node.Annotation<List<ILRange>>();

            return TryGetInstruction(ilRanges, opCode, out instruction);
        }
开发者ID:sagifogel,项目名称:NJection.LambdaConverter,代码行数:5,代码来源:InstructionsIndexer.cs

示例13: StartNode

		public void StartNode(AstNode node)
		{
			// code mappings
			var ranges = node.Annotation<List<ILRange>>();
			if (ranges != null && ranges.Count > 0) {
				// find the ancestor that has method mapping as annotation
				if (node.Parent != null)
				{
					var n = node.Ancestors.FirstOrDefault(a => a.Annotation<MemberMapping>() != null);
					if (n != null) {
						MemberMapping mapping = n.Annotation<MemberMapping>();

						// add all ranges
						foreach (var range in ranges) {
							mapping.MemberCodeMappings.Add(new SourceCodeMapping {
							                               	ILInstructionOffset = range,
							                               	SourceCodeLine = output.CurrentLine,
							                               	MemberMapping = mapping
							                               });
						}
					}
				}
			}
			
			// definitions of types and their members
			Predicate<AstNode> predicate = n => n is AttributedNode;
			
			if (predicate(node)) {
				var n = node as AttributedNode;
				int c = 0;
				if (n != null)
					c = n.Attributes.Count;
				node.AddAnnotation(Tuple.Create(output.CurrentLine + c, output.CurrentColumn));
			}
			
			nodeStack.Push(node);
		}
开发者ID:itsff,项目名称:ILSpy,代码行数:37,代码来源:TextOutputFormatter.cs

示例14: StartNode

		public void StartNode(AstNode node)
		{
			var ranges = node.Annotation<List<ILRange>>();
			if (ranges != null && ranges.Count > 0)
			{
				// find the ancestor that has method mapping as annotation
				if (node.Ancestors != null && node.Ancestors.Count() > 0)
				{
					var n = node.Ancestors.FirstOrDefault(a => a.Annotation<MemberMapping>() != null);
					if (n != null) {
						MemberMapping mapping = n.Annotation<MemberMapping>();

						// add all ranges
						foreach (var range in ranges) {
							mapping.MemberCodeMappings.Add(new SourceCodeMapping {
							                               	ILInstructionOffset = range,
							                               	SourceCodeLine = output.CurrentLine,
							                               	MemberMapping = mapping
							                               });
						}
					}
				}
			}
			
			nodeStack.Push(node);
		}
开发者ID:constructor-igor,项目名称:cudafy,代码行数:26,代码来源:TextOutputFormatter.cs

示例15: EndNode

		public void EndNode(AstNode node)
		{
			if (nodeStack.Pop() != node)
				throw new InvalidOperationException();
			
			var startLocation = startLocations.Pop();
			
			// code mappings
			if (currentMemberMapping != null) {
				var ranges = node.Annotation<List<ILRange>>();
				if (ranges != null && ranges.Count > 0) {
					// add all ranges
					foreach (var range in ranges) {
						currentMemberMapping.MemberCodeMappings.Add(
							new SourceCodeMapping {
								ILInstructionOffset = range,
								StartLocation = startLocation,
								EndLocation = output.Location,
								MemberMapping = currentMemberMapping
							});
					}
				}
			}
			
			
			if (node.Annotation<MemberMapping>() != null) {
				output.AddDebuggerMemberMapping(currentMemberMapping);
				currentMemberMapping = parentMemberMappings.Pop();
			}
		}
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:30,代码来源:TextOutputFormatter.cs


注:本文中的AstNode.Annotation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。