private static PsiClassType doGetSuperClassType(GroovyScriptClass scriptClass) {
    GrVariableDeclaration declaration = findDeclaration(scriptClass.getContainingFile());
    if (declaration != null) {

      GrModifierList modifierList = declaration.getModifierList();
      if (modifierList.findAnnotation(GroovyCommonClassNames.GROOVY_TRANSFORM_BASE_SCRIPT)
          != null) {
        GrTypeElement typeElement = declaration.getTypeElementGroovy();
        if (typeElement != null) {
          PsiType type = typeElement.getType();
          if (type instanceof PsiClassType) {
            return (PsiClassType) type;
          }
        }
      }
    }
    return null;
  }
  private void writeTupleDeclaration(
      GrVariableDeclaration variableDeclaration,
      StringBuilder builder,
      ExpressionContext expressionContext) {
    GrVariable[] variables = variableDeclaration.getVariables();
    final GrExpression tupleInitializer = variableDeclaration.getTupleInitializer();
    if (tupleInitializer instanceof GrListOrMap) {
      for (GrVariable variable : variables) {
        writeVariableSeparately(variable, builder, expressionContext);
        builder.append(";\n");
      }
    } else if (tupleInitializer != null) {

      GroovyResolveResult iteratorMethodResult =
          resolveMethod(
              tupleInitializer,
              "iterator",
              GrExpression.EMPTY_ARRAY,
              GrNamedArgument.EMPTY_ARRAY,
              GrClosableBlock.EMPTY_ARRAY,
              variableDeclaration);

      final PsiType iteratorType = inferIteratorType(iteratorMethodResult, tupleInitializer);

      final String iteratorName =
          genIteratorVar(
              variableDeclaration,
              builder,
              expressionContext,
              tupleInitializer,
              iteratorType,
              iteratorMethodResult);

      final GrModifierList modifierList = variableDeclaration.getModifierList();

      PsiType iterableTypeParameter = PsiUtil.extractIterableTypeParameter(iteratorType, false);

      for (final GrVariable v : variables) {
        ModifierListGenerator.writeModifiers(builder, modifierList);
        final PsiType type = context.typeProvider.getVarType(v);
        writeType(builder, type, variableDeclaration);
        builder.append(' ').append(v.getName());

        builder.append(" = ");
        wrapInCastIfNeeded(
            builder,
            type,
            iterableTypeParameter,
            tupleInitializer,
            expressionContext,
            new StatementWriter() {
              @Override
              public void writeStatement(StringBuilder builder, ExpressionContext context) {
                builder
                    .append(iteratorName)
                    .append(".hasNext() ? ")
                    .append(iteratorName)
                    .append(".next() : null");
              }
            });
        builder.append(";\n");
      }
    } else {
      writeSimpleVarDeclaration(variableDeclaration, builder, expressionContext);
    }
  }