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


C# IBlockNode类代码示例

本文整理汇总了C#中IBlockNode的典型用法代码示例。如果您正苦于以下问题:C# IBlockNode类的具体用法?C# IBlockNode怎么用?C# IBlockNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: EnumChildren

        public static void EnumChildren(ICompletionDataGenerator cdgen,ResolutionContext ctxt, IBlockNode block, bool isVarInstance,
			MemberFilter vis = MemberFilter.Methods | MemberFilter.Types | MemberFilter.Variables | MemberFilter.Enums, bool publicImports = false)
        {
            var scan = new MemberCompletionEnumeration(ctxt, cdgen) { isVarInst = isVarInstance };

            scan.ScanBlock(block, CodeLocation.Empty, vis, publicImports);
        }
开发者ID:rainers,项目名称:D_Parser,代码行数:7,代码来源:MemberCompletionEnumeration.cs

示例2: FindCurrentCaretContext

        public static ISyntaxRegion FindCurrentCaretContext(IEditorData editor, 
			ref IBlockNode currentScope, 
			out IStatement currentStatement,
			out bool isInsideNonCodeSegment)
        {
            isInsideNonCodeSegment = false;
            currentStatement = null;

            if(currentScope == null)
                currentScope = DResolver.SearchBlockAt (editor.SyntaxTree, editor.CaretLocation, out currentStatement);

            if (currentScope == null)
                return null;

            BlockStatement blockStmt;
            // Always skip lambdas as they're too quirky for accurate scope calculation // ISSUE: May be other anon symbols too?
            var dm = currentScope as DMethod;
            if (dm != null && (dm.SpecialType & DMethod.MethodType.Lambda) != 0)
                currentScope = dm.Parent as IBlockNode;

            if (currentScope is DMethod &&
                (blockStmt = (currentScope as DMethod).GetSubBlockAt (editor.CaretLocation)) != null) {
                blockStmt.UpdateBlockPartly (editor, out isInsideNonCodeSegment);
                currentScope = DResolver.SearchBlockAt (currentScope, editor.CaretLocation, out currentStatement);
            }else {
                while (currentScope is DMethod)
                    currentScope = currentScope.Parent as IBlockNode;
                if (currentScope == null)
                    return null;

                (currentScope as DBlockNode).UpdateBlockPartly (editor, out isInsideNonCodeSegment);
                currentScope = DResolver.SearchBlockAt (currentScope, editor.CaretLocation, out currentStatement);
            }
            return currentScope;
        }
开发者ID:rainers,项目名称:D_Parser,代码行数:35,代码来源:CodeCompletion.cs

示例3: CtrlSpaceCompletionProvider

 public CtrlSpaceCompletionProvider(ICompletionDataGenerator cdg, IBlockNode b, IStatement stmt, MemberFilter vis = MemberFilter.All)
     : base(cdg)
 {
     this.curBlock = b;
     this.curStmt = stmt;
     visibleMembers = vis;
 }
开发者ID:Extrawurst,项目名称:D_Parser,代码行数:7,代码来源:CtrlSpaceCompletionProvider.cs

示例4: Set

        public void Set(IBlockNode b)
        {
            scopedBlock = b;
            Caret = CodeLocation.Empty;

            ConditionalCompilation.EnumConditions(DeclarationCondititons, b, ctxt, CodeLocation.Empty);
        }
开发者ID:default0,项目名称:D_Parser,代码行数:7,代码来源:ContextFrame.cs

示例5: MemberCompletionProvider

 public MemberCompletionProvider(ICompletionDataGenerator cdg, ISyntaxRegion sr, IBlockNode b, IStatement stmt)
     : base(cdg)
 {
     AccessExpression = sr;
     ScopedBlock = b;
     ScopedStatement = stmt;
 }
开发者ID:rainers,项目名称:D_Parser,代码行数:7,代码来源:MemberCompletionProvider.cs

示例6: ContextFrame

        public ContextFrame(ResolutionContext ctxt, IBlockNode b, IStatement stmt = null)
        {
            this.ctxt = ctxt;
            declarationCondititons = new ConditionalCompilation.ConditionSet(ctxt.CompilationEnvironment);

            Set(b,stmt);
        }
开发者ID:DinrusGroup,项目名称:DRC,代码行数:7,代码来源:ContextFrame.cs

