Use to loop detected.
513241
public function filterParent()
    {
        $value = $this->parent_name;
        $parent = self::findOne(['name' => $value]);
        if ($parent) {
            $id = $this->id;
            $parent_id = $parent->id;
            while ($parent) {
                if ($parent->id == $id) {
                    $this->addError('parent_name', 'Loop detected.');

                    return;
                }
                $parent = $parent->menuParent;
            }
            $this->parent = $parent_id;
        }
    }
221478
private void sawOpcodeBug(final int seen) {
        try {
            stack.precomputation(this);

            Iterator<ForLoop> it = possibleForLoops.iterator();
            while (it.hasNext()) {
                ForLoop fl = it.next();
                switch (fl.getLoopState()) {
                    case LOOP_NOT_STARTED:
                        if (getPC() == fl.getLoopStart()) {
                            if (OpcodeUtils.isILoad(seen) && (RegisterUtils.getLoadReg(this, seen) == fl.getLoopReg())) {
                                fl.setLoopState(LoopState.LOOP_INDEX_LOADED_FOR_TEST);
                                continue;
                            }

                            it.remove();
                        }
                    break;

                    case LOOP_INDEX_LOADED_FOR_TEST:
                        if (getPC() >= fl.getLoopEnd()) {
                            it.remove();
                            continue;
                        }
                        if (seen == Const.IF_ICMPGE) {
                            if (stack.getStackDepth() > 1) {
                                OpcodeStack.Item itm = stack.getStackItem(0);
                                if (itm.getConstant() != null) {
                                    it.remove();
                                    continue;
                                }
                                XMethod constantSource = itm.getReturnValueOf();
                                if (constantSource != null) {
                                    if (!"size".equals(constantSource.getMethodDescriptor().getName())) {
                                        it.remove();
                                        continue;
                                    }
                                } else if (getPrevOpcode(1) != Const.ARRAYLENGTH) {
                                    it.remove();
                                    continue;
                                }
                            }
                            int branchTarget = getBranchTarget();
                            if ((branchTarget >= (fl.getLoopEnd() + 3)) && (branchTarget <= (fl.getLoopEnd() + 5))) {
                                fl.setLoopState(LoopState.LOOP_IN_BODY);
                                continue;
                            }
                        }
                    break;

                    case LOOP_IN_BODY:
                    case LOOP_IN_BODY_WITH_GET:
                        if ((getPC() == fl.getLoopEnd()) && (fl.getLoopState() == LoopState.LOOP_IN_BODY_WITH_GET)) {
                            bugReporter.reportBug(new BugInstance(this, "LII_LIST_INDEXED_ITERATING", NORMAL_PRIORITY).addClass(this).addMethod(this)
                                    .addSourceLineRange(this, fl.getLoopStart(), fl.getLoopEnd()));
                            it.remove();
                        }
                        if (getPC() > fl.getLoopEnd()) {
                            it.remove();
                        }

                        if (OpcodeUtils.isILoad(seen)) {
                            loopReg = RegisterUtils.getLoadReg(this, seen);
                            if (loopReg == fl.getLoopReg()) {
                                fl.setLoopRegLoaded(true);
                            }
                        } else if (fl.getLoopRegLoaded()) {
                            boolean sawGet = ((seen == Const.INVOKEINTERFACE) && Values.SLASHED_JAVA_UTIL_LIST.equals(getClassConstantOperand())
                                    && "get".equals(getNameConstantOperand()) && SignatureBuilder.SIG_INT_TO_OBJECT.equals(getSigConstantOperand()));
                            if (!sawGet) {
                                it.remove();
                            } else {
                                fl.setLoopState(LoopState.LOOP_IN_BODY_WITH_GET);
                                if (stack.getStackDepth() > 1) {
                                    OpcodeStack.Item itm = stack.getStackItem(0);
                                    if (!itm.couldBeZero()) {
                                        it.remove();
                                    } else {
                                        itm = stack.getStackItem(1);
                                        if (fl.isSecondItem(itm)) {
                                            it.remove();
                                        }
                                    }
                                }
                                fl.setLoopRegLoaded(false);
                            }
                        }
                    break;
                }
            }

        } finally {
            stack.sawOpcode(this, seen);
        }
    }
