Пример #1
0
 private void setTypeParameters(MethodBuilder methodBuilder, List<SimpleNameTypeReferenceNode> typeParameters, SyntaxNode node) {
     if (typeParameters.size() > 0) {
         var genericParams = getTypeParameterNames(typeParameters);
         int i = 0;
         if (methodBuilder.GenericArguments.any()) {
             var it1 = genericParams.iterator();
             var it2 = methodBuilder.GenericArguments.iterator();
             while (it1.hasNext() && it2.hasNext()) {
                 if (!it1.next().equals(it2.next().FullName)) {
                     throw context.error(CompileErrorId.PartialTypeArgumentsMismatch, node,
                         BytecodeHelper.getDisplayName(methodBuilder.DeclaringType) + '.' + methodBuilder.Name);
                 }
                 i++;
             }
             if (it2.hasNext()) {
                 throw context.error(CompileErrorId.PartialTypeArgumentsMismatch, node,
                     BytecodeHelper.getDisplayName(methodBuilder.DeclaringType) + '.' + methodBuilder.Name);
             }
         }
         for (; i < genericParams.size(); i++) {
             methodBuilder.addGenericArgument(genericParams[i]);
         }
     }
 }