/*
Returns a FunctionInfo for a method descriptor.
186837
public FunctionInfo getFunction(String methodDesc) {

        methodDesc = methodDesc.replace('.', '$');
        int paramsStartPos = methodDesc.indexOf('(');
        int firstSep = methodDesc.indexOf('$');
        String prefix = firstSep != -1 && firstSep < paramsStartPos ? methodDesc.substring(0, firstSep) : "";
        methodDesc = prefix.length() > 0 ? methodDesc.substring(prefix.length() + 1) : methodDesc;
        FunctionInfo[] f = getFunctions();

        for (int i = 0; i < f.length; i++) {
            String p = f[i].getProvider() != null ? f[i].getProvider().getContextPrefixName().trim() : "";
            p = p.endsWith("$") ? p.substring(0, p.length() - 1) : p;
            if (("".equals(prefix) || prefix.equals(p)) &&
                    new TemplateCallExtractor.AppMethodInfo(f[i].getDescriptor().getMethod()).equals(
                    new TemplateCallExtractor.AppMethodInfo(methodDesc)))
            return f[i];
        }

        return null;

    }
1329735
private String getMethodName(Method method) {
        StatName statName = method.getAnnotation(StatName.class);
        return statName == null ? method.getName() : statName.value();
    }
1205802
static boolean isFunctionTypeDeclaration(JSDocInfo info) {
    return info.getParameterCount() > 0
        || info.hasReturnType()
        || info.hasThisType()
        || info.isConstructor()
        || info.isInterface()
        || info.isAbstract();
  }
1079668
function Return(type) {
    // 
    return function (target, propertyKey, descriptor) {
        if (!target.methodReturns) {
            target.methodReturns = {};
        }
        target.methodReturns[propertyKey] = type;
    };
}
805585
public static int getParameterCount(String methodDescriptor) {
		int pos = 1; // after the '('
		int count = 0;
		char ch;
		while ((ch = methodDescriptor.charAt(pos)) != ')') {
			// Either 'L' or '[' or primitive
			if (ch == 'L') {
				// skip to ';'
				pos = methodDescriptor.indexOf(';', pos + 1);
			}
			else if (ch == '[') {
				while (methodDescriptor.charAt(++pos) == '[') {
				}
				if (methodDescriptor.charAt(pos) == 'L') {
					// reference array like [[Ljava/lang/String;
					pos = methodDescriptor.indexOf(';', pos + 1);
				}
			}
			count++;
			pos++;
		}
		return count;
	}
636925
function getParameterDescriptor (parameter) {
  var parts = parameter.split(SLASHED_BRACKETS_REG_EXP);

  return {
    name: parts[0].trim().substring(1)
  };
}
338180
function Deprecate(methodDescriptor) {
    let {descriptor, key} = methodDescriptor;

    let fn = descriptor.value;

    descriptor.value = function(...args) {
        console.warn(`DEPRECATE: [${key}] This function will be removed in future versions.`);
        return fn.apply(this, args);
    };

    return {
        ...methodDescriptor,
        descriptor,
    };
}
469124
function () {
      let scope = context.getScope();
      while (scope) {
        const node = scope.block;
        // Ignore non functions
        const isFunction = /Function/.test(node.type);
        // Ignore classes methods
        const isNotMethod = !node.parent || node.parent.type !== 'MethodDefinition';
        // Ignore arguments (callback, etc.)
        const isNotArgument = !node.parent || node.parent.type !== 'CallExpression';
        if (isFunction && isNotMethod && isNotArgument) {
          return node;
        }
        scope = scope.upper;
      }
      return null;
    }
1352389
def GetMethod(self, name, descriptor):
        
        warnings.warn("deprecated, use get_method instead. This function might be removed in a later release!", DeprecationWarning)
        return self.get_method(name, descriptor)
1178261
function (object) {
  let names = Object.getOwnPropertyNames(object)
  // For Function, we should not override following properties even though they
  // are "own" properties.
  if (typeof object === 'function') {
    names = names.filter((name) => {
      return !FUNCTION_PROPERTIES.includes(name)
    })
  }
  // Map properties to descriptors.
  return names.map((name) => {
    const descriptor = Object.getOwnPropertyDescriptor(object, name)
    const member = { name, enumerable: descriptor.enumerable, writable: false }
    if (descriptor.get === undefined && typeof object[name] === 'function') {
      member.type = 'method'
    } else {
      if (descriptor.set || descriptor.writable) member.writable = true
      member.type = 'get'
    }
    return member
  })
}
643088
protected int findFunctionInputDef( String name)
    {
    int functionCount = name==null? 0 : functionInputDefs_.size();
    int i;
    for( i = 0; i < functionCount && !name.equals( functionInputDefs_.get(i).getName()); i++);
    return i < functionCount? i : -1;
    }
1010173
protected String getFunctionDescription(String functionName) {

    String className = getClass().getSimpleName();
    StringBuilder buffer = new StringBuilder(functionName.length() + className.length() + 4);
    buffer.append(FUNCTION_NAME_PREFIX);
    buffer.append(functionName);
    buffer.append(" [");
    buffer.append(className);
    buffer.append("]");
    return buffer.toString();
  }
852853
int getMethodIndex(ExecutableElement method)
    {
        TypeElement declaringClass = (TypeElement) method.getEnclosingElement();
        String fullyQualifiedname = declaringClass.getQualifiedName().toString();
        return getRefIndex(Methodref.class, fullyQualifiedname, method.getSimpleName().toString(), Descriptor.getDesriptor(method));
    }
996758
function extractElementDescriptor(/* this: File, */ classRef, superRef, path) {
  const { node, scope } = path;
  const isMethod = path.isClassMethod();

  if (path.isPrivate()) {
    throw path.buildCodeFrameError(
      `Private ${
        isMethod ? "methods" : "fields"
      } in decorated classes are not supported yet.`,
    );
  }

  new ReplaceSupers(
    {
      methodPath: path,
      methodNode: node,
      objectRef: classRef,
      isStatic: node.static,
      superRef,
      scope,
      file: this,
    },
    true,
  ).replace();

  const properties = [
    prop("kind", t.stringLiteral(isMethod ? node.kind : "field")),
    prop("decorators", takeDecorators(node)),
    prop("static", node.static && t.booleanLiteral(true)),
    prop("key", getKey(node)),
  ].filter(Boolean);

  if (isMethod) {
    const id = node.computed ? null : node.key;
    t.toExpression(node);
    properties.push(prop("value", nameFunction({ node, id, scope }) || node));
  } else if (node.value) {
    properties.push(
      method("value", template.statements.ast`return ${node.value}`),
    );
  } else {
    properties.push(prop("value", scope.buildUndefinedNode()));
  }

  path.remove();

  return t.objectExpression(properties);
}
20264
private static MethodDescriptor[] getMdescriptor() {
    final MethodDescriptor[] methods = new MethodDescriptor[36];

    try {
      methods[METHOD_addAttribute0] =
          new MethodDescriptor(DynamicMessage.Builder.class.getMethod("addAttribute", new Class[] {
              java.lang.String.class, java.lang.Object.class})); // NOI18N
      methods[METHOD_addAttribute0].setDisplayName("");
      methods[METHOD_addAttribute1] =
          new MethodDescriptor(DynamicMessage.Builder.class.getMethod("addAttribute", new Class[] {
              java.lang.String.class, int.class, java.lang.Object.class})); // NOI18N
      methods[METHOD_addAttribute1].setDisplayName("");
      methods[METHOD_addChild2] =
          new MethodDescriptor(DynamicMessage.Builder.class.getMethod("addChild", new Class[] {
              java.lang.String.class, com.google.protobuf.Message.class})); // NOI18N
      methods[METHOD_addChild2].setDisplayName("");
      methods[METHOD_addChild3] =
          new MethodDescriptor(DynamicMessage.Builder.class.getMethod("addChild",
              new Class[] {java.lang.String.class})); // NOI18N
      methods[METHOD_addChild3].setDisplayName("");
      methods[METHOD_addChild4] =
          new MethodDescriptor(DynamicMessage.Builder.class.getMethod("addChild", new Class[] {
              java.lang.String.class, int.class, com.google.protobuf.Message.class})); // NOI18N
      methods[METHOD_addChild4].setDisplayName("");
      methods[METHOD_addChild5] =
          new MethodDescriptor(DynamicMessage.Builder.class.getMethod("addChild", new Class[] {
              java.lang.String.class, int.class})); // NOI18N
      methods[METHOD_addChild5].setDisplayName("");
      methods[METHOD_build6] =
          new MethodDescriptor(DynamicMessage.Builder.class.getMethod("build", new Class[] {})); // NOI18N
      methods[METHOD_build6].setDisplayName("");
      methods[METHOD_buildPartial7] =
          new MethodDescriptor(DynamicMessage.Builder.class.getMethod("buildPartial",
              new Class[] {})); // NOI18N
      methods[METHOD_buildPartial7].setDisplayName("");
      methods[METHOD_clear8] =
          new MethodDescriptor(DynamicMessage.Builder.class.getMethod("clear", new Class[] {})); // NOI18N
      methods[METHOD_clear8].setDisplayName("");
      methods[METHOD_clone9] =
          new MethodDescriptor(DynamicMessage.Builder.class.getMethod("clone", new Class[] {})); // NOI18N
      methods[METHOD_clone9].setDisplayName("");
      methods[METHOD_getAttribute10] =
          new MethodDescriptor(DynamicMessage.Builder.class.getMethod("getAttribute",
              new Class[] {java.lang.String.class})); // NOI18N
      methods[METHOD_getAttribute10].setDisplayName("");
      methods[METHOD_getAttribute11] =
          new MethodDescriptor(DynamicMessage.Builder.class.getMethod("getAttribute", new Class[] {
              java.lang.String.class, int.class})); // NOI18N
      methods[METHOD_getAttribute11].setDisplayName("");
      methods[METHOD_getChild12] =
          new MethodDescriptor(DynamicMessage.Builder.class.getMethod("getChild",
              new Class[] {java.lang.String.class})); // NOI18N
      methods[METHOD_getChild12].setDisplayName("");
      methods[METHOD_getChild13] =
          new MethodDescriptor(DynamicMessage.Builder.class.getMethod("getChild", new Class[] {
              java.lang.String.class, int.class})); // NOI18N
      methods[METHOD_getChild13].setDisplayName("");
      methods[METHOD_isAttribute14] =
          new MethodDescriptor(DynamicMessage.Builder.class.getMethod("isAttribute",
              new Class[] {java.lang.String.class})); // NOI18N
      methods[METHOD_isAttribute14].setDisplayName("");
      methods[METHOD_isFieldIndexed15] =
          new MethodDescriptor(DynamicMessage.Builder.class.getMethod("isFieldIndexed",
              new Class[] {java.lang.String.class})); // NOI18N
      methods[METHOD_isFieldIndexed15].setDisplayName("");
      methods[METHOD_mergeFrom16] =
          new MethodDescriptor(DynamicMessage.Builder.class.getMethod("mergeFrom",
              new Class[] {com.google.protobuf.Message.class})); // NOI18N
      methods[METHOD_mergeFrom16].setDisplayName("");
      methods[METHOD_newSavePoint17] =
          new MethodDescriptor(DynamicMessage.Builder.class.getMethod("newSavePoint",
              new Class[] {})); // NOI18N
      methods[METHOD_newSavePoint17].setDisplayName("");
      methods[METHOD_removeAttribute18] =
          new MethodDescriptor(DynamicMessage.Builder.class.getMethod("removeAttribute",
              new Class[] {java.lang.String.class})); // NOI18N
      methods[METHOD_removeAttribute18].setDisplayName("");
      methods[METHOD_removeAttribute19] =
          new MethodDescriptor(DynamicMessage.Builder.class.getMethod("removeAttribute",
              new Class[] {java.lang.String.class, int.class})); // NOI18N
      methods[METHOD_removeAttribute19].setDisplayName("");
      methods[METHOD_removeChild20] =
          new MethodDescriptor(DynamicMessage.Builder.class.getMethod("removeChild",
              new Class[] {java.lang.String.class})); // NOI18N
      methods[METHOD_removeChild20].setDisplayName("");
      methods[METHOD_removeChild21] =
          new MethodDescriptor(DynamicMessage.Builder.class.getMethod("removeChild", new Class[] {
              java.lang.String.class, int.class})); // NOI18N
      methods[METHOD_removeChild21].setDisplayName("");
      methods[METHOD_setAttribute24] =
          new MethodDescriptor(DynamicMessage.Builder.class.getMethod("setAttribute", new Class[] {
              java.lang.String.class, java.lang.Object.class})); // NOI18N
      methods[METHOD_setAttribute24].setDisplayName("");
      methods[METHOD_setAttribute25] =
          new MethodDescriptor(DynamicMessage.Builder.class.getMethod("setAttribute", new Class[] {
              java.lang.String.class, int.class, java.lang.Object.class})); // NOI18N
      methods[METHOD_setAttribute25].setDisplayName("");
      methods[METHOD_setChild26] =
          new MethodDescriptor(DynamicMessage.Builder.class.getMethod("setChild", new Class[] {
              java.lang.String.class, com.google.protobuf.Message.class})); // NOI18N
      methods[METHOD_setChild26].setDisplayName("");
      methods[METHOD_setChild27] =
          new MethodDescriptor(DynamicMessage.Builder.class.getMethod("setChild",
              new Class[] {java.lang.String.class})); // NOI18N
      methods[METHOD_setChild27].setDisplayName("");
      methods[METHOD_setChild28] =
          new MethodDescriptor(DynamicMessage.Builder.class.getMethod("setChild", new Class[] {
              java.lang.String.class, int.class, com.google.protobuf.Message.class})); // NOI18N
      methods[METHOD_setChild28].setDisplayName("");
      methods[METHOD_setChild29] =
          new MethodDescriptor(DynamicMessage.Builder.class.getMethod("setChild", new Class[] {
              java.lang.String.class, int.class})); // NOI18N
      methods[METHOD_setChild29].setDisplayName("");
      methods[METHOD_size30] =
          new MethodDescriptor(DynamicMessage.Builder.class.getMethod("size", new Class[] {})); // NOI18N
      methods[METHOD_size30].setDisplayName("");
      methods[METHOD_toChild31] =
          new MethodDescriptor(DynamicMessage.Builder.class.getMethod("toChild",
              new Class[] {java.lang.String.class})); // NOI18N
      methods[METHOD_toChild31].setDisplayName("");
      methods[METHOD_toChild32] =
          new MethodDescriptor(DynamicMessage.Builder.class.getMethod("toChild", new Class[] {
              java.lang.String.class, int.class})); // NOI18N
      methods[METHOD_toChild32].setDisplayName("");
      methods[METHOD_toLastChild33] =
          new MethodDescriptor(DynamicMessage.Builder.class.getMethod("toLastChild",
              new Class[] {java.lang.String.class})); // NOI18N
      methods[METHOD_toLastChild33].setDisplayName("");
      methods[METHOD_toParent34] =
          new MethodDescriptor(DynamicMessage.Builder.class.getMethod("toParent", new Class[] {})); // NOI18N
      methods[METHOD_toParent34].setDisplayName("");
      methods[METHOD_toRoot35] =
          new MethodDescriptor(DynamicMessage.Builder.class.getMethod("toRoot", new Class[] {})); // NOI18N
      methods[METHOD_toRoot35].setDisplayName("");
    } catch (final Exception e) {
    }// GEN-HEADEREND:Methods
     // Here you can add code for customizing the methods array.

    return methods;
  }
