• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# StatementList类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Statement

 internal Statement(IHost host)
     : base(host)
 {
     Attributes = new AttributeList(host);
     Children = new StatementList(host);
     Parameters = new ParameterList(host);
 }
开发者ID:darrelmiller,项目名称:Parrot,代码行数:7,代码来源:Statement.cs


示例2: TableRowStatement

 public TableRowStatement(String var, Expression value, StatementList attributes, StatementList statements)
 {
     _var= var;
     _value = value;
     _attributes = attributes;
     _statements = statements;
 }
开发者ID:virgil-palanciuc,项目名称:NLiquid,代码行数:7,代码来源:TableRowStatement.cs


示例3: VisitReturnValue

        public override Expression VisitReturnValue(ReturnValue returnValue)
        {
            // return a default value of the same type as the return value
            TypeNode returnType = returnValue.Type;
            ITypeParameter itp = returnType as ITypeParameter;
            if (itp != null)
            {
                Local loc = new Local(returnType);

                UnaryExpression loca = new UnaryExpression(loc, NodeType.AddressOf, loc.Type.GetReferenceType());
                StatementList statements = new StatementList(2);

                statements.Add(new AssignmentStatement(new AddressDereference(loca, returnType, false, 0),
                    new Literal(null, SystemTypes.Object)));

                statements.Add(new ExpressionStatement(loc));

                return new BlockExpression(new Block(statements), returnType);
            }

            if (returnType.IsValueType)
                return new Literal(0, returnType);
            
            return new Literal(null, returnType);
        }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:25,代码来源:CleanUpOldAndResult.cs


示例4: Parse

        public GeneratedCode Parse(List<Token> _tokens)
        {
            Dictionary<string, Function> Functions = new Dictionary<string, Function>();
            StatementList TopLevelStatements = new StatementList();
            Tokens = _tokens;
            Position = 0;

            GetNextToken(); //Initialize first token
            while (true)
            {
                if (CurToken.Type == TokenType.EOF)
                    break;
                if (CurToken.IsCharacter(";"))
                    GetNextToken(); //eat ;
                else if (CurToken.IsIdentifier("function"))
                {
                    Function func = ParseFunction();
                    Functions[func.Name] = func;
                }
                else
                    TopLevelStatements.Add(ParseStatement());
            }
            Function TopLevel = new Function(TopLevelStatements);
            return new GeneratedCode()
            {
                TopLevelStatements = TopLevel,
                Functions = Functions
            };
        }
开发者ID:12354,项目名称:Math-Evaluator,代码行数:29,代码来源:Parser.cs


示例5: ForStatement

 public ForStatement(StatementList Conditions, StatementList Body)
 {
     this.Initialize = Conditions[0];
     this.Condition = Conditions[1];
     this.Step = Conditions[2];
     this.Body = Body;
 }
开发者ID:12354,项目名称:Math-Evaluator,代码行数:7,代码来源:ForStatement.cs


示例6: Statement

 private Statement()
 {
     Attributes = new AttributeList();
     Children = new StatementList();
     Parameters = new ParameterList();
     IdentifierParts = new List<Identifier>();
     Errors = new List<ParserError>();
 }
开发者ID:ParrotFx,项目名称:Parrot,代码行数:8,代码来源:Statement.cs


示例7: Loop

 public Loop(string loopVariable, Expression from, string upDown, Expression to, Expression withClause, StatementList stmts)
 {
     LoopVariable = loopVariable;
     InitialValue = from;
     EndingValue = to;
     StepDirection = upDown;
     Step = withClause;
     Statements = stmts;
 }
开发者ID:thanakrit-promsiri,项目名称:tranche-net,代码行数:9,代码来源:Loop.cs


示例8: Normalizer

 public Normalizer(TypeSystem typeSystem){
   this.typeSystem = typeSystem;
   this.exitTargets = new StatementList();
   this.continueTargets = new StatementList();
   this.currentTryStatements = new Stack();
   this.exceptionBlockFor = new TrivialHashtable();
   this.visitedCompleteTypes = new TrivialHashtable();
   this.EndIfLabel = new TrivialHashtable();
   this.foreachLength = 7;
   this.WrapToBlockExpression = true;
   this.useGenerics = TargetPlatform.UseGenerics;
 }
开发者ID:dbremner,项目名称:specsharp,代码行数:12,代码来源:Normalizer.cs


示例9: UnlessStatement

        public UnlessStatement(Expression condition, StatementList unlessBranch,
                            StatementList elseBranch)
        {
            if (condition == null)
            {
                throw new ArgumentException("Invalid condition for IF statement.");
            }
            _conditionExpr = condition;

            _unlessBranchStatements = unlessBranch;
            _elseBranchStatements = elseBranch;
        }
