The children_only flag is inapplicable, but this is included as
        the Scope class is defined like so.

        Here this simply just place the catch symbol with the next
        replacement available.
760134
def build_remap_symbols(self, name_generator, children_only=None):
        

        replacement = name_generator(skip=(self._reserved_symbols))
        self.remapped_symbols[self.catch_symbol] = next(replacement)

        # also to continue down the children.
        for child in self.children:
            child.build_remap_symbols(name_generator, False)
784435
@Nullable
    private ScopeBlock findPreviousSiblingScopeBlock(ScopeBlock sb) {
        ScopeBlock parent = sb.getParent();
        if (parent == null) {
            return null;
        }

        List<ScopeBlock> children = parent.getChildren();
        if (children == null) {
            return null;
        }

        ScopeBlock lastSibling = null;
        for (ScopeBlock sibling : children) {
            if (sibling.equals(sb)) {
                return lastSibling;
            }
            lastSibling = sibling;
        }

        return null;
    }
903668
function getChildrenValue(item: Object, uncheckableItemValues?: any[]) {
    let values = [];

    if (!item[childrenKey]) {
      return values;
    }

    item[childrenKey].forEach(n => {
      if (uncheckableItemValues && !uncheckableItemValues.some(v => v === n[valueKey])) {
        values.push(n[valueKey]);
      }
      values = values.concat(getChildrenValue(n, uncheckableItemValues));
    });

    return values;
  }
522816
public boolean canAcceptChild(Class<? extends ElementBase> childClass) {
        if (!canAcceptChild()) {
            return false;
        }

        Cardinality cardinality = allowedChildClasses.getCardinality(getClass(), childClass);
        int max = cardinality.getMaxOccurrences();
        
        if (max == 0) {
            rejectReason = getDisplayName() + " does not accept " + childClass.getSimpleName() + " as a child.";
        } else if (max != Integer.MAX_VALUE && getChildCount(cardinality.getTargetClass()) >= max) {
            rejectReason = getDisplayName() + " cannot accept more than " + max + " of "
                    + cardinality.getTargetClass().getSimpleName() + ".";
        }

        return rejectReason == null;
    }
1057156
Violation areFieldsImmutable(
      Optional<ClassTree> tree,
      ImmutableSet<String> immutableTyParams,
      ClassType classType,
      ViolationReporter reporter) {
    ClassSymbol classSym = (ClassSymbol) classType.tsym;
    if (classSym.members() == null) {
      return Violation.absent();
    }
    Filter<Symbol> instanceFieldFilter =
        new Filter<Symbol>() {
          @Override
          public boolean accepts(Symbol symbol) {
            return symbol.getKind() == ElementKind.FIELD && !symbol.isStatic();
          }
        };
    Map<Symbol, Tree> declarations = new HashMap<>();
    if (tree.isPresent()) {
      for (Tree member : tree.get().getMembers()) {
        Symbol sym = ASTHelpers.getSymbol(member);
        if (sym != null) {
          declarations.put(sym, member);
        }
      }
    }
    // javac gives us members in reverse declaration order
    // handling them in declaration order leads to marginally better diagnostics
    List<Symbol> members =
        ImmutableList.copyOf(classSym.members().getSymbols(instanceFieldFilter)).reverse();
    for (Symbol member : members) {
      Optional<Tree> memberTree = Optional.ofNullable(declarations.get(member));
      Violation info =
          isFieldImmutable(
              memberTree, immutableTyParams, classSym, classType, (VarSymbol) member, reporter);
      if (info.isPresent()) {
        return info;
      }
    }
    return Violation.absent();
  }
845035
function(rec, key) {
        return (function() {
            if (typeof key === "symbol") {
              return undefined;
            }
            if (key === scopeName) {
              return scope;
            }
            if (key === indicator) {
              return proxy;
            }
            if (key.slice(-1) === indicator) {
              builder.pushSingleToken(key.slice(0,key.length-1));
              var classproxy = makeProxy({
                get: function(rec, key) {
                  if (typeof key === "symbol") {
                    return undefined;
                  }
                  builder.addClass(key);
                  return classproxy;
                }
              },
              function(obj) {
                builder.rewriteSingleTokenAttributes(obj);
                return classproxy;
              });
              return classproxy;
            } else if (key.slice(0,1) === indicator) {
              builder.pushEndToken(key.slice(1));
              return {
                valueOf: function() {
                  if (shortcuts.hasOwnProperty(key)) {
                    var args = builder.dropLastToken();

                    shortcuts[key](builder, scope, args);
                  } else {
                    throw new Error('Attempted to call nonexistant shortcut');
                  }
                  return 0;
                }
              }
            }  else {
              builder.pushStartToken(key);
              var classproxy = makeProxy({
                get: function(rec, nkey) {
                  if (typeof nkey === "symbol") {
                    return undefined;
                  }
                  if (nkey === 'valueOf') {
                    if (shortcuts.hasOwnProperty(key)) {
                      var args = builder.dropLastToken();

                      shortcuts[key](builder, scope, args);
                    } else {
                      throw new Error('Attempted to call nonexistant shortcut');
                    }
                    return function() {return 0};
                  }
                  builder.addClass(nkey);
                  return classproxy;
                }
              },
              function(obj) {
                builder.rewriteStartTokenAttributes(obj);
                return classproxy;
              });
              return classproxy;
            }
          })();
      }
