Gets a context for a `throw` statement.

@param {CodePathState} state - A state to get.
@returns {TryContext|CodePathState} A context for a `throw` statement.
178375
function getThrowContext(state) {
    let context = state.tryContext;

    while (context) {
        if (context.position === "try" ||
            (context.hasFinalizer && context.position === "catch")
        ) {
            return context;
        }
        context = context.upper;
    }

    return state;
}
652914
function determineContext( scope ) {
   let current = scope;
   while( !current.hasOwnProperty( 'widget' ) && current !== current.$root ) {
      current = current.$parent;
   }

   const isInWidget = !!current.widget;

   return {
      widgetName: isInWidget ? current.widget.path : '',
      widgetId: isInWidget ? current.widget.id : '',
      widgetScopeId: isInWidget ? current.$id : null,
      scopeId: scope.$id
   };
}
1138662
@Override
    public Object saveState(FacesContext context) {
        if (context == null) {
            throw new NullPointerException();
        }

        Object[] result = null;
        
        Object superState = super.saveState(context);
        Object validatorsState = ((validators != null) ? validators.saveState(context) : null);
        
        if (superState != null || validatorsState != null) {
            result = new Object[] { superState, validatorsState};
        }
        
        return (result);
    }
344913
function() {
			var context = this.tryContext;
			var forkContext = this.forkContext;
			var thrown = context.thrownForkContext;

			// Update state.
			context.position = "catch";
			context.thrownForkContext = ForkContext.newEmpty(forkContext);
			context.lastOfTryIsReachable = forkContext.reachable;

			// Merge thrown paths.
			thrown.add(forkContext.head);
			var thrownSegments = thrown.makeNext(0, -1);

			// Fork to a bypass and the merged thrown path.
			this.pushForkContext();
			this.forkBypassPath();
			this.forkContext.add(thrownSegments);
		}
654563
function popContext(state) {
        if (state.context) {
            var oldContext = state.context;
            state.context = oldContext.prev;
            return oldContext;
        }
        
        // we shouldn't be here - it means we didn't have a context to pop
        return null;
    }
572262
public static Throwable getUltimateCause(final Throwable throwable) {
    if (throwable.getCause() == null) {
      return throwable;
    } else {
      return getUltimateCause(throwable.getCause());
    }
  }
1314116
function parseThrowStatement() {
        var argument;

        expectKeyword('throw');

        if (peekLineTerminator()) {
            throwError({}, Messages.NewlineAfterThrow);
        }

        argument = parseExpression();

        consumeSemicolon();

        return {
            type: Syntax.ThrowStatement,
            argument: argument
        };
    }
1094845
function getThrowStatementOwner(throwStatement) {
                    var child = throwStatement;
                    while (child.parent) {
                        var parent_22 = child.parent;
                        if (ts.isFunctionBlock(parent_22) || parent_22.kind === 256 /* SourceFile */) {
                            return parent_22;
                        }
                        // A throw-statement is only owned by a try-statement if the try-statement has
                        // a catch clause, and if the throw-statement occurs within the try block.
                        if (parent_22.kind === 216 /* TryStatement */) {
                            var tryStatement = parent_22;
                            if (tryStatement.tryBlock === child && tryStatement.catchClause) {
                                return child;
                            }
                        }
                        child = parent_22;
                    }
                    return undefined;
                }
1312670
def state(self, context):
	
		
		
		state = None
		for line in self.read(context, [
			"status",
			context.resolve(self.__name)
		]):
			if line[2] == "state":
				state = line[3].strip()
		return state
97148
public void restoreState(FacesContext context, Object state) {

        if (context == null) {
            throw new NullPointerException();
        }
        if (state == null) {
            return;
        }
        methodExpressionOneArg = (MethodExpression) ((Object[]) state)[0];
        methodExpressionZeroArg = (MethodExpression) ((Object[]) state)[1];

    }