开发者ID:virgil-palanciuc,项目名称:NLiquid,代码行数:12,代码来源:UnlessStatement.cs


示例10: Render

        public string Render(StatementList statements, object model)
        {
            var factory = _host.DependencyResolver.Resolve<IRendererFactory>();

            StringBuilder sb = new StringBuilder();
            foreach (var element in statements)
            {
                var renderer = factory.GetRenderer(element.Name);
                sb.AppendLine(renderer.Render(element, model));
            }

            return sb.ToString().Trim();
        }
开发者ID:darrelmiller,项目名称:Parrot,代码行数:13,代码来源:DocumentRenderer.cs


示例11: FilterStatement

 public FilterStatement(String filterName, StatementList args)
 {
     _filterName = filterName;
     _filter = Utils.LiquidFilters[filterName];
     if (args != null && args.Count > 0)
     {
         _arguments = new List<Expression>();
         foreach (var statement in args)
             if (statement is Expression)
                 _arguments.Add((Expression) statement);
             else
                 throw new ArgumentException(String.Format("Wrong argument to filter: {0}", statement.Print("")));
     }
 }
开发者ID:virgil-palanciuc,项目名称:NLiquid,代码行数:14,代码来源:FIlterStatement.cs


示例12: VisitBlock

 public override Block VisitBlock(Block block){
   if (block == null) return null;
   StatementList savedStatementList = this.CurrentStatementList;
   try{
     StatementList oldStatements = block.Statements;
     int n = oldStatements == null ? 0 : oldStatements.Length;
     StatementList newStatements = this.CurrentStatementList = block.Statements = new StatementList(n);
     for (int i = 0; i < n; i++)
       newStatements.Add((Statement)this.Visit(oldStatements[i]));
     return block;
   }finally{
     this.CurrentStatementList = savedStatementList;
   }
 }
开发者ID:hesam,项目名称:SketchSharp,代码行数:14,代码来源:Parser.cs


示例13: OutputStatement

        public OutputStatement(Expression expr, StatementList filters)
        {
            _expr = expr;
            if(filters!= null)
            {
                _filters = new List<FilterStatement>();
                foreach (var filter in filters)
                {
                    if(filter is FilterStatement)
                        _filters.Add(filter as FilterStatement);
                    else
                        throw new ArgumentException(filter.Print(""),"filters");
                }

            }
        }
开发者ID:virgil-palanciuc,项目名称:NLiquid,代码行数:16,代码来源:OutputStatement.cs


示例14: VisitBranch

 public override Statement VisitBranch(Branch branch){
   if (branch == null) return null;
   if (branch.Target == null) return null;
   branch.Condition = this.VisitExpression(branch.Condition);
   int n = this.localsStack.top+1;
   LocalsStack targetStack = (LocalsStack)this.StackLocalsAtEntry[branch.Target.UniqueKey];
   if (targetStack == null){
     this.StackLocalsAtEntry[branch.Target.UniqueKey] = this.localsStack.Clone();
     return branch;
   }
   //Target block has an entry stack that is different from the current stack. Need to copy stack before branching.
   if (n <= 0) return branch; //Empty stack, no need to copy
   StatementList statements = new StatementList(n+1);
   this.localsStack.Transfer(targetStack, statements);
   statements.Add(branch);
   return new Block(statements);
 }
开发者ID:tapicer,项目名称:resource-contracts-.net,代码行数:17,代码来源:Unstacker.cs


示例15: VisitStatementList

        public override void VisitStatementList(StatementList statements)
        {
            if (statements == null) return;

            for (int i = 0; i < statements.Count; i++)
            {
                var stmt = statements[i];
                if (stmt == null) continue;

                if (stmt.SourceContext.IsValid)
                {
                    this.currentSourceContext = stmt.SourceContext;
                }

                this.Visit(stmt);
            }
        }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:17,代码来源:ScrubContractClass.cs


示例16: VisitStatementList

        public override StatementList VisitStatementList(StatementList statements)
        {
            var oldSL = this.currentSL;
            var oldSLi = this.currentSLindex;
            this.currentSL = statements;

            try
            {
                if (statements == null) return null;
                for (int i = 0, n = statements.Count; i < n; i++)
                {
                    this.currentSLindex = i;
                    statements[i] = (Statement) this.Visit(statements[i]);
                }
                return statements;
            }
            finally
            {
                this.currentSLindex = oldSLi;
                this.currentSL = oldSL;
            }
        }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:22,代码来源:ExtractionFinalizer.cs


