Examples of ThrowStatement


Examples of org.eclipse.jdt.core.dom.ThrowStatement

     *
     * @param type exception type
     * @param text
     */
    public void addThrowException(String type, String text) {
        ThrowStatement thrwstmt = m_ast.newThrowStatement();
        ClassInstanceCreation exexpr = m_ast.newClassInstanceCreation();
        exexpr.setType(m_ast.newSimpleType(m_ast.newSimpleName(type)));
        exexpr.arguments().add(stringLiteral(text));
        thrwstmt.setExpression(exexpr);
        m_block.statements().add(thrwstmt);
    }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.ThrowStatement

     *
     * @param type exception type
     * @param expr initializer expression
     */
    public void addThrowException(String type, ExpressionBuilderBase expr) {
        ThrowStatement thrwstmt = m_ast.newThrowStatement();
        ClassInstanceCreation exexpr = m_ast.newClassInstanceCreation();
        exexpr.setType(m_ast.newSimpleType(m_ast.newSimpleName(type)));
        exexpr.arguments().add(expr.getExpression());
        thrwstmt.setExpression(exexpr);
        m_block.statements().add(thrwstmt);
    }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.ThrowStatement

    SimpleType exType = ast.newSimpleType(exName);
    ClassInstanceCreation newExType = ast.newClassInstanceCreation();
    newExType.setType(exType);

    ThrowStatement statement = ast.newThrowStatement();
    statement.setExpression(newExType);
    block.statements().add(statement);
  }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.ThrowStatement

    SimpleName uoe = ast.newSimpleName("UnsupportedOperationException");
    SimpleType uoeType = ast.newSimpleType(uoe);
    ClassInstanceCreation newUoeType = ast.newClassInstanceCreation();
    newUoeType.setType(uoeType);

    ThrowStatement statement = ast.newThrowStatement();
    statement.setExpression(newUoeType);
    body.statements().add(statement);

    return input;
  }
View Full Code Here

Examples of org.eclipse.jdt.core.dom.ThrowStatement

    SimpleName uoe = ast.newSimpleName("UnsupportedOperationException");
    SimpleType uoeType = ast.newSimpleType(uoe);
    ClassInstanceCreation newUoeType = ast.newClassInstanceCreation();
    newUoeType.setType(uoeType);

    ThrowStatement statement = ast.newThrowStatement();
    statement.setExpression(newUoeType);
    body.statements().add(statement);

    return input;
  }
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.ast.ThrowStatement

  this.modifiersSourceStart = -1; // <-- see comment into modifiersFlag(int)
}
protected void consumeStatementThrow() {
  // ThrowStatement ::= 'throw' Expression ';'
  this.expressionLengthPtr--;
  pushOnAstStack(new ThrowStatement(this.expressionStack[this.expressionPtr--], this.intStack[this.intPtr--], this.endStatementPosition));
}
View Full Code Here

Examples of org.lilystudio.javascript.statement.ThrowStatement

    case Token.LABEL:
      return new LabelStatement(node, root, scope);

    case Token.THROW:
      return new ThrowStatement(node, root, scope);

    case Token.FUNCTION:
      return new FunctionStatement(node, root, scope);

    default:
View Full Code Here

Examples of org.mozilla.javascript.ast.ThrowStatement

    return node;
  }

  @Override
  public AstNode throwStatement(AstNode expr) {
    ThrowStatement s = new ThrowStatement();
    s.setExpression(expr);
    return s;
  }
View Full Code Here

Examples of org.openquark.cal.internal.javamodel.JavaStatement.ThrowStatement

        } else {
            createAssertionError =
                new ClassInstanceCreationExpression(JavaTypeName.ASSERTION_ERROR);
        }
        JavaStatement.ThrowStatement throwAssertError =
            new ThrowStatement(createAssertionError);
       
        // if (!conditionExpr) {throw new AssertionError();}
        IfThenElseStatement ifThen =
            new IfThenElseStatement(new OperatorExpression.Unary(JavaOperator.LOGICAL_NEGATE, assertStatement.getConditionExpr()), throwAssertError);
       
View Full Code Here

Examples of org.openquark.cal.internal.javamodel.JavaStatement.ThrowStatement

    /* (non-Javadoc)
     * @see org.openquark.cal.internal.runtime.lecc.JavaModelVisitor#visitThrowStatement(org.openquark.cal.internal.runtime.lecc.JavaStatement.ThrowStatement, java.lang.Object)
     */
    public JavaStatement visitThrowStatement(ThrowStatement throwStatement, T arg) {
        return new ThrowStatement (
                (JavaExpression)throwStatement.getThrownExpression().accept(this, arg));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.