1126301
void get_context(final State s, Context ctx)
    {
        ctx.S0 = (s.stack.size() > 0 ? s.stack.get(s.stack.size() - 1) : -1);
        ctx.S1 = (s.stack.size() > 1 ? s.stack.get(s.stack.size() - 2) : -1);
        ctx.S2 = (s.stack.size() > 2 ? s.stack.get(s.stack.size() - 3) : -1);
        ctx.N0 = (s.buffer < s.ref.size() ? s.buffer : -1);
        ctx.N1 = (s.buffer + 1 < s.ref.size() ? s.buffer + 1 : -1);
        ctx.N2 = (s.buffer + 2 < s.ref.size() ? s.buffer + 2 : -1);

        ctx.S0L = (ctx.S0 >= 0 ? s.left_most_child.get(ctx.S0) : -1);
        ctx.S0R = (ctx.S0 >= 0 ? s.right_most_child.get(ctx.S0) : -1);
        ctx.S0L2 = (ctx.S0 >= 0 ? s.left_2nd_most_child.get(ctx.S0) : -1);
        ctx.S0R2 = (ctx.S0 >= 0 ? s.right_2nd_most_child.get(ctx.S0) : -1);
        ctx.S0LL = (ctx.S0L >= 0 ? s.left_most_child.get(ctx.S0L) : -1);
        ctx.S0RR = (ctx.S0R >= 0 ? s.right_most_child.get(ctx.S0R) : -1);

        ctx.S1L = (ctx.S1 >= 0 ? s.left_most_child.get(ctx.S1) : -1);
        ctx.S1R = (ctx.S1 >= 0 ? s.right_most_child.get(ctx.S1) : -1);
        ctx.S1L2 = (ctx.S1 >= 0 ? s.left_2nd_most_child.get(ctx.S1) : -1);
        ctx.S1R2 = (ctx.S1 >= 0 ? s.right_2nd_most_child.get(ctx.S1) : -1);
        ctx.S1LL = (ctx.S1L >= 0 ? s.left_most_child.get(ctx.S1L) : -1);
        ctx.S1RR = (ctx.S1R >= 0 ? s.right_most_child.get(ctx.S1R) : -1);
    }
1139272
private static boolean isCallToFail(StatementTree then, VisitorState state) {
    while (then.getKind() == BLOCK) {
      List<? extends StatementTree> statements = ((BlockTree) then).getStatements();
      if (statements.size() != 1) {
        return false;
      }
      then = getOnlyElement(statements);
    }
    if (then.getKind() != EXPRESSION_STATEMENT) {
      return false;
    }
    ExpressionTree thenExpr = ((ExpressionStatementTree) then).getExpression();
    if (thenExpr.getKind() != METHOD_INVOCATION) {
      return false;
    }
    MethodInvocationTree thenCall = (MethodInvocationTree) thenExpr;
    ExpressionTree methodSelect = thenCall.getMethodSelect();
    if (methodSelect.getKind() != IDENTIFIER) {
      return false;
      // TODO(cpovirk): Handle "this.fail(...)," etc.
    }
    // TODO(cpovirk): Support *all* fail methods.
    return LEGACY_FAIL_METHOD.matches(methodSelect, state);
  }
314695
function getContext() {
	const ctx = java.lang.Class.forName("android.app.AppGlobals").getMethod("getInitialApplication", null).invoke(null, null);
	if (ctx) { return ctx; }

	return java.lang.Class.forName("android.app.ActivityThread").getMethod("currentApplication", null).invoke(null, null);
}
328912
function factory(key, state, ctx) {
  return enter

  function enter() {
    var context = ctx || this
    var current = context[key]

    context[key] = !state

    return exit

    function exit() {
      context[key] = current
    }
  }
}
946951
function() {
    var finalState = this.finalState, initialState;

    while(true) {
      initialState = get(finalState, 'initialState') || 'start';
      finalState = get(finalState, 'states.' + initialState);

      if (!finalState) { break; }

      this.finalState = finalState;
      this.enterStates.push(finalState);
      this.contexts.push(undefined);
    }
  }
800722
function stateStr(state) {
    if (state & STATE_CANCELLED) {
        return 'cancel';
    } else if (state & STATE_ENDED) {
        return 'end';
    } else if (state & STATE_CHANGED) {
        return 'move';
    } else if (state & STATE_BEGAN) {
        return 'start';
    }
    return '';
}
187058
ExecutionLocation getLocation(ParserRuleContext object) {
    Token start = object.getStart();
    return new ExecutionLocation(currentScope.declaringEnvironment.path, start.getLine(), start.getCharPositionInLine() + 1);
  }