49031
public void doTag()
            throws JspException, IOException
    {
        String value = getBufferBody(true);
        String text = "";
        if (value.length() > 0)
            text = value;

        Object o = getParent();
        assert (o != null);
        if (!(o instanceof TreeItem)) {
            logger.error("Invalid Parent (expected a TreeItem):" + o.getClass().getName());
            return;
        }

        // assign the value to the parent's label value
        TreeItem ti = (TreeItem) o;
        ti.setItemLabel(text);
    }
1303451
def all_children(flag=nil)
		also_foreign = (flag==:also_foreign)
		arr = []
		ecore = self.class.ecore
		# Awful hack to forbid the same reference is visited twice when
		# two references with the same name are found
		already_used_references = []
		ecore.eAllReferences.sort_by{|r| r.name}.select {|r| r.containment}.each do |ref|
			unless already_used_references.include?(ref.name)
				res = self.send(ref.name.to_sym)
				if ref.many
					d = arr.count
					res.each do |el|
						arr << el unless res==nil
					end
				elsif res!=nil
					d = arr.count
					arr << res
				end
				already_used_references << ref.name
			end
		end
		if also_foreign
			arr.concat(self.foreign_asts)
		end
		arr
	end
121505
AttrContext dup(Scope scope) {
        AttrContext info = new AttrContext();
        info.scope = scope;
        info.staticLevel = staticLevel;
        info.isSelfCall = isSelfCall;
        info.selectSuper = selectSuper;
        info.pendingResolutionPhase = pendingResolutionPhase;
        info.lint = lint;
        info.enclVar = enclVar;
        info.returnResult = returnResult;
        info.defaultSuperCallSite = defaultSuperCallSite;
        info.isSerializable = isSerializable;
        info.preferredTreeForDiagnostics = preferredTreeForDiagnostics;
        return info;
    }
530225
public void init() {
        log.debug("Init scope: {} parent: {}", name, parent);
        if (hasParent()) {
            if (!parent.hasChildScope(name)) {
                if (parent.addChildScope(this)) {
                    log.debug("Scope added to parent");
                } else {
                    log.warn("Scope not added to parent");
                    //throw new ScopeException("Scope not added to parent");
                    return;
                }
            } else {
                throw new ScopeException("Scope already exists in parent");
            }
        } else {
            log.debug("Scope has no parent");
        }
        if (autoStart) {
            start();
        }
    }
98887
def _check_for_legal_children(self, name, elt, mustqualify=1):
        '''
        '''
        inheader = name == "Header"
        for n in _children(elt):
            t = n.nodeType
            if t == _Node.COMMENT_NODE: continue
            if t != _Node.ELEMENT_NODE:
                if t == _Node.TEXT_NODE and n.nodeValue.strip() == "":
                    continue
                raise ParseException("Non-element child in " + name, 
                        inheader, elt, self.dom)
            if mustqualify and not n.namespaceURI:
                raise ParseException('Unqualified element "' + \
                        n.nodeName + '" in ' + name, inheader, elt, self.dom)
1125062
function bare(node, parent, scope) {
  // has an `id` so we don't need to infer one
  if (node.id) return;

  var id;
  if (t.isProperty(parent) && parent.kind === "init" && (!parent.computed || t.isLiteral(parent.key))) {
    // { foo() {} };
    id = parent.key;
  } else if (t.isVariableDeclarator(parent)) {
    // var foo = function () {};
    id = parent.id;

    if (t.isIdentifier(id)) {
      var binding = scope.parent.getBinding(id.name);
      if (binding && binding.constant && scope.getBinding(id.name) === binding) {
        // always going to reference this method
        node.id = id;
        return;
      }
    }
  } else {
    return;
  }

  var name;
  if (t.isLiteral(id)) {
    name = id.value;
  } else if (t.isIdentifier(id)) {
    name = id.name;
  } else {
    return;
  }

  name = t.toBindingIdentifierName(name);
  id = t.identifier(name);

  var state = visit(node, name, scope);
  return wrap(state, node, id, scope);
}
869274
private void throwErrorPayloadException(TLVElement child) throws KSIException {
        TLVElement errorCodeElement = child.getFirstChildElement(ELEMENT_TYPE_ERROR_CODE);
        TLVElement messageElement = child.getFirstChildElement(ELEMENT_TYPE_ERROR_MESSAGE);
        throw new KSIProtocolException(errorCodeElement.getDecodedLong(), "Response error " + errorCodeElement.getDecodedLong() + ": "
                + messageElement.getDecodedString());
    }