641164
def each
      begin
        loop do
          event = read
          if event
            next unless ALLOWED_EVENT_TYPES.include?(event.type)
            yield event
          end
        end
      rescue Errno::ENODEV
      end
    end
27054
function parse_loop(input, customTags) {
    add_tag("default");    
    i = 0;
    while(!input.eos()) {
      if (look(/@class\b/))
        at_class();
      else if (look(/@extends?\b/))
        at_extends()
      else if (look(/@inherits?\b/))
        at_inherits()
      else if (look(/@mixins?\b/))
        class_list_at_tag(/@mixins?/, "mixins");
      else if (look(/@alternateClassNames?\b/))
        class_list_at_tag(/@alternateClassNames?/, "alternateClassNames");
      else if (look(/@uses\b/))
        class_list_at_tag(/@uses/, "uses");
      else if (look(/@requires\b/))
        class_list_at_tag(/@requires/, "requires");
      else if (look(/@singleton\b/))
        boolean_at_tag(/@singleton/, "singleton");
      else if (look(/@event\b/))
        at_event();
      else if (look(/@method\b/))
        at_method();
      else if (look(/@constructor\b/))
        at_method(true);
      else if (look(/@attribute\b/))
        at_attribute();
      else if (look(/@binding\b/))
        at_binding();
      else if (look(/@param\b/))
        at_param();
      else if (look(/@returns?\b/))
        at_return();
      else if (look(/@cfg\b/))
        at_cfg();
      else if (look(/@property\b/))
        at_property();
      else if (look(/@type\s/))
        at_type();
      else if (look(/@xtype\b/))
        at_xtype(/@xtype/, "widget");
      else if (look(/@ftype\b/))
        at_xtype(/@ftype/, "feature");
      else if (look(/@ptype\b/))
        at_xtype(/@ptype/, "plugin");
      else if (look(/@member\b/))
        at_member();
      else if (look(/@inherit[dD]oc\b/))
        at_inheritdoc();
      else if (look(/@alias/))
        at_alias();
      else if (look(/@see/))
        at_see();
      else if (look(/@todo/))
        at_todo();
      else if (look(/@link/))
        at_link();
      else if (look(/@var\b/))
        at_var();
      else if (look(/@throws?\b/))
        at_throws();
      else if (look(/@enum\b/))
        at_enum();
      else if (look(/@override\b/))
        at_override();
      else if (look(/@cancelable\b/))
        at_cancelable();
      else if (look(/@author\b/))
        at_author();
      else if (look(/@version\b/))
        at_version();
      else if (look(/@since\b/))
        at_since();
      else if (look(/@deprecated\b/))
        at_deprecated();
      else if (look(/@related\b/))
        at_related();
      else if (look(/@private\b/))
        boolean_at_tag(/@private/, "private");
      else if (look(/@ignore\b/))
        boolean_at_tag(/@ignore/, "ignore");
      else if (look(/@experimental\b/))
        boolean_at_tag(/@experimental/, "experimental");
      else if (look(/@chainable\b/))
        boolean_at_tag(/@chainable/, "chainable");
      else if (look(/@inheritable\b/))
        boolean_at_tag(/@inheritable/, "inheritable");
      else if (look(/@accessor\b/))
        boolean_at_tag(/@accessor/, "accessor");
      else if (look(/@evented\b/))
        boolean_at_tag(/@evented/, "evented");
      else if (look(/@bubbles\b/))
        boolean_at_tag(/@bubbles/, "bubbles");
      else if (look(/@read\-?only\b/))
        boolean_at_tag(/@read\-?only/, "readonly");
      else if (look(/@default_private\b/))
        boolean_at_tag(/@default_private/, "default_private");
      else if (look(/@/)) {
        match(/@/);
        var tagName = look(/\w+/);

        var found = _.find(customTags, function(tag) {
          return RegExp(tag).test(tagName);
        });

        if (found) {
          match(found);
          add_tag(tagName);
          skip_horiz_white();

          if (look(/.*/).length > 0) 
            current_tag["doc"] = strip(match(/.*/)); // no text means it's a boolean
        }
        else {
          // basically, "@" has to be the first dang thing after the *
          // this resolves false positives, like [@read] 
          var currPos = input.pointer();
          input.setPointer(currPos - (tagName.length + 3));
         
          var startingLine = input.peek(tagName.length + 3);
         
          if (!/.@/.test(startingLine)) {
            console.warn("Warning".yellow + ": I found @" + tagName + ", but I'm not sure what it ought to do.");
          }

          input.setPointer(currPos);

          current_tag["doc"] += "@";
        }

      }
      else if (look(/[^@]/)) {
        current_tag["doc"] += match(/[^@]+/);
      }
    }
}
517443
@Override
    public void sawOpcode(int seen) {
        try {
            stack.precomputation(this);

            if (seen == Const.INVOKEVIRTUAL) {
                checkForTailRecursion();
            }
        } finally {
            stack.sawOpcode(this, seen);
        }
    }
