Exemplo n.º 1
0
 public Type asType(boolean nullable, com.google.dart.compiler.type.Type type) {
   switch (type.getKind()) {
     case VOID:
       return CoreTypeRepository.VOID_TYPE;
     case DYNAMIC:
       return nullable
           ? CoreTypeRepository.DYNAMIC_TYPE
           : CoreTypeRepository.DYNAMIC_NON_NULL_TYPE;
     case VARIABLE:
       // return typeRepository.findType(nullable, (ClassElement)
       // type.getElement());
       if (!(type.getElement() instanceof ClassElement)) {
         return DYNAMIC_NON_NULL_TYPE;
       }
     case INTERFACE:
       return typeRepository.findType(nullable, (ClassElement) type.getElement());
     case FUNCTION:
       return asFunctionType(nullable, (com.google.dart.compiler.type.FunctionType) type);
     case FUNCTION_ALIAS:
       return asFunctionType(nullable, ((FunctionAliasType) type).getElement().getFunctionType());
     case NONE:
     default:
       throw new AssertionError("asType: " + type.getKind() + " must be implemented");
   }
 }
Exemplo n.º 2
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);
 }
Exemplo n.º 3
0
 private FunctionType asFunctionType(
     boolean nullable, com.google.dart.compiler.type.FunctionType functionType) {
   return typeRepository.findFunction(
       nullable,
       asType(true, functionType.getReturnType()),
       asTypeList(functionType.getParameterTypes()),
       asTypeMap(functionType.getNamedParameterTypes()),
       null);
 }
Exemplo n.º 4
0
 public Type findType(boolean nullable, ClassElement classElement) {
   return typeRepository.findType(nullable, classElement);
 }