302981
@Override
    public boolean isLeaf(Object nodeObj) {
        if (debugger == null) {
            return true;
        }
        VariableNode node = (VariableNode) nodeObj;
        return children(node).length == 0;
    }
345191
private void addNonEmptyStatement(
      Node n, Context context, boolean allowNonBlockChild) {
    Node nodeToProcess = n;

    if (!allowNonBlockChild && !n.isBlock()) {
      throw new Error("Missing BLOCK child.");
    }

    // Strip unneeded blocks, that is blocks with <2 children unless
    // the CodePrinter specifically wants to keep them.
    if (n.isBlock()) {
      int count = getNonEmptyChildCount(n, 2);
      if (count == 0) {
        if (cc.shouldPreserveExtraBlocks()) {
          cc.beginBlock();
          cc.endBlock(cc.breakAfterBlockFor(n, context == Context.STATEMENT));
        } else {
          cc.endStatement(true);
        }
        return;
      }

      if (count == 1) {
        // Preserve the block only if needed or requested.
        //'let', 'const', etc are not allowed by themselves in "if" and other
        // structures. Also, hack around a IE6/7 browser bug that needs a block around DOs.
        Node firstAndOnlyChild = getFirstNonEmptyChild(n);
        boolean alwaysWrapInBlock = cc.shouldPreserveExtraBlocks();
        if (alwaysWrapInBlock || isBlockDeclOrDo(firstAndOnlyChild)) {
          cc.beginBlock();
          add(firstAndOnlyChild, Context.STATEMENT);
          cc.maybeLineBreak();
          cc.endBlock(cc.breakAfterBlockFor(n, context == Context.STATEMENT));
          return;
        } else {
          // Continue with the only child.
          nodeToProcess = firstAndOnlyChild;
        }
      }
    }

    if (nodeToProcess.isEmpty()) {
      cc.endStatement(true);
    } else {
      add(nodeToProcess, context);
    }
  }
