Cases for the invocation of the scope defining the lambda still active
 on the call stack when the lambda is invoked.
351038
def break_in_defining_scope(value=true)
      note :a
      note lambda {
        note :b
        if value
          break :break
        else
          break
        end
        note :c
      }.call
      note :d
    end
29728
def is_callable(self):
        
        self._callable = Call(self, call_name=self._name, callable=True)
        return self
306446
private Status executeAssert(Stmt.Assert stmt, CallStack frame, EnclosingScope scope) {
		//
		checkInvariants(frame,stmt.getCondition());
		return Status.NEXT;
	}
8651
private function checkCallConstraints(): void
    {
        if ($this->alreadyConstructed) {
            throw new ImmutabilityViolationException(\sprintf(
                'Class %s constructor was already called',
                static::class
            ));
        }

        $stack = \debug_backtrace();
        while (\count($stack) > 0 && $stack[0]['function'] !== 'checkImmutability') {
            \array_shift($stack);
        }

        if (!isset($stack[1]) || $stack[1]['function'] !== '__construct') {
            throw new ImmutabilityViolationException(\sprintf(
                'Immutability check can only be called from constructor, called from %s::%s',
                static::class,
                $stack[1]['function']
            ));
        }

        $this->alreadyConstructed = true;
    }
373249
@CallSuper
    @Override
    protected void onActive() {
        for (Map.Entry<LiveData<?>, Source<?>> source : mSources) {
            source.getValue().plug();
        }
    }
925334
@Override
    public void sawOpcode(int seen) {
        boolean sawResource = false;
        try {
            stack.precomputation(this);

            if (seen == Const.INVOKEVIRTUAL) {
                sawResource = processInvokeVirtual();
            } else if (seen == Const.INVOKESPECIAL) {
                sawResource = processInvokeSpecial();
            }

        } finally {
            stack.sawOpcode(this, seen);
            if (sawResource && (stack.getStackDepth() > 0)) {
                OpcodeStack.Item item = stack.getStackItem(0);
                item.setUserValue(Boolean.TRUE);
            }
        }
    }
40702
private boolean verifyDefine(NodeTraversal t, Node parent, Node methodName, Node args) {
    // Calls to goog.define must be in the global hoist scope.  This is copied from
    // validate(Un)aliasablePrimitiveCall.
    // TODO(sdh): loosen this restriction if the results are assigned?
    if (!compiler.getOptions().shouldPreserveGoogModule() && !t.inGlobalHoistScope()) {
      compiler.report(JSError.make(methodName.getParent(), INVALID_CLOSURE_CALL_SCOPE_ERROR));
      return false;
    }

    // It is an error for goog.define to show up anywhere except on its own or immediately after =.
    if (parent.isAssign() && parent.getParent().isExprResult()) {
      parent = parent.getParent();
    } else if (parent.isName() && NodeUtil.isNameDeclaration(parent.getParent())) {
      parent = parent.getParent();
    } else if (!parent.isExprResult()) {
      compiler.report(JSError.make(methodName.getParent(), INVALID_CLOSURE_CALL_SCOPE_ERROR));
      return false;
    }

    // Verify first arg
    Node arg = args;
    if (!verifyNotNull(methodName, arg) || !verifyOfType(methodName, arg, Token.STRING)) {
      return false;
    }

    // Verify second arg
    arg = arg.getNext();
    if (!args.isFromExterns()
        && (!verifyNotNull(methodName, arg) || !verifyIsLast(methodName, arg))) {
      return false;
    }

    String name = args.getString();
    if (!NodeUtil.isValidQualifiedName(
        compiler.getOptions().getLanguageIn().toFeatureSet(), name)) {
      compiler.report(JSError.make(args, INVALID_DEFINE_NAME_ERROR, name));
      return false;
    }

    JSDocInfo info = (parent.isExprResult() ? parent.getFirstChild() : parent).getJSDocInfo();
    if (info == null || !info.isDefine()) {
      compiler.report(JSError.make(parent, MISSING_DEFINE_ANNOTATION));
      return false;
    }
    return true;
  }
1160385
public function invokeLastCall()
    {
        if (! $this->last_call) {
            return;
        }
        $args = $this->last_call;
        $func = array_shift($args);
        call_user_func_array($func, $args);
    }
