本文整理汇总了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);
}
}
示例2: NewScope
public IDisposable NewScope()
{
scopes = scopes.Push(new Dictionary<ColumnExpression, Expression>());
return new Disposable(() => scopes = scopes.Pop());
}
示例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;
}
示例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;
}
示例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;
}