149108
@Override
    public void sawOpcode(int seen) {
        Comparable<?> regOrField = null;
        Comparable<?> uValue;
        boolean sawAlias = false;
        boolean sawLoad = false;

        try {
            stack.precomputation(this);

            int pc = getPC();
            Iterator<LoopInfo> it = loops.values().iterator();
            while (it.hasNext()) {
                LoopInfo loop = it.next();
                int endPC = loop.getEndPC();
                int loopPC = loop.getAddPC();
                if ((endPC - 3) <= pc) {
                    if (loopPC > 0) {
                        bugReporter.reportBug(new BugInstance(this, BugType.UAA_USE_ADD_ALL.name(), NORMAL_PRIORITY).addClass(this).addMethod(this)
                                .addSourceLine(this, loopPC));
                    }
                    it.remove();
                } else if ((endPC > pc) && (loopPC < (pc - 5)) && (loopPC > 0)) {
                    it.remove();
                }
            }

            if (seen == Const.INVOKEINTERFACE) {
                String methodName = getNameConstantOperand();
                String signature = getSigConstantOperand();
                if ("get".equals(methodName) && SignatureBuilder.SIG_INT_TO_OBJECT.equals(signature)) {
                    if (stack.getStackDepth() > 1) {
                        OpcodeStack.Item itm = stack.getStackItem(1);
                        int reg = isLocalCollection(itm);
                        if (reg >= 0) {
                            regOrField = Integer.valueOf(reg);
                            sawAlias = true;
                        } else {
                            String field = isFieldCollection(itm);
                            if (field != null) {
                                regOrField = field;
                                sawAlias = true;
                            }
                        }
                    }
                } else if ("keySet".equals(methodName) || "values".equals(methodName) || "iterator".equals(methodName) || "next".equals(methodName)
                        || "hasNext".equals(methodName)) {
                    if (stack.getStackDepth() > 0) {
                        OpcodeStack.Item itm = stack.getStackItem(0);
                        int reg = isLocalCollection(itm);
                        if (reg >= 0) {
                            regOrField = Integer.valueOf(reg);
                            sawAlias = true;
                        } else {
                            String field = isFieldCollection(itm);
                            if (field != null) {
                                regOrField = field;
                                sawAlias = true;
                            }
                        }
                    }
                } else if ("add".equals(methodName) && SignatureBuilder.SIG_OBJECT_TO_BOOLEAN.equals(signature) && (stack.getStackDepth() > 1)) {
                    OpcodeStack.Item colItem = stack.getStackItem(1);
                    OpcodeStack.Item valueItem = stack.getStackItem(0);
                    int reg = isLocalCollection(colItem);
                    if (reg >= 0) {
                        regOrField = Integer.valueOf(reg);
                        uValue = (Comparable<?>) valueItem.getUserValue();
                        if (uValue != null) {
                            LoopInfo loop = loops.get(uValue);
                            if ((loop != null) && loop.isInLoop(pc) && (this.getCodeByte(getNextPC()) == Const.POP)) {
                                loop.foundAdd(pc);
                            }
                        }
                    } else {
                        String field = isFieldCollection(colItem);
                        if (field != null) {
                            regOrField = field;
                            uValue = (Comparable<?>) valueItem.getUserValue();
                            if (uValue != null) {
                                LoopInfo loop = loops.get(uValue);
                                if ((loop != null) && loop.isInLoop(pc) && (this.getCodeByte(getNextPC()) == Const.POP)) {
                                    loop.foundAdd(pc);
                                }
                            }
                        }
                    }
                }
            } else if (OpcodeUtils.isIStore(seen) || OpcodeUtils.isAStore(seen)) {
                if (stack.getStackDepth() > 0) {
                    uValue = (Comparable<?>) stack.getStackItem(0).getUserValue();
                    userValues.put(Integer.valueOf(RegisterUtils.getStoreReg(this, seen)), uValue);
                }
            } else if (OpcodeUtils.isILoad(seen) || OpcodeUtils.isALoad(seen)) {
                sawLoad = true;
            } else if (seen == Const.IFEQ) {
                boolean loopFound = false;
                if ((stack.getStackDepth() > 0) && (getBranchOffset() > 0)) {
                    int gotoPos = getBranchTarget() - 3;
                    byte[] code = getCode().getCode();
                    if ((0x00FF & code[gotoPos]) == Const.GOTO) {
                        short brOffset = (short) (0x0FF & code[gotoPos + 1]);
                        brOffset <<= 8;
                        brOffset |= (0x0FF & code[gotoPos + 2]);
                        gotoPos += brOffset;
                        if (gotoPos < pc) {
                            OpcodeStack.Item itm = stack.getStackItem(0);
                            uValue = (Comparable<?>) itm.getUserValue();
                            if (uValue != null) {
                                loops.put(uValue, new LoopInfo(pc, getBranchTarget()));
                            }
                            loopFound = true;
                        }
                    }

                    if (!loopFound) {
                        removeLoop(pc);
                    }
                }
            } else if (isInstanceMethod && (seen == Const.PUTFIELD)) {
                if (stack.getStackDepth() > 1) {
                    OpcodeStack.Item item = stack.getStackItem(1);
                    if (item.getRegisterNumber() == 0) {
                        uValue = (Comparable<?>) stack.getStackItem(0).getUserValue();
                        userValues.put(getNameConstantOperand(), uValue);
                    }
                }
            } else if (isInstanceMethod && (seen == Const.GETFIELD)) {
                if (stack.getStackDepth() > 0) {
                    OpcodeStack.Item item = stack.getStackItem(0);
                    if (item.getRegisterNumber() == 0) {
                        sawLoad = true;
                    }
                }
            } else if (((seen > Const.IFEQ) && (seen <= Const.GOTO)) || (seen == Const.IFNULL) || (seen == Const.IFNONNULL)) {
                removeLoop(pc);
            } else if ((seen == Const.CHECKCAST) && (stack.getStackDepth() > 0)) {
                OpcodeStack.Item itm = stack.getStackItem(0);
                uValue = (Comparable<?>) itm.getUserValue();
                if (uValue != null) {
                    regOrField = uValue;
                    sawAlias = true;
                }
            }
        } catch (ClassNotFoundException cnfe) {
            bugReporter.reportMissingClass(cnfe);
        } finally {
            TernaryPatcher.pre(stack, seen);
            stack.sawOpcode(this, seen);
            TernaryPatcher.post(stack, seen);
            if (sawAlias) {
                if (stack.getStackDepth() > 0) {
                    OpcodeStack.Item itm = stack.getStackItem(0);
                    itm.setUserValue(regOrField);
                }
            } else if (sawLoad && (stack.getStackDepth() > 0)) {
                OpcodeStack.Item itm = stack.getStackItem(0);
                int reg = itm.getRegisterNumber();
                if (reg >= 0) {
                    uValue = userValues.get(Integer.valueOf(reg));
                    itm.setUserValue(uValue);
                } else {
                    XField xField = itm.getXField();
                    if (xField != null) {
                        uValue = userValues.get(xField.getName());
                        itm.setUserValue(uValue);
                    }
                }
            }
        }
    }
