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


C# StatementList类代码示例

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


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


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