Java Code Examples for org.mozilla.javascript.Token#TARGET

The following examples show how to use org.mozilla.javascript.Token#TARGET . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Jump.java    From JsDroidCmd with Mozilla Public License 2.0 5 votes vote down vote up
public void setDefault(Node defaultTarget)
{
    if (type != Token.SWITCH) codeBug();
    if (defaultTarget.getType() != Token.TARGET) codeBug();
    if (target2 != null) codeBug(); //only once
    target2 = defaultTarget;
}
 
Example 2
Source File: Jump.java    From JsDroidCmd with Mozilla Public License 2.0 5 votes vote down vote up
public void setFinally(Node finallyTarget)
{
    if (type != Token.TRY) codeBug();
    if (finallyTarget.getType() != Token.TARGET) codeBug();
    if (target2 != null) codeBug(); //only once
    target2 = finallyTarget;
}
 
Example 3
Source File: Jump.java    From JsDroidCmd with Mozilla Public License 2.0 5 votes vote down vote up
public void setContinue(Node continueTarget)
{
    if (type != Token.LOOP) codeBug();
    if (continueTarget.getType() != Token.TARGET) codeBug();
    if (target2 != null) codeBug(); //only once
    target2 = continueTarget;
}
 
Example 4
Source File: Jump.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void setDefault(Node defaultTarget)
{
    if (type != Token.SWITCH) codeBug();
    if (defaultTarget.getType() != Token.TARGET) codeBug();
    if (target2 != null) codeBug(); //only once
    target2 = defaultTarget;
}
 
Example 5
Source File: Jump.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void setFinally(Node finallyTarget)
{
    if (type != Token.TRY) codeBug();
    if (finallyTarget.getType() != Token.TARGET) codeBug();
    if (target2 != null) codeBug(); //only once
    target2 = finallyTarget;
}
 
Example 6
Source File: Jump.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void setContinue(Node continueTarget)
{
    if (type != Token.LOOP) codeBug();
    if (continueTarget.getType() != Token.TARGET) codeBug();
    if (target2 != null) codeBug(); //only once
    target2 = continueTarget;
}
 
Example 7
Source File: AstNode.java    From JsDroidCmd with Mozilla Public License 2.0 4 votes vote down vote up
@Override
public boolean hasSideEffects()
{
    switch (getType()) {
      case Token.ASSIGN:
      case Token.ASSIGN_ADD:
      case Token.ASSIGN_BITAND:
      case Token.ASSIGN_BITOR:
      case Token.ASSIGN_BITXOR:
      case Token.ASSIGN_DIV:
      case Token.ASSIGN_LSH:
      case Token.ASSIGN_MOD:
      case Token.ASSIGN_MUL:
      case Token.ASSIGN_RSH:
      case Token.ASSIGN_SUB:
      case Token.ASSIGN_URSH:
      case Token.BLOCK:
      case Token.BREAK:
      case Token.CALL:
      case Token.CATCH:
      case Token.CATCH_SCOPE:
      case Token.CONST:
      case Token.CONTINUE:
      case Token.DEC:
      case Token.DELPROP:
      case Token.DEL_REF:
      case Token.DO:
      case Token.ELSE:
      case Token.ENTERWITH:
      case Token.ERROR:         // Avoid cascaded error messages
      case Token.EXPORT:
      case Token.EXPR_RESULT:
      case Token.FINALLY:
      case Token.FUNCTION:
      case Token.FOR:
      case Token.GOTO:
      case Token.IF:
      case Token.IFEQ:
      case Token.IFNE:
      case Token.IMPORT:
      case Token.INC:
      case Token.JSR:
      case Token.LABEL:
      case Token.LEAVEWITH:
      case Token.LET:
      case Token.LETEXPR:
      case Token.LOCAL_BLOCK:
      case Token.LOOP:
      case Token.NEW:
      case Token.REF_CALL:
      case Token.RETHROW:
      case Token.RETURN:
      case Token.RETURN_RESULT:
      case Token.SEMI:
      case Token.SETELEM:
      case Token.SETELEM_OP:
      case Token.SETNAME:
      case Token.SETPROP:
      case Token.SETPROP_OP:
      case Token.SETVAR:
      case Token.SET_REF:
      case Token.SET_REF_OP:
      case Token.SWITCH:
      case Token.TARGET:
      case Token.THROW:
      case Token.TRY:
      case Token.VAR:
      case Token.WHILE:
      case Token.WITH:
      case Token.WITHEXPR:
      case Token.YIELD:
        return true;

      default:
        return false;
    }
}
 
Example 8
Source File: AstNode.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
public boolean hasSideEffects()
{
    switch (getType()) {
      case Token.ASSIGN:
      case Token.ASSIGN_ADD:
      case Token.ASSIGN_BITAND:
      case Token.ASSIGN_BITOR:
      case Token.ASSIGN_BITXOR:
      case Token.ASSIGN_DIV:
      case Token.ASSIGN_LSH:
      case Token.ASSIGN_MOD:
      case Token.ASSIGN_MUL:
      case Token.ASSIGN_RSH:
      case Token.ASSIGN_SUB:
      case Token.ASSIGN_URSH:
      case Token.BLOCK:
      case Token.BREAK:
      case Token.CALL:
      case Token.CATCH:
      case Token.CATCH_SCOPE:
      case Token.CONST:
      case Token.CONTINUE:
      case Token.DEC:
      case Token.DELPROP:
      case Token.DEL_REF:
      case Token.DO:
      case Token.ELSE:
      case Token.ENTERWITH:
      case Token.ERROR:         // Avoid cascaded error messages
      case Token.EXPORT:
      case Token.EXPR_RESULT:
      case Token.FINALLY:
      case Token.FUNCTION:
      case Token.FOR:
      case Token.GOTO:
      case Token.IF:
      case Token.IFEQ:
      case Token.IFNE:
      case Token.IMPORT:
      case Token.INC:
      case Token.JSR:
      case Token.LABEL:
      case Token.LEAVEWITH:
      case Token.LET:
      case Token.LETEXPR:
      case Token.LOCAL_BLOCK:
      case Token.LOOP:
      case Token.NEW:
      case Token.REF_CALL:
      case Token.RETHROW:
      case Token.RETURN:
      case Token.RETURN_RESULT:
      case Token.SEMI:
      case Token.SETELEM:
      case Token.SETELEM_OP:
      case Token.SETNAME:
      case Token.SETPROP:
      case Token.SETPROP_OP:
      case Token.SETVAR:
      case Token.SET_REF:
      case Token.SET_REF_OP:
      case Token.SWITCH:
      case Token.TARGET:
      case Token.THROW:
      case Token.TRY:
      case Token.VAR:
      case Token.WHILE:
      case Token.WITH:
      case Token.WITHEXPR:
      case Token.YIELD:
        return true;

      default:
        return false;
    }
}