571224
private void checkLoopInvariant(String msg, Stmt.Loop stmt, Context context) {
		//
		Tuple<WyilFile.Expr> loopInvariant = stmt.getInvariant();
		LocalEnvironment environment = context.getEnvironment();
		WyilFile.Decl.FunctionOrMethod declaration = (WyilFile.Decl.FunctionOrMethod) environment
				.getParent().enclosingDeclaration;
		// Construct argument to invocation
		Tuple<WyilFile.Decl.Variable> localVariables = determineUsedVariables(stmt.getInvariant());
		Expr[] arguments = new Expr[localVariables.size()];
		for (int i = 0; i != arguments.length; ++i) {
			WyilFile.Decl.Variable var = localVariables.get(i);
			arguments[i] = new Expr.VariableAccess(environment.read(var));
		}
		//
		for (int i = 0; i != loopInvariant.size(); ++i) {
			WyilFile.Expr clause = loopInvariant.get(i);
			Name ident = convert(declaration.getQualifiedName(), "_loopinvariant_" + clause.getIndex(), declaration.getName());
			Expr macroCall = new Expr.Invoke(null, ident, null, arguments);
			context.emit(new VerificationCondition(msg, context.assumptions, macroCall,
					clause.getParent(WyilFile.Attribute.Span.class)));
		}
	}