示例7: Set

		public void Set(IBlockNode b, CodeLocation caret)
		{
			scopedBlock = b;
			Caret = caret;
			
			ConditionalCompilation.EnumConditions(DeclarationCondititons, b, ctxt, caret); 
		}
开发者ID:DinrusGroup,项目名称:D_Parser,代码行数:7,代码来源:ContextFrame.cs

示例8: SearchBrackets

		public static BracketSearchResult SearchBrackets(TextDocument doc, IEditorData ed, IBlockNode curBlock, IStatement stmt)
		{
			while (stmt != null)
			{
				if (stmt is IExpressionContainingStatement)
				{
					var ecs = (IExpressionContainingStatement)stmt;
					foreach (var x in ecs.SubExpressions)
					{
						SurroundingParenthesesExpression spe = null;
						var xx = x;
						while (xx is ContainerExpression)
						{
							if (xx is SurroundingParenthesesExpression)
								spe = (SurroundingParenthesesExpression)xx;

							var subX = ((ContainerExpression)xx).SubExpressions;
							if (subX != null && subX.Length != 0)
							{
								xx = null;
								foreach (var sx in subX)
									if (ed.CaretLocation > sx.Location && ed.CaretLocation < sx.EndLocation)
									{
										xx = sx as ContainerExpression;
										break;
									}
							}
						}

						if (spe != null)
							return new BracketSearchResult(
								doc.GetOffset(spe.Location.Line, spe.Location.Column), 1,
								doc.GetOffset(spe.EndLocation.Line, spe.EndLocation.Column) - 1, 1);
					}
				}

				if (stmt is BlockStatement)
					return new BracketSearchResult(
						doc.GetOffset(stmt.Location.Line, stmt.Location.Column), 1,
						doc.GetOffset(stmt.EndLocation.Line, stmt.EndLocation.Column) - 1, 1);
				stmt = stmt.Parent;
			}

			if (curBlock != null && ed.CaretLocation < curBlock.BlockStartLocation)
				curBlock = curBlock.Parent as IBlockNode;

			if (curBlock == null || curBlock is DModule)
				return null;

			//TODO: Meta blocks, everything that could contain parentheses
			return new BracketSearchResult(
				doc.GetOffset(curBlock.BlockStartLocation.Line, curBlock.BlockStartLocation.Column), 1,
				doc.GetOffset(curBlock.EndLocation.Line, curBlock.EndLocation.Column) - 1, 1);
		}
开发者ID:DinrusGroup,项目名称:D-IDE,代码行数:54,代码来源:DBracketSearcher.cs

示例9: EnumAllAvailableMembers

        public static void EnumAllAvailableMembers(ICompletionDataGenerator cdgen, IBlockNode ScopedBlock
			, IStatement ScopedStatement,
			CodeLocation Caret,
		    ParseCacheView CodeCache,
			MemberFilter VisibleMembers,
			ConditionalCompilationFlags compilationEnvironment = null)
        {
            var ctxt = ResolutionContext.Create(CodeCache, compilationEnvironment, ScopedBlock, ScopedStatement);

            var en = new MemberCompletionEnumeration(ctxt, cdgen) {isVarInst = true};

            en.IterateThroughScopeLayers(Caret, VisibleMembers);
        }
开发者ID:rainers,项目名称:D_Parser,代码行数:13,代码来源:MemberCompletionEnumeration.cs

示例10: EnumAllAvailableMembers

        public static IEnumerable<INode> EnumAllAvailableMembers(IBlockNode ScopedBlock
			, IStatement ScopedStatement,
			CodeLocation Caret,
			ParseCacheList CodeCache,
			MemberFilter VisibleMembers)
        {
            return EnumAllAvailableMembers(new ResolverContextStack(CodeCache,new ResolverContext
            {
                ScopedBlock = ScopedBlock,
                ScopedStatement = ScopedStatement
            }),
            Caret,
            VisibleMembers);
        }
开发者ID:gavin-norman,项目名称:Mono-D,代码行数:14,代码来源:ItemEnumeration.cs

