Example #1
0
 public FunctionType asConstantFunctionType(MethodElement element) {
   com.google.dart.compiler.type.FunctionType functionType = element.getFunctionType();
   return typeRepository.findFunction(
       false,
       asType(true, functionType.getReturnType()),
       asTypeList(functionType.getParameterTypes()),
       asTypeMap(functionType.getNamedParameterTypes()),
       element);
 }
 /**
  * Return the method that the given method overrides, or <code>null</code> if the given method
  * does not override another method.
  *
  * @param method the method that might override another method
  * @return the method that the given method overrides
  */
 private MethodElement findOverriddenMethod(MethodElement method) {
   Element enclosingElement = method.getEnclosingElement();
   if (!(enclosingElement instanceof ClassElement)) {
     // The element represents a function, and functions cannot override other functions.
     return null;
   }
   ClassElement superclass = getSuperclass((ClassElement) enclosingElement);
   while (superclass != null) {
     MethodElement matchingMethod = findMatchingMethod(method, superclass);
     if (matchingMethod != null) {
       return matchingMethod;
     }
     superclass = getSuperclass(superclass);
   }
   return null;
 }
 /**
  * Return <code>true</code> if the given candidate matches the given target.
  *
  * @param targetMethod the method being matched against
  * @param candidateMethod the candidate being compared to the target
  * @return <code>true</code> if the candidate matches the target
  */
 private boolean matches(MethodElement targetMethod, MethodElement candidateMethod) {
   return targetMethod.getName().equals(candidateMethod.getName());
 }