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


C# ImmutableStack.Pop方法代码示例

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


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

示例1: End

        public static void End(ActivityScope scope)
        {
            if (Current == null)
                return;

            if (ActivityStack.All(scopeOnTheStack => scope.Id != scopeOnTheStack.Id))
                return;

            ActivityScope currentScope;
            ActivityStack = ActivityStack.Pop(out currentScope);

            while(ActivityStack.Any() && currentScope.Id != scope.Id) {
                ActivityStack = ActivityStack.Pop(out currentScope);
            }
        }
开发者ID:CorrelatorSharp,项目名称:CorrelatorSharp,代码行数:15,代码来源:ActivityTracker.cs

示例2: NewScope

 public IDisposable NewScope()
 {
     scopes = scopes.Push(new Dictionary<ColumnExpression, Expression>());
     return new Disposable(() => scopes = scopes.Pop());
 }
开发者ID:nuub666,项目名称:framework,代码行数:5,代码来源:QueryRebinder.cs

示例3: CreateElements

		List<InternalObject> CreateElements(ref ImmutableStack<InternalObject> inputObjects)
		{
			List<InternalObject> objects = new List<InternalObject>();
			while (!inputObjects.IsEmpty) {
				var obj = inputObjects.Peek();
				var tag = obj as InternalTag;
				if (tag != null && tag.IsStartTag)
					break;
				inputObjects = inputObjects.Pop();
				if (tag != null && tag.IsEndTag) {
					if (inputObjects.Peek() == StartTagPlaceholder) {
						objects.Add(tag.AddSyntaxError("Matching opening tag was not found"));
						inputObjects = inputObjects.Pop();
					} else {
						var childElements = CreateElements(ref inputObjects);
						var startTag = (InternalTag)inputObjects.Peek();
						inputObjects = inputObjects.Pop();
						childElements.Add(startTag);
						childElements.Reverse();
						if (tag != EndTagPlaceholder) {
							// add end tag
							if (startTag.Name != tag.Name) {
								childElements.Add(tag.AddSyntaxError("Expected '</" + startTag.Name + ">'. End tag must have same name as start tag."));
							} else {
								childElements.Add(tag);
							}
						}
						InternalElement e = new InternalElement(startTag);
						e.HasEndTag = (tag != EndTagPlaceholder);
						e.NestedObjects = new InternalObject[childElements.Count];
						int pos = 0;
						for (int i = 0; i < childElements.Count; i++) {
							e.NestedObjects[i] = childElements[i].SetStartRelativeToParent(pos);
							pos += e.NestedObjects[i].Length;
						}
						e.Length = pos;
						if (tag == EndTagPlaceholder) {
							e.SyntaxErrors = new [] { new InternalSyntaxError(pos, pos, "Missing '</" + startTag.Name + ">'") };
						}
						objects.Add(e);
					}
				} else {
					objects.Add(obj);
				}
			}
			return objects;
		}
开发者ID:sphynx79,项目名称:dotfiles,代码行数:47,代码来源:TagMatchingHeuristics.cs