示例11: EnumConditions

        public static void EnumConditions(ConditionSet cs,IStatement stmt, IBlockNode block, ResolutionContext ctxt, CodeLocation caret)
        {
            var l = new MutableConditionFlagSet();
            cs.LocalFlags = l;

            // If the current scope is a dedicated block.. (so NOT in a method but probably in an initializer or other static statement)
            if(block is DBlockNode)
            {
                // If so, get all (scoping) declaration conditions in the current block
                // and add them to the condition list
                var mblocks = ((DBlockNode)block).GetMetaBlockStack(caret, false, true);

                if(mblocks!=null && mblocks.Length!=0)
                    foreach(var mb in mblocks)
                    {
                        var amd = mb as AttributeMetaDeclaration;
                        if(amd!=null && amd.AttributeOrCondition!=null && amd.AttributeOrCondition.Length!=0)
                            foreach(var attr in amd.AttributeOrCondition)
                                if(attr is DeclarationCondition)
                                    l.Add((DeclarationCondition)attr);
                    }
            }

            // Scan up the current statement when e.g. inside a method body
            while (stmt != null)
            {
                if (stmt is StatementCondition)
                    l.Add(((StatementCondition)stmt).Condition);
                stmt = stmt.Parent;
            }

            // Go up the block hierarchy and add all conditions that belong to the respective nodes
            while (block != null)
            {
                var dn = block as DNode;
                if (dn!=null)
                {
                    if(dn is DBlockNode)
                        GetDoneVersionDebugSpecs(cs, l, dn as DBlockNode, ctxt);
                    if(dn.Attributes!=null)
                        foreach (var attr in dn.Attributes)
                            if (attr is DeclarationCondition)
                                l.Add(((DeclarationCondition)attr));
                }

                block = block.Parent as IBlockNode;
            }
        }
开发者ID:DinrusGroup,项目名称:DRC,代码行数:48,代码来源:ConditionalCompilation.cs

示例12: Set

        public void Set(IBlockNode b, IStatement stmt = null)
        {
            scopedBlock = b;
            scopedStmt = stmt;

            var c = CodeLocation.Empty; //TODO: Take the caret position if we're in the currently edited module and the scoped block is the module root(?)
            if(stmt == null)
            {
                if(b!=null)
                    c = b.BlockStartLocation;
            }
            else
                c = stmt.Location;

            ConditionalCompilation.EnumConditions(declarationCondititons, stmt, b, ctxt, c);
        }
开发者ID:DinrusGroup,项目名称:DRC,代码行数:16,代码来源:ContextFrame.cs

示例13: CreateDeeperLevelCache

		void CreateDeeperLevelCache(IBlockNode bn)
		{
			var dd = TypeCache[bn] = new Dictionary<int,INode>();

			// Set the parent to null to crawl through current level only. Imports/Mixins etc. will be handled though.
			var parentBackup = bn.Parent;
			bn.Parent = null;

			sharedCtxt.CurrentContext.Set(bn);
			foreach (var n in ItemEnumeration.EnumScopedBlockChildren(sharedCtxt, MemberFilter.Types))
			{
				if (n.NameHash != 0)
					dd[n.NameHash] = n;
			}

			bn.Parent = parentBackup;
		}
开发者ID:DinrusGroup,项目名称:DinrusIDE,代码行数:17,代码来源:OldTypeReferenceFinder.cs

示例14: VisitChildren

		public override void VisitChildren (IBlockNode block)
		{
			if (!halt)
				shownKeywords.Push(BlockMemberFilter);

			var en = block.GetEnumerator ();
			while (!halt && en.MoveNext ()) {
				if (en.Current.Location > ed.CaretLocation) {
					halt = true;
					return;
				}
				en.Current.Accept (this);
			}

			if (!halt)
				shownKeywords.Pop ();
		}
开发者ID:DinrusGroup,项目名称:D_Parser,代码行数:17,代码来源:CompletionProviderVisitor.cs

示例15: SearchResultsIn

		void SearchResultsIn(IBlockNode block, string pattern, List<INode> results, int maxResults)
		{
			// Don't search in modules themselves!

			if (block.Children.Count == 0 || results.Count > maxResults)
				return;

			foreach (var n in block.Children) {
				if(!results.Contains(n) && n.Name.Contains(pattern))
					if(!results.Contains(n))
						results.Add(n);
				
				if(n is IBlockNode)
					SearchResultsIn(n as IBlockNode, pattern, results, maxResults);

				if (results.Count > maxResults)
					return;
			}
		}
开发者ID:DinrusGroup,项目名称:Mono-D,代码行数:19,代码来源:DTypeSearchCategory.cs


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