1313301
function getMethodFor(methodRaw){
	// Else, try to return a new function with it
	try{
		var method = Function('scores', methodRaw);
		method([]);
		return method;
	}catch(err){
		console.log('getMethodFor parsing error: '+err);
	}

	// Split method in dots
	var methods = methodRaw.split('.');

	/*
		Try to parse as separate functions.
		We expect at least two methods separated by `.` (dots)

		If not, we will thread it right after, as a default function
		or a custom one
	*/
	try {
		if(methods.length > 1){

			// Default function to resolve methods
			function resolveMethod(wrapedMethod, methodRaw){

				// Get method string and `methodify` it recursivelly
				var method = getMethodFor(methodRaw);

				// Check if method is ok to continue, or, return null
				if(!method) throw new Error('Could not parse method: '+methodRaw);

				// Create a wrapped method of the current one, with this one
				return function(scores){
					return wrapedMethod(method(scores));
				}
			}

			// Go trough array, wraping methods
			var finalMethod = _.reduceRight(
				methods,
				// Called for every function
				resolveMethod,
				// Define initial method. Just returns value
				function(scores){
					return scores;
				}
			);

			// Return serie methods
			return finalMethod;
		}
	} catch (e) {
		// could not parse as custom sintax
	}

	/*
		If only one method, resolves it like a simple function
	*/
	// Get methodName, and params
	var explodedMethod = methodRaw.split(':');
	var methodName = explodedMethod[0].trim();
	var methodParams = Array.prototype.slice.call(explodedMethod, 1);

	// Try to find in defaults
	if(Table.evaluateMethods[methodName])
		return Table.evaluateMethods[methodName].apply(null, methodParams);

	return null;
}
769089
function(methodName) {
                    var origMethod = that[methodName],
                        ret;

                    that[methodName] = function() {
                        args = _simplifyArray(Array.prototype.slice.call(arguments, 0));
                        ret = origMethod.apply(that, arguments);
           
                        that._trace({
                            method: methodName,
                            args: args
                        });
                 
                        return ret;
                    };
            }