本文整理汇总了C#中Mono.CSharp.Statement类的典型用法代码示例。如果您正苦于以下问题:C# Statement类的具体用法?C# Statement怎么用?C# Statement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Statement类属于Mono.CSharp命名空间,在下文中一共展示了Statement类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CloneTo
protected override void CloneTo (CloneContext clonectx, Statement t)
{
Catch target = (Catch) t;
if (type_expr != null)
target.type_expr = (FullNamedExpression) type_expr.Clone (clonectx);
target.block = clonectx.LookupBlock (block);
}
开发者ID:alisci01,项目名称:mono,代码行数:9,代码来源:statement.cs
示例2: CloneTo
protected override void CloneTo(CloneContext clonectx, Statement target)
{
throw new NotSupportedException ();
}
开发者ID:speier,项目名称:shake,代码行数:4,代码来源:iterators.cs
示例3: Visit
public override object Visit (Statement stmt)
{
Console.WriteLine ("unknown statement:" + stmt);
return null;
}
开发者ID:pgoron,项目名称:monodevelop,代码行数:5,代码来源:CSharpParser.cs
示例4: Add
public void Add (Statement statement)
{
statements.Add (statement);
}
开发者ID:alisci01,项目名称:mono,代码行数:4,代码来源:statement.cs
示例5: RewriteForDeclarators
public Statement RewriteForDeclarators (BlockContext bc, Statement stmt)
{
for (int i = declarators.Count - 1; i >= 0; --i) {
var d = declarators [i];
var vd = new VariableDeclaration (d.Variable, type_expr.Location);
vd.Initializer = d.Initializer;
vd.IsNested = true;
vd.dispose_call = CreateDisposeCall (bc, d.Variable);
vd.dispose_call.Resolve (bc);
stmt = new Using (vd, stmt, d.Variable.Location);
}
declarators = null;
return stmt;
}
开发者ID:alisci01,项目名称:mono,代码行数:16,代码来源:statement.cs
示例6: Using
public Using (VariableDeclaration decl, Statement stmt, Location loc)
: base (stmt, loc)
{
this.decl = decl;
}
开发者ID:alisci01,项目名称:mono,代码行数:5,代码来源:statement.cs
示例7: ResolveInitializer
protected override Expression ResolveInitializer (BlockContext bc, LocalVariable li, Expression initializer)
{
Assign assign;
if (li.Type == InternalType.Dynamic) {
initializer = initializer.Resolve (bc);
if (initializer == null)
return null;
initializer = Convert.ImplicitConversionRequired (bc, initializer, TypeManager.idisposable_type, loc);
if (initializer == null)
return null;
var var = LocalVariable.CreateCompilerGenerated (TypeManager.idisposable_type, bc.CurrentBlock, loc);
assign = new SimpleAssign (var.CreateReferenceExpression (bc, loc), initializer, loc);
assign.ResolveStatement (bc);
dispose_call = CreateDisposeCall (bc, var);
dispose_call.Resolve (bc);
return assign;
}
if (li == Variable) {
CheckIDiposableConversion (bc, li, initializer);
dispose_call = CreateDisposeCall (bc, li);
dispose_call.Resolve (bc);
}
return base.ResolveInitializer (bc, li, initializer);
}
开发者ID:alisci01,项目名称:mono,代码行数:30,代码来源:statement.cs
示例8: TryFinally
public TryFinally (Statement stmt, Block fini, Location loc)
: base (stmt, loc)
{
this.fini = fini;
}
开发者ID:alisci01,项目名称:mono,代码行数:5,代码来源:statement.cs
示例9: For
public For (Statement init_statement,
BooleanExpression test,
Statement increment,
Statement statement,
Location l)
{
InitStatement = init_statement;
Test = test;
Increment = increment;
Statement = statement;
loc = l;
}
开发者ID:alisci01,项目名称:mono,代码行数:12,代码来源:statement.cs
示例10: StatementList
public StatementList (Statement first, Statement second)
{
statements = new List<Statement> () { first, second };
}
开发者ID:alisci01,项目名称:mono,代码行数:4,代码来源:statement.cs
示例11: ArrayForeach
public ArrayForeach (Foreach @foreach, int rank)
{
for_each = @foreach;
statement = for_each.statement;
loc = @foreach.loc;
variable = new LocalVariableReference (for_each.variable, loc);
counter = new StatementExpression[rank];
variables = new TemporaryVariableReference[rank];
length_exprs = new Expression [rank];
//
// Only use temporary length variables when dealing with
// multi-dimensional arrays
//
if (rank > 1)
lengths = new TemporaryVariableReference [rank];
}
开发者ID:alisci01,项目名称:mono,代码行数:18,代码来源:statement.cs
示例12: Body
public Body (TypeSpec type, LocalVariable variable,
Expression current, Statement statement,
Location loc)
{
this.type = type;
this.variable = new LocalVariableReference (variable, loc);
this.current = current;
this.statement = statement;
this.loc = loc;
}
开发者ID:alisci01,项目名称:mono,代码行数:10,代码来源:statement.cs
示例13: Foreach
public Foreach (Expression type, LocalVariable var, Expression expr, Statement stmt, Location l)
{
this.type = type;
this.variable = var;
this.expr = expr;
statement = stmt;
loc = l;
}
开发者ID:alisci01,项目名称:mono,代码行数:8,代码来源:statement.cs
示例14: DynamicEventCompoundAssign
public DynamicEventCompoundAssign(string name, Arguments args, ExpressionStatement assignment, ExpressionStatement invoke, Location loc)
: base(null, args, loc)
{
this.name = name;
base.binder = this;
// Used by += or -= only
type = TypeManager.bool_type;
condition = new If (
new Binary (Binary.Operator.Equality, this, new BoolLiteral (true, loc), loc),
new StatementExpression (invoke), new StatementExpression (assignment),
loc);
}
开发者ID:speier,项目名称:shake,代码行数:14,代码来源:dynamic.cs
示例15: CloneTo
protected override void CloneTo (CloneContext clonectx, Statement target)
{
// Nothing to clone
}
开发者ID:rabink,项目名称:mono,代码行数:4,代码来源:anonymous.cs
示例16: Resolve
public override bool Resolve (BlockContext ec)
{
bool is_dynamic = expr.Type == InternalType.Dynamic;
if (is_dynamic) {
expr = Convert.ImplicitConversionRequired (ec, expr, TypeManager.ienumerable_type, loc);
} else if (TypeManager.IsNullableType (expr.Type)) {
expr = new Nullable.UnwrapCall (expr).Resolve (ec);
}
var get_enumerator_mg = ResolveGetEnumerator (ec);
if (get_enumerator_mg == null) {
return false;
}
var get_enumerator = get_enumerator_mg.BestCandidate;
enumerator_variable = TemporaryVariableReference.Create (get_enumerator.ReturnType, variable.Block, loc);
enumerator_variable.Resolve (ec);
// Prepare bool MoveNext ()
var move_next_mg = ResolveMoveNext (ec, get_enumerator);
if (move_next_mg == null) {
return false;
}
move_next_mg.InstanceExpression = enumerator_variable;
// Prepare ~T~ Current { get; }
var current_prop = ResolveCurrent (ec, get_enumerator);
if (current_prop == null) {
return false;
}
var current_pe = new PropertyExpr (current_prop, loc) { InstanceExpression = enumerator_variable }.Resolve (ec);
if (current_pe == null)
return false;
VarExpr ve = var_type as VarExpr;
if (ve != null) {
if (is_dynamic) {
// Source type is dynamic, set element type to dynamic too
var_type = new TypeExpression (InternalType.Dynamic, var_type.Location);
} else {
// Infer implicitly typed local variable from foreach enumerable type
var_type = new TypeExpression (current_pe.Type, var_type.Location);
}
} else if (is_dynamic) {
// Explicit cast of dynamic collection elements has to be done at runtime
current_pe = EmptyCast.Create (current_pe, InternalType.Dynamic);
}
var_type = var_type.ResolveAsTypeTerminal (ec, false);
if (var_type == null)
return false;
variable.Type = var_type.Type;
var init = new Invocation (get_enumerator_mg, null);
statement = new While (new BooleanExpression (new Invocation (move_next_mg, null)),
new Body (var_type.Type, variable, current_pe, statement, loc), loc);
var enum_type = enumerator_variable.Type;
//
// Add Dispose method call when enumerator can be IDisposable
//
if (!enum_type.ImplementsInterface (TypeManager.idisposable_type, false)) {
if (!enum_type.IsSealed && !TypeManager.IsValueType (enum_type)) {
//
// Runtime Dispose check
//
var vd = new RuntimeDispose (enumerator_variable.LocalInfo, loc);
vd.Initializer = init;
statement = new Using (vd, statement, loc);
} else {
//
// No Dispose call needed
//
this.init = new SimpleAssign (enumerator_variable, init);
this.init.Resolve (ec);
}
} else {
//
// Static Dispose check
//
var vd = new Using.VariableDeclaration (enumerator_variable.LocalInfo, loc);
vd.Initializer = init;
statement = new Using (vd, statement, loc);
}
return statement.Resolve (ec);
}
开发者ID:alisci01,项目名称:mono,代码行数:93,代码来源:statement.cs
注:本文中的Mono.CSharp.Statement类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论