Exemplo n.º 1
0
 private ICodegenBlock IfInstanceOf(string name, Type clazz, bool not)
 {
     CheckClosed();
     var ifStmt = new CodegenStatementIf(this);
     ICodegenExpression condition = !not ?
         CodegenExpressionBuilder.InstanceOf(CodegenExpressionBuilder.Ref(name), clazz) :
         CodegenExpressionBuilder.NotInstanceOf(CodegenExpressionBuilder.Ref(name), clazz);
     var block = new CodegenBlock(ifStmt);
     ifStmt.Add(condition, block);
     _statements.Add(ifStmt);
     return block;
 }
Exemplo n.º 2
0
 public ICodegenBlock BlockElseIf(ICodegenExpression condition)
 {
     if (_parentMethod != null)
     {
         throw new IllegalStateException("Else-If in a method-level block?");
     }
     if (!(_parentWBlock is CodegenStatementIf))
     {
         throw new IllegalStateException("Else_if in a non-if block?");
     }
     CodegenStatementIf ifStmt = (CodegenStatementIf)_parentWBlock;
     CheckClosed();
     _closed = true;
     var block = new CodegenBlock(_parentWBlock);
     ifStmt.Add(condition, block);
     return block;
 }