824914
def loop_position(self):
        """"""
        for i, v in enumerate(self._sort_loop):
            if v == glances_processes.sort_key:
                return i
        return 0
475489
function forOf (obj, iterate, context) {
  if (obj) {
    context = context || this
    if (isArray(obj)) {
      for (var index = 0, len = obj.length; index < len; index++) {
        if (iterate.call(context, obj[index], index, obj) === false) {
          break
        }
      }
    } else {
      for (var key in obj) {
        if (hasOwnProp(obj, key)) {
          if (iterate.call(context, obj[key], key, obj) === false) {
            break
          }
        }
      }
    }
  }
}
321623
function(from, to, op) {
    if (op) this.iterN(from - this.first, to - from, op)
    else this.iterN(this.first, this.first + this.size, from)
  }
1111213
function each( source, iterator ) {
        if ( isArray( source ) ) {
            for ( var i = 0, len = source.length; i < len; i++ ) {
                if ( iterator( source[ i ], i ) === false ) {
                    break;
                }
            }
        }
    }
976483
public static <T> int detectIndex(Iterable<T> iterable, Predicate<? super T> predicate)
    {
        if (iterable instanceof ArrayList<?>)
        {
            return ArrayListIterate.detectIndex((ArrayList<T>) iterable, predicate);
        }
        if (iterable instanceof List<?>)
        {
            return ListIterate.detectIndex((List<T>) iterable, predicate);
        }
        if (iterable != null)
        {
            return IterableIterate.detectIndex(iterable, predicate);
        }
        throw new IllegalArgumentException("Cannot perform detectIndex on null");
    }
1108147
function For(o){
	if(o === undefined) o = {};
	this._traversed = false;
	this._options = o;
	this._scope = new ForScope(this);
	this._catcher = null;
}
548678
def loop(self):
        
        logger.debug("Node loop starts for {!r}.".format(self))

        while self.should_loop:
            try:
                self.step()
            except InactiveReadableError:
                break

        logger.debug("Node loop ends for {!r}.".format(self))
300712
def _process_loop_helper(self, node, **kwargs):
        

        if node.attr == LOOP_HELPER_INDEX:
            self.output.write('(arguments[1] + 1)')
        elif node.attr == LOOP_HELPER_INDEX_0:
            self.output.write('arguments[1]')
        elif node.attr == LOOP_HELPER_FIRST:
            self.output.write('(arguments[1] == 0)')
        elif node.attr == LOOP_HELPER_LAST:
            self.output.write('(arguments[1] == arguments[2].length - 1)')
        elif node.attr == LOOP_HELPER_LENGTH:
            self.output.write('arguments[2].length')
268364
@Override
    public void sawOpcode(final int seen) {
        if (stage == Stage.FIND_LOOP_STAGE) {
            sawOpcodeLoop(seen);
        } else {
            sawOpcodeBug(seen);
        }
    }
515207
def stop_at(iterable, idx):
    """"""
    for i, item in enumerate(iterable):
        if i == idx: return
        yield item