示例4: Handle

        private List<JsStatement> Handle(ImmutableStack<StackEntry> stack, ImmutableStack<Tuple<string, State>> breakStack, ImmutableStack<Tuple<string, State>> continueStack, State currentState, State returnState)
        {
            var currentBlock = new List<JsStatement>();
            while (!stack.IsEmpty) {
                var tos = stack.Peek();
                stack = stack.Pop();

                var stmt = tos.Block.Statements[tos.Index];
                var lbl = stmt as JsLabelledStatement;
                if (lbl != null) {
                    if (_processedStates.Contains(GetOrCreateStateForLabel(lbl.Label, currentState.FinallyStack))) {
                        // First statement in the new block
                        stmt = lbl.Statement;
                    }
                    else {
                        // A label that terminates the current block.
                        Enqueue(stack.Push(new StackEntry(tos.Block, tos.Index)), breakStack, continueStack, GetOrCreateStateForLabel(lbl.Label, currentState.FinallyStack), returnState);
                        if (currentBlock.Count == 0 || IsNextStatementReachable(currentBlock[currentBlock.Count - 1]))
                            currentBlock.Add(new JsGotoStateStatement(GetOrCreateStateForLabel(lbl.Label, currentState.FinallyStack), currentState));
                        return currentBlock;
                    }
                }

                if (stmt is JsYieldStatement) {
                    var ystmt = (JsYieldStatement)stmt;
                    if (ystmt.Value != null) {
                        if (!HandleYieldReturnStatement(ystmt, tos, stack, breakStack, continueStack, currentState, returnState, currentBlock))
                            return currentBlock;
                    }
                    else {
                        currentBlock.AddRange(new NestedJumpStatementRewriter(breakStack, continueStack, currentState, _exitState.Value).Process(stmt));
                        stack = PushFollowing(stack, tos);
                    }
                }
                else if (stmt is JsTryStatement) {
                    if (!HandleTryStatement((JsTryStatement)stmt, tos, stack, breakStack, continueStack, currentState, returnState, currentBlock))
                        return currentBlock;
                    stack = PushFollowing(stack, tos);
                }
                else if (FindInterestingConstructsVisitor.Analyze(stmt, InterestingConstruct.YieldReturn | InterestingConstruct.Label)) {
                    if (stmt is JsBlockStatement) {
                        stack = PushFollowing(stack, tos).Push(new StackEntry((JsBlockStatement)stmt, 0));
                    }
                    else {
                        if (stmt is JsIfStatement) {
                            if (!HandleIfStatement((JsIfStatement)stmt, tos, stack, breakStack, continueStack, currentState, returnState, currentBlock))
                                return currentBlock;
                        }
                        else if (stmt is JsDoWhileStatement) {
                            if (!HandleDoWhileStatement((JsDoWhileStatement)stmt, tos, stack, breakStack, continueStack, currentState, returnState, currentBlock))
                                return currentBlock;
                        }
                        else if (stmt is JsWhileStatement) {
                            if (!HandleWhileStatement((JsWhileStatement)stmt, tos, stack, breakStack, continueStack, currentState, returnState, currentBlock))
                                return currentBlock;
                        }
                        else if (stmt is JsForStatement) {
                            if (!HandleForStatement((JsForStatement)stmt, tos, stack, breakStack, continueStack, currentState, returnState, currentBlock))
                                return currentBlock;
                        }
                        else if (stmt is JsSwitchStatement) {
                            if (!HandleSwitchStatement((JsSwitchStatement)stmt, tos, stack, breakStack, continueStack, currentState, returnState, currentBlock))
                                return currentBlock;
                        }
                        else {
                            throw new NotSupportedException("Statement " + stmt + " cannot contain labels.");
                        }

                        stack = PushFollowing(stack, tos);
                    }
                }
                else {
                    currentBlock.AddRange(new NestedJumpStatementRewriter(breakStack, continueStack, currentState, _exitState.Value).Process(stmt));
                    stack = PushFollowing(stack, tos);
                }
            }
            if (currentBlock.Count == 0 || IsNextStatementReachable(currentBlock[currentBlock.Count - 1]))
                currentBlock.Add(new JsGotoStateStatement(returnState, currentState));

            return currentBlock;
        }
开发者ID:mattleibow,项目名称:SaltarelleCompiler,代码行数:81,代码来源:SingleStateMachineRewriter.cs

示例5: VisitEntity

        protected override Expression VisitEntity(EntityExpression ee)
        {
            if (previousTypes.Contains(ee.Type) || IsCached(ee.Type) || ee.AvoidExpandOnRetrieving)
            {
                ee = new EntityExpression(ee.Type, ee.ExternalId, null, null, null, ee.AvoidExpandOnRetrieving);
            }
            else
                ee = binder.Completed(ee);

            previousTypes = previousTypes.Push(ee.Type);

            var bindings = ee.Bindings.NewIfChange(VisitFieldBinding);
            var mixins = ee.Mixins.NewIfChange(VisitMixinEntity);

            var id = Visit(ee.ExternalId);

            var result = new EntityExpression(ee.Type, id, ee.TableAlias, bindings, mixins, ee.AvoidExpandOnRetrieving);

            previousTypes = previousTypes.Pop();

            return result;
        }
开发者ID:nuub666,项目名称:framework,代码行数:22,代码来源:EntityCompleter.cs


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