484232
@Override
    public void sawOpcode(int seen) {
        boolean markAsValid = false;

        try {
            stack.precomputation(this);

            int pc = getPC();
            for (CodeException ex : exceptions) {
                if (pc == ex.getEndPC()) {
                    if (OpcodeUtils.isReturn(seen)) {
                        addCatchBlock(ex.getHandlerPC(), Integer.MAX_VALUE);
                    } else if ((seen == Const.GOTO) || (seen == Const.GOTO_W)) {
                        addCatchBlock(ex.getHandlerPC(), this.getBranchTarget());
                    } else {
                        addCatchBlock(ex.getHandlerPC(), Integer.MAX_VALUE);
                    }
                } else if (pc == ex.getHandlerPC()) {
                    removePreviousHandlers(pc);
                }
            }

            Iterator<CatchInfo> it = catchInfos.iterator();
            while (it.hasNext()) {
                try {
                    CatchInfo catchInfo = it.next();
                    if (pc == catchInfo.getStart()) {
                        if (!updateExceptionRegister(catchInfo, seen, pc)) {
                            it.remove();
                        }
                        break;
                    } else if (pc > catchInfo.getFinish()) {
                        it.remove();
                        break;
                    } else if ((pc > catchInfo.getStart()) && (pc <= catchInfo.getFinish())) {
                        if (seen == Const.INVOKESPECIAL) {
                            if (Values.CONSTRUCTOR.equals(getNameConstantOperand())) {
                                String className = getClassConstantOperand();
                                JavaClass exClass = Repository.lookupClass(className);
                                if (exClass.instanceOf(throwableClass)) {
                                    String sig = getSigConstantOperand();
                                    if ((sig.indexOf("Exception") >= 0) || (sig.indexOf("Throwable") >= 0) || (sig.indexOf("Error") >= 0)) {
                                        markAsValid = true;
                                        break;
                                    }
                                    if (exClass.instanceOf(assertionClass)) {
                                        // just ignore LEST for AssertionErrors
                                        markAsValid = true;
                                        break;
                                    }
                                }
                            } else if (isPossibleExBuilder(catchInfo.getRegister())) {
                                markAsValid = true;
                            }
                        } else if (seen == Const.INVOKEVIRTUAL) {
                            String methodName = getNameConstantOperand();
                            if ("initCause".equals(methodName) || "addSuppressed".equals(methodName)) {
                                if (stack.getStackDepth() > 1) {
                                    String className = getClassConstantOperand();
                                    JavaClass exClass = Repository.lookupClass(className);
                                    if (exClass.instanceOf(throwableClass)) {
                                        OpcodeStack.Item itm = stack.getStackItem(1);
                                        int reg = itm.getRegisterNumber();
                                        if (reg >= 0) {
                                            exReg.put(Integer.valueOf(reg), Boolean.TRUE);
                                        }
                                        markAsValid = true; // Fixes javac generated code
                                    }
                                }
                            } else if ((("getTargetException".equals(methodName) || "getCause".equals(methodName))
                                    && "java/lang/reflect/InvocationTargetException".equals(getClassConstantOperand()))
                                    || "java/io/UncheckedIOException".equals(getClassConstantOperand())) {
                                markAsValid = true;
                            } else if (isPossibleExBuilder(catchInfo.getRegister())) {
                                markAsValid = true;
                            }
                        } else if ((seen == Const.INVOKEINTERFACE) || (seen == Const.INVOKESTATIC)) {
                            if (isPossibleExBuilder(catchInfo.getRegister())) {
                                markAsValid = true;
                            }
                        } else if (seen == Const.ATHROW) {
                            if (stack.getStackDepth() > 0) {
                                OpcodeStack.Item itm = stack.getStackItem(0);
                                if ((itm.getRegisterNumber() != catchInfo.getRegister()) && (itm.getUserValue() == null)) {
                                    if (!isPre14Class(itm.getJavaClass())) {
                                        int priority = getPrevOpcode(1) == Const.MONITOREXIT ? LOW_PRIORITY : NORMAL_PRIORITY;
                                        bugReporter.reportBug(new BugInstance(this, BugType.LEST_LOST_EXCEPTION_STACK_TRACE.name(), priority).addClass(this)
                                                .addMethod(this).addSourceLine(this));
                                    }
                                    it.remove();
                                    break;
                                }
                            }
                            if (catchInfo.getFinish() == Integer.MAX_VALUE) {
                                catchInfo.setFinish(pc);
                            }

                        } else if (OpcodeUtils.isAStore(seen)) {
                            if (lastWasExitPoint) {
                                // crazy jdk6 finally block injection -- shut
                                // off detection
                                catchInfos.clear();
                                break;
                            }

                            if (stack.getStackDepth() > 0) {
                                OpcodeStack.Item itm = stack.getStackItem(0);
                                int reg = RegisterUtils.getAStoreReg(this, seen);
                                exReg.put(Integer.valueOf(reg), (Boolean) itm.getUserValue());
                                if ((reg == catchInfo.getRegister()) && (catchInfo.getFinish() == Integer.MAX_VALUE)) {
                                    it.remove();
                                }
                            }
                        } else if (OpcodeUtils.isALoad(seen)) {
                            Boolean valid = exReg.get(Integer.valueOf(RegisterUtils.getALoadReg(this, seen)));
                            if (valid != null) {
                                markAsValid = valid.booleanValue();
                            }
                        } else if (OpcodeUtils.isReturn(seen)) {
                            removeIndeterminateHandlers(pc);
                            break;
                        }
                    }
                } catch (ClassNotFoundException cnfe) {
                    bugReporter.reportMissingClass(cnfe);
                    it.remove();
                }
            }

            lastWasExitPoint = (seen == Const.GOTO) || (seen == Const.GOTO_W) || (seen == Const.ATHROW) || OpcodeUtils.isReturn(seen);
        } finally {
            TernaryPatcher.pre(stack, seen);
            stack.sawOpcode(this, seen);
            TernaryPatcher.post(stack, seen);
            if (markAsValid && (stack.getStackDepth() > 0)) {
                OpcodeStack.Item itm = stack.getStackItem(0);
                itm.setUserValue(Boolean.TRUE);
            }
        }
    }
52936
def _descope_flag(self, flag, default_scope):
    
    for scope_prefix, scope_info in self._known_scoping_prefixes:
      for flag_prefix in ['--', '--no-']:
        prefix = flag_prefix + scope_prefix
        if flag.startswith(prefix):
          scope = scope_info.scope
          if scope_info.category == ScopeInfo.SUBSYSTEM and default_scope != GLOBAL_SCOPE:
            # We allow goal.task --subsystem-foo to refer to the task-level subsystem instance,
            # i.e., as if qualified by --subsystem-goal-task-foo.
            # Note that this means that we can't set a task option on the cmd-line if its
            # name happens to start with a subsystem scope.
            # TODO: Either fix this or at least detect such options and warn.
            task_subsystem_scope = '{}.{}'.format(scope_info.scope, default_scope)
            if task_subsystem_scope in self._known_scopes:  # Such a task subsystem actually exists.
              scope = task_subsystem_scope
          return scope, flag_prefix + flag[len(prefix):]
    return default_scope, flag