350810
public boolean register(Invocation invocation) {
        final long callId;
        boolean force = invocation.op.isUrgent() || invocation.isRetryCandidate();
        try {
            callId = force ? callIdSequence.forceNext() : callIdSequence.next();
        } catch (HazelcastOverloadException e) {
            throw new HazelcastOverloadException("Failed to start invocation due to overload: " + invocation, e);
        }
        try {
            // fails with IllegalStateException if the operation is already active
            setCallId(invocation.op, callId);
        } catch (IllegalStateException e) {
            callIdSequence.complete();
            throw e;
        }
        invocations.put(callId, invocation);
        if (!alive) {
            invocation.notifyError(new HazelcastInstanceNotActiveException());
            return false;
        }
        return true;
    }
1209380
void apply(final LambdaUnaryOpDouble lambda) {
        params.apply(new FnIntDoubleToDouble() {
            @Override
            public double call(int idx, double val) {
                return lambda.call(val);
            }
        });
    }
671500
@Override
  protected void onMethodEnter() {
    if (withPreconditions || withPostconditions || withInvariants) {
      enterContractedMethod();

      if (withPostconditions) {
        allocateOldValues(ContractKind.OLD, oldValueLocals);
        allocateOldValues(ContractKind.SIGNAL_OLD, signalOldValueLocals);
      }

      mark(methodStart);

      Label skip = enterBusySection();

      if (withInvariants && !statik && !isConstructor && !isStaticInit) {
        invokeInvariants();
      }

      if (withPreconditions) {
        invokePreconditions();
      }

      if (withPostconditions) {
        invokeOldValues(ContractKind.OLD, oldValueLocals);
        invokeOldValues(ContractKind.SIGNAL_OLD, signalOldValueLocals);
      }

      leaveBusySection(skip);
    }
  }
294334
public Invocation getLastInvocation() {
        OngoingStubbingImpl ongoingStubbing = ((OngoingStubbingImpl) mockingProgress().pullOngoingStubbing());
        List<Invocation> allInvocations = ongoingStubbing.getRegisteredInvocations();
        return allInvocations.get(allInvocations.size() - 1);
    }
672802
function (fnc, scope) {
            scope = scope || this;

            for (var i = 0; i < this.$items.length; i++) {
                fnc.call(scope, this.$items[i], i, this.$items);
            }
        }
521151
def in_scope?(name)
      ret = true if @callable.arguments_type.variable_index(name)
      ret = @callable.frame_type.variable_index(name) unless ret
      ret
    end
1339902
public void executeActivitiesConcurrent(List<PvmActivity> activityStack, PvmActivity targetActivity,
                                          PvmTransition targetTransition, Map<String, Object> variables, Map<String, Object> localVariables,
                                          boolean skipCustomListeners, boolean skipIoMappings) {


    ScopeImpl flowScope = null;
    if (!activityStack.isEmpty()) {
      flowScope = activityStack.get(0).getFlowScope();
    } else if (targetActivity != null) {
      flowScope = targetActivity.getFlowScope();
    } else if (targetTransition != null) {
      flowScope = targetTransition.getSource().getFlowScope();
    }

    PvmExecutionImpl propagatingExecution = null;
    if (flowScope.getActivityBehavior() instanceof ModificationObserverBehavior) {
      ModificationObserverBehavior flowScopeBehavior = (ModificationObserverBehavior) flowScope.getActivityBehavior();
      propagatingExecution = (PvmExecutionImpl) flowScopeBehavior.createInnerInstance(this);
    } else {
      propagatingExecution = createConcurrentExecution();
    }

    propagatingExecution.executeActivities(activityStack, targetActivity, targetTransition, variables, localVariables,
      skipCustomListeners, skipIoMappings);
  }
311402
def on_self
      scope  = current_scope
      method = scope.lookup(scope.method_call_type, 'self')

      push_value(method.return_value)
    end
