Package org.openquark.cal.internal.javamodel.JavaStatement

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


    /* (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

            }

        } else
        if (statement instanceof ThrowStatement) {
            ThrowStatement throwStatement = (ThrowStatement)statement;
            emitLine(sb, indent, "throw " + getSource(throwStatement.getThrownExpression(), indent, 6, context) + ";");
        } else
        if (statement instanceof UnconditionalLoop) {
            UnconditionalLoop whileStatement = (UnconditionalLoop)statement;
            emitLine (sb, indent, whileStatement.getLabel() + ": while (true) {");
            sb.append(getSource(whileStatement.getBody(), context, indent + 1));
View Full Code Here

        constructorArgs[1] = new LocalVariable("caught_exception", exceptionType);
        constructorArgTypes[1] = JavaTypeName.THROWABLE;
        ClassInstanceCreationExpression nc =
            new ClassInstanceCreationExpression (JavaTypeNames.RTFOREIGN_FUNCTION_EXCEPTION, constructorArgs, constructorArgTypes);

        ThrowStatement throwSt = new ThrowStatement (nc);
        JavaExceptionHandler eh = new JavaExceptionHandler(exceptionClass, "caught_exception", throwSt);
        exceptionInfo.add(eh);
    }
View Full Code Here

         * @return a java statement that checks if quit is requested and takes appropriate action.
         */
        private static JavaStatement checkForQuit() {
            // Call RTExecutionContext.isQuitRequest() and if true throw RTValue.InterruptException
            MethodInvocation isQuitRequested = new MethodInvocation.Instance(SCJavaDefn.EXECUTION_CONTEXT_VAR, "isQuitRequested", JavaTypeName.BOOLEAN, MethodInvocation.InvocationType.VIRTUAL);
            ThrowStatement throwStatement = new ThrowStatement(new JavaExpression.JavaField.Static(JavaTypeNames.RTVALUE, "INTERRUPT_EXCEPTION", JavaTypeName.CAL_EXECUTOR_EXCEPTION));
            IfThenElseStatement conditional = new IfThenElseStatement(isQuitRequested, throwStatement);
            return conditional;
        }
View Full Code Here

TOP

Related Classes of org.openquark.cal.internal.javamodel.JavaStatement.ThrowStatement

Copyright © 2018 www.massapicom. 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.