本文整理汇总了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);
}
示例2: TableRowStatement
public TableRowStatement(String var, Expression value, StatementList attributes, StatementList statements)
{
_var= var;
_value = value;
_attributes = attributes;
_statements = statements;
}
示例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);
}
示例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
};
}
示例5: ForStatement
public ForStatement(StatementList Conditions, StatementList Body)
{
this.Initialize = Conditions[0];
this.Condition = Conditions[1];
this.Step = Conditions[2];
this.Body = Body;
}
示例6: Statement
private Statement()
{
Attributes = new AttributeList();
Children = new StatementList();
Parameters = new ParameterList();
IdentifierParts = new List<Identifier>();
Errors = new List<ParserError>();
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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("")));
}
}
示例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;
}
}
示例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");
}
}
}
示例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);
}
示例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);
}
}