/*~
Returns the descriptor searching upwards the prototype chain.
9382
function descriptorOf(object, name) {
  const descriptor = Object.getOwnPropertyDescriptor(object, name);
  if (descriptor) {
    return descriptor;
  } else {
    const proto = prototypeOf(object);
    if (proto) {
      return descriptorOf(proto, name);
    } else {
      return null;
    }
  }
}
668678
protected static String getTypeDescriptor(Object type) {
        if (type instanceof Class) {
            return Type.getDescriptor((Class) type);
        } else if (type instanceof Type) {
            return ((Type) type).getDescriptor();
        } else {
            String className = type.toString();
            return getTypeDescriptor(className, new String[0]);
        }
    }
723624
private void getDescriptor(final StringBuilder sb) {
        if (this.buf == null) {
            // descriptor is in byte 3 of 'off' for primitive types (buf ==
            // null)
            sb.append((char) ((off & 0xFF000000) >>> 24));
        } else if (sort == OBJECT) {
            sb.append('L');
            sb.append(this.buf, off, len);
            sb.append(';');
        } else { // sort == ARRAY || sort == METHOD
            sb.append(this.buf, off, len);
        }
    }
222791
function retrieveMethod(a, n) {
    return a[n] || a.constructor[n] || (a.prototype && a.prototype[n]);
}
587062
def get_descriptor_for_idcode(idcode):
    """"""
    idcode = idcode&0x0fffffff
    id_str = "XXXX"+bin(idcode)[2:].zfill(28)

    descr_file_path = _check_cache_for_idcode(id_str)
    if descr_file_path:
        with open(descr_file_path, 'r') as f:
            dat = json.load(f)
        if dat.get("_file_version",-1) == JTAGDeviceDescription.version:
            return JTAGDeviceDescription(dat.get('idcode'),
                                         dat.get('name'),
                                         dat.get('ir_length'),
                                         dat.get('instruction_opcodes'),
                                         dat.get('registers'),
                                         dat.get('instruction_register_map'))

    print("    Device detected ("+id_str+"). Fetching missing descriptor...")
    sid = get_sid(id_str)
    details = get_details(sid)
    attribs = decode_bsdl(sid)

    #VERIFYING PARSED DATA FROM 2 SOURCES. MESSY BUT USEFUL.
    instruction_length = 0
    if attribs.get('INSTRUCTION_LENGTH') ==\
       details.get('INSTRUCTION_LENGTH'):
        instruction_length = attribs.get('INSTRUCTION_LENGTH')
    elif attribs.get('INSTRUCTION_LENGTH') and\
       details.get('INSTRUCTION_LENGTH'):
        raise Exception("INSTRUCTION_LENGTH can not be determined")
    elif attribs.get('INSTRUCTION_LENGTH'):
        instruction_length = attribs.get('INSTRUCTION_LENGTH')
    else:
        instruction_length = details.get('INSTRUCTION_LENGTH')

    for instruction_name in details.get('instructions'):
        if instruction_name not in\
           attribs.get('INSTRUCTION_OPCODE',[]):
            raise Exception("INSTRUCTION_OPCODE sources do not match")

    #print(attribs['IDCODE_REGISTER'])
    descr = JTAGDeviceDescription(attribs['IDCODE_REGISTER'].upper(),
                                  details['name'], instruction_length,
                                  attribs['INSTRUCTION_OPCODE'],
                                  attribs['REGISTERS'],
                                  attribs['INSTRUCTION_TO_REGISTER'])

    #CACHE DESCR AS FILE!
    if not os.path.isdir(base_descr_dir):
        os.makedirs(base_descr_dir)
    descr_file_path = os.path.join(base_descr_dir,
                                   attribs['IDCODE_REGISTER']\
                                   .upper()+'.json')
    with open(descr_file_path, 'w') as f:
        json.dump(descr._dump(), f)

    return descr
367203
function alias() {
    var aliases = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];

    var descriptor = _asDescriptor.call(this);

    descriptor.alias = aliases;

    return descriptor;
}
734275
function defineDelegates(cls, prototype) {
  const names = Object.getOwnPropertyNames(prototype);
  names.forEach(name => {
    const descriptor = Object.getOwnPropertyDescriptor(prototype, name);
    if (!descriptor) {
      return;
    }
    const delegate = createDelegate(name, descriptor);
    if (delegate) {
      Object.defineProperty(cls.prototype, name, delegate);
    }
  });
}
788149
private void extractInstance(ExtractionInstance instance) {
    PrototypeMemberDeclaration first = instance.declarations.get(0);
    String className = first.qualifiedClassName;
    if (pattern == Pattern.USE_GLOBAL_TEMP) {
      // Use the temp variable to hold the prototype.
      Node classNameNode = NodeUtil.newQName(compiler, className);
      classNameNode.putBooleanProp(Node.IS_CONSTANT_NAME, first.constant);
      Node stmt =
          IR.exprResult(
              IR.assign(
                  IR.name(PROTOTYPE_ALIAS),
                  IR.getprop(
                      classNameNode, IR.string("prototype"))))
          .useSourceInfoIfMissingFromForTree(first.node);

      instance.parent.addChildBefore(stmt, first.node);
      compiler.reportChangeToEnclosingScope(stmt);
    } else if (pattern == Pattern.USE_IIFE) {
      Node block = IR.block();
      Node func = IR.function(
           IR.name(""),
           IR.paramList(IR.name(PROTOTYPE_ALIAS)),
           block);

      Node call = IR.call(func,
           NodeUtil.newQName(
               compiler, className + ".prototype",
               instance.parent, className + ".prototype"));
      call.putIntProp(Node.FREE_CALL, 1);

      Node stmt = IR.exprResult(call);
      stmt.useSourceInfoIfMissingFromForTree(first.node);
      instance.parent.addChildBefore(stmt, first.node);
      compiler.reportChangeToEnclosingScope(stmt);
      for (PrototypeMemberDeclaration declar : instance.declarations) {
        compiler.reportChangeToEnclosingScope(declar.node);
        block.addChildToBack(declar.node.detach());
      }
    }
    // Go through each member declaration and replace it with an assignment
    // to the prototype variable.
    for (PrototypeMemberDeclaration declar : instance.declarations) {
      replacePrototypeMemberDeclaration(declar);
    }
  }
935007
protected int getRefIndex(Class<? extends Ref> refType, String fullyQualifiedname, String name, String descriptor)
    {
        String internalForm = fullyQualifiedname.replace('.', '/');
        for (ConstantInfo ci : listConstantInfo(refType))
        {
            Ref mr = (Ref) ci;
            int classIndex = mr.getClass_index();
            Clazz clazz = (Clazz) getConstantInfo(classIndex);
            String cn = getString(clazz.getName_index());
            if (internalForm.equals(cn))
            {
                int nameAndTypeIndex = mr.getName_and_type_index();
                NameAndType nat = (NameAndType) getConstantInfo(nameAndTypeIndex);
                int nameIndex = nat.getName_index();
                String str = getString(nameIndex);
                if (name.equals(str))
                {
                    int descriptorIndex = nat.getDescriptor_index();
                    String descr = getString(descriptorIndex);
                    if (descriptor.equals(descr))
                    {
                        return constantPoolIndexMap.get(ci);
                    }
                }
            }
        }
        return -1;
    }
704883
String descriptor(boolean includeThis) {
        StringBuilder result = new StringBuilder();
        result.append("(");
        if (includeThis) {
            result.append(declaringType.name);
        }
        for (TypeId t : parameters.types) {
            result.append(t.name);
        }
        result.append(")");
        result.append(returnType.name);
        return result.toString();
    }
63089
function locateDescriptor(descriptor) {
  let basePath

  // Infer from path/url
  if (isString(descriptor)) {
    basePath = descriptor.split('/').slice(0, -1).join('/') || '.'

  // Current dir by default
  } else {
    basePath = '.'
  }

  return basePath
}
742578
function (object) {
  const proto = Object.getPrototypeOf(object)
  if (proto === null || proto === Object.prototype) return null
  return {
    members: getObjectMembers(proto),
    proto: getObjectPrototype(proto)
  }
}
609775
function hintSuper(prototype) {
      // tag functions with their prototype name to optimize
      // super call invocations
      for (var n in prototype) {
        var pd = Object.getOwnPropertyDescriptor(prototype, n);
        if (pd && typeof pd.value === 'function') {
          pd.value.nom = n;
        }
      }
    }
937004
function findCustomPropertyDefinitions(cssAssets) {
  const definitionsByProp = {};
  const incomingReferencesByProp = {};
  for (const cssAsset of cssAssets) {
    cssAsset.eachRuleInParseTree(cssRule => {
      if (
        cssRule.parent.type === 'rule' &&
        cssRule.type === 'decl' &&
        /^--/.test(cssRule.prop)
      ) {
        (definitionsByProp[cssRule.prop] =
          definitionsByProp[cssRule.prop] || new Set()).add(cssRule);
        for (const customPropertyName of extractReferencedCustomPropertyNames(
          cssRule.value
        )) {
          (incomingReferencesByProp[cssRule.prop] =
            incomingReferencesByProp[cssRule.prop] || new Set()).add(
            customPropertyName
          );
        }
      }
    });
  }
  const expandedDefinitionsByProp = {};
  for (const prop of Object.keys(definitionsByProp)) {
    expandedDefinitionsByProp[prop] = new Set();
    const seenProps = new Set();
    const queue = [prop];
    while (queue.length > 0) {
      const referencedProp = queue.shift();
      if (!seenProps.has(referencedProp)) {
        seenProps.add(referencedProp);
        if (definitionsByProp[referencedProp]) {
          for (const cssRule of definitionsByProp[referencedProp]) {
            expandedDefinitionsByProp[prop].add(cssRule);
          }
        }
        const incomingReferences = incomingReferencesByProp[referencedProp];
        if (incomingReferences) {
          for (const incomingReference of incomingReferences) {
            queue.push(incomingReference);
          }
        }
      }
    }
  }

  return expandedDefinitionsByProp;
}
1159109
public Type findDescriptorType(Type origin) throws FunctionDescriptorLookupError {
        return descCache.get(origin.tsym).getType(origin);
    }
189270
function() {
        var ch = exprICode(index),
          start = index,
          identifier;

        if (isIdentifierStart(ch)) {
          index++;
        } else {
          throwError("Unexpected " + exprI(index), index);
        }

        while (index < length) {
          ch = exprICode(index);
          if (isIdentifierPart(ch)) {
            index++;
          } else {
            break;
          }
        }
        identifier = expr.slice(start, index);

        if (literals.hasOwnProperty(identifier)) {
          return {
            type: code.LITERAL,
            value: literals[identifier],
            raw: identifier
          };
        } else if (identifier === this_str) {
          return { type: code.THIS_EXP };
        } else {
          return {
            type: code.IDENTIFIER,
            name: identifier
          };
        }
      }
606569
def descriptor_to_generator(cls_descriptor, cls, limit=0):
    ''

    generators = []
    for descriptor in cls_descriptor.fields_by_name.values():
        generator = _prototype_to_generator(descriptor, cls)

        if limit != 0:
            generator.set_limit(limit)

        generators.append(generator)

    obj = cls(cls_descriptor.name, *generators)
    return obj