示例#1
0
        public BlockNode?PopBlock(Type type)
        {
            if (stack.Count() <= 1)
            {
                AddError(true, "No {0} has been opened".FormatWith(BlockNode.UserString(type)));
                return(null);
            }
            var n = stack.Pop();

            Variables = Variables.Previous !;
            if (n.owner == null || n.owner.GetType() != type)
            {
                AddError(true, "Unexpected '{0}'".FormatWith(BlockNode.UserString(n.owner?.GetType())));
                return(null);
            }
            return(n);
        }