示例17: VisitReturn

        //public override Block VisitBlock(Block block) {
        //  if(block.Statements != null && block.Statements.Count == 1) {
        //    Return r = block.Statements[0] as Return;
        //    if(r != null) {
        //      Statement s = this.VisitReturn(r);
        //      Block retBlock = s as Block;
        //      if(retBlock != null) {
        //        block.Statements = retBlock.Statements;
        //        return block;
        //      } else {
        //        return base.VisitBlock(block);
        //      }
        //    } else {
        //      return base.VisitBlock(block);
        //    }
        //  } else {
        //    return base.VisitBlock(block);
        //  }
        //}

        public override Statement VisitReturn(Return Return)
        {
            if (Return == null)
            {
                return null;
            }

            returnCount++;
            this.lastReturnSourceContext = Return.SourceContext;

            StatementList stmts = new StatementList();

            Return.Expression = this.VisitExpression(Return.Expression);

            if (Return.Expression != null)
            {
                MethodCall mc = Return.Expression as MethodCall;
                if (mc != null && mc.IsTailCall)
                {
                    mc.IsTailCall = false;
                }

                var assgnmt = new AssignmentStatement(result, Return.Expression);

                assgnmt.SourceContext = Return.SourceContext;
                stmts.Add(assgnmt);
            }

            // the branch is a "leave" out of the try block that the body will be
            // in.
            var branch = new Branch(null, newExit, false, false, this.leaveExceptionBody);
            branch.SourceContext = Return.SourceContext;

            stmts.Add(branch);

            return new Block(stmts);
        }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:57,代码来源:ReplaceReturns.cs


示例18: Visit

        protected void Visit(StatementList statementList)
        {
            for (int i = 0; i < statementList.Count; i++)
            {
                var statement = statementList[i];
                var ifStatement = statement as IfStatement;
                if (ifStatement != null)
                {
                    var result = evaluator.Evaluate(ifStatement.Condition);
                    if (result.HasErrors)
                    {
                        continue;
                    }
                    statementList[i] = result.Value == 1.0 ? ifStatement.Then : ifStatement.Else;
                    if (statementList[i] == null)
                    {
                        statementList.RemoveAt(i);
                    }
                    i--;
                }
            }

            Visit((Node)statementList);
        }
开发者ID:Powerino73,项目名称:paradox,代码行数:24,代码来源:ExpressionSimplifierVisitor.cs


示例19: Visit

        /// <summary>
        /// Visits the ForEachStatement Node and collects information from it.
        /// </summary>
        /// <param name="forEachStatement">The ForEachStatement</param>
        public override Node Visit(ForEachStatement forEachStatement)
        {
            if (expandForEachStatements)
            {
                // run analysis on collection
                VisitDynamic(forEachStatement.Collection);

                var inference = forEachStatement.Collection.TypeInference.Declaration as Variable;
                if (!(inference != null && inference.Type is ArrayType))
                    return forEachStatement;

                if ((inference.Type as ArrayType).Dimensions.Count > 1)
                {
                    Error(XenkoMessageCode.ErrorMultiDimArray, forEachStatement.Span, inference, forEachStatement, analyzedModuleMixin.MixinName);
                    return forEachStatement;
                }

                var dim = (int)((inference.Type as ArrayType).Dimensions.FirstOrDefault() as LiteralExpression).Value;

                var result = new StatementList();
                for (int i = 0; i < dim; ++i)
                {
                    var cloned = forEachStatement.DeepClone();
                    var replace = new XenkoReplaceExtern(cloned.Variable, new IndexerExpression(cloned.Collection, new LiteralExpression(i)));
                    replace.Run(cloned.Body);
                    result.Add(cloned.Body);
                }

                VisitDynamic(result);
                return result;
            }
            else
            {
                base.Visit(forEachStatement);
                parsingInfo.ForEachStatements.Add(new StatementNodeCouple(forEachStatement, ParentNode));
                return forEachStatement;
            }
        }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:42,代码来源:XenkoSemanticAnalysis.cs


示例20: VisitStatementList

            public override void VisitStatementList(StatementList statements)
            {
                if (statements == null) return;

                for (int i = 0; i < statements.Count; i++)
                {
                    var st = statements[i];
                    if (st != null && st.SourceContext.IsValid)
                    {
                        lastSC = st.SourceContext;
                    }
                    
                    this.Visit(st);
                }
            }
开发者ID:Yatajga,项目名称:CodeContracts,代码行数:15,代码来源:PostExtractorChecker.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# StatementSink类代码示例发布时间:2022-05-24
下一篇:
C# Statement类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap