コード例 #1
0
 private void setTypeParameters(TypeBuilder typeBuilder, List<SimpleNameTypeReferenceNode> typeParameters, SyntaxNode node) {
     if (typeParameters.size() > 0) {
         var genericParams = getTypeParameterNames(typeParameters);
         int i = 0;
         if (typeBuilder.GenericArguments.any()) {
             var it1 = genericParams.iterator();
             var it2 = typeBuilder.GenericArguments.iterator();
             while (it1.hasNext() && it2.hasNext()) {
                 if (!it1.next().equals(it2.next().FullName)) {
                     throw context.error(CompileErrorId.PartialTypeArgumentsMismatch, node,
                         BytecodeHelper.getDisplayName(typeBuilder));
                 }
                 i++;
             }
             if (it2.hasNext()) {
                 throw context.error(CompileErrorId.PartialTypeArgumentsMismatch, node,
                     BytecodeHelper.getDisplayName(typeBuilder));
             }
         }
         for (; i < genericParams.size(); i++) {
             typeBuilder.addGenericArgument(genericParams[i]);
         }
     }
 }