1267373
@Override
    public void sawOpcode(int seen) {
        FQMethod curCalledMethod = null;
        Boolean sawPlainOptional = null;

        try {
            switch (seen) {
                case Const.IFNULL:
                case Const.IFNONNULL:
                    if (stack.getStackDepth() > 0) {
                        OpcodeStack.Item itm = stack.getStackItem(0);
                        if (OPTIONAL_CLASSES.contains(itm.getSignature())) {
                            bugReporter.reportBug(new BugInstance(this, BugType.OI_OPTIONAL_ISSUES_CHECKING_REFERENCE.name(), NORMAL_PRIORITY).addClass(this)
                                    .addMethod(this).addSourceLine(this));
                        }

                    }
                break;

                case Const.INVOKEDYNAMIC:
                    // smells like a hack. Not sure how to do this better
                    ConstantInvokeDynamic id = (ConstantInvokeDynamic) getConstantRefOperand();
                    ConstantPool cp = getConstantPool();
                    ConstantNameAndType nameAndType = (ConstantNameAndType) cp.getConstant(id.getNameAndTypeIndex());
                    ConstantUtf8 typeConstant = (ConstantUtf8) cp.getConstant(nameAndType.getSignatureIndex());
                    curCalledMethod = new FQMethod(getClassName(), "lambda$" + id.getBootstrapMethodAttrIndex(), typeConstant.getBytes());
                break;

                case Const.INVOKESTATIC:
                case Const.INVOKEINTERFACE:
                case Const.INVOKESPECIAL:
                    String clsName = getClassConstantOperand();
                    String methodName = getNameConstantOperand();
                    curCalledMethod = new FQMethod(clsName, methodName, getSigConstantOperand());

                    if ("java/util/Optional".equals(clsName) && "of".equals(methodName)) {
                        if (stack.getStackDepth() > 0) {
                            OpcodeStack.Item itm = stack.getStackItem(0);
                            String itmSig = itm.getSignature();
                            if (BOXED_OPTIONAL_TYPES.contains(itmSig)) {
                                bugReporter.reportBug(new BugInstance(this, BugType.OI_OPTIONAL_ISSUES_PRIMITIVE_VARIANT_PREFERRED.name(), LOW_PRIORITY)
                                        .addClass(this).addMethod(this).addSourceLine(this));
                            }
                        }
                    }
                break;

                case Const.INVOKEVIRTUAL:
                    curCalledMethod = new FQMethod(getClassConstantOperand(), getNameConstantOperand(), getSigConstantOperand());
                    if (OR_ELSE_METHODS.contains(curCalledMethod)) {
                        if (stack.getStackDepth() > 0) {
                            OpcodeStack.Item itm = stack.getStackItem(0);
                            if ((itm.getRegisterNumber() < 0) && (itm.getReturnValueOf() != null) && !isTrivialStackOps()) {
                                bugReporter.reportBug(new BugInstance(this, BugType.OI_OPTIONAL_ISSUES_USES_IMMEDIATE_EXECUTION.name(), NORMAL_PRIORITY)
                                        .addClass(this).addMethod(this).addSourceLine(this));
                            }
                        }
                        if (OPTIONAL_OR_ELSE_METHOD.equals(curCalledMethod)) {
                            sawPlainOptional = Boolean.TRUE;
                        }
                    } else if (OR_ELSE_GET_METHODS.contains(curCalledMethod)) {
                        if (!activeStackOps.isEmpty()) {
                            ActiveStackOp op = activeStackOps.getLast();

                            FQMethod method = op.getMethod();
                            if (method == null) {
                                bugReporter.reportBug(new BugInstance(this, BugType.OI_OPTIONAL_ISSUES_USES_ORELSEGET_WITH_NULL.name(), LOW_PRIORITY)
                                        .addClass(this).addMethod(this).addSourceLine(this));
                            } else {
                                Method getMethod = getLambdaMethod(method.getMethodName());
                                if (getMethod != null) {
                                    byte[] byteCode = getMethod.getCode().getCode();
                                    if (byteCode.length <= 4) {
                                        // we are looking for ALOAD, GETFIELD, or LDC followed by ARETURN, that should fit in 4 bytes
                                        if (!hasInvoke(byteCode)) {
                                            bugReporter.reportBug(new BugInstance(this, BugType.OI_OPTIONAL_ISSUES_USES_DELAYED_EXECUTION.name(), LOW_PRIORITY)
                                                    .addClass(this).addMethod(this).addSourceLine(this));
                                        }
                                    }
                                }
                            }
                        }
                        if (OPTIONAL_OR_ELSE_GET_METHOD.equals(curCalledMethod)) {
                            sawPlainOptional = Boolean.TRUE;
                        }
                    } else if (OPTIONAL_GET_METHOD.equals(curCalledMethod)) {
                        sawPlainOptional = Boolean.TRUE;
                    }
                break;
            }
        } finally {
            stack.sawOpcode(this, seen);
            int stackDepth = stack.getStackDepth();
            if (stackDepth == 0) {
                activeStackOps.clear();
            } else {
                activeStackOps.addLast(new ActiveStackOp(seen, curCalledMethod));
                while (activeStackOps.size() > stackDepth) {
                    activeStackOps.removeFirst();
                }
                if (sawPlainOptional != null) {
                    OpcodeStack.Item itm = stack.getStackItem(0);
                    itm.setUserValue(sawPlainOptional);
                }
            }
        }
    }