|
2795 | 2795 | s = strConcat(s, '))') |
2796 | 2796 | return s |
2797 | 2797 |
|
2798 | | - // all symbols are for specific platforms, ie: every symbol is wrapped in a reader conditional |
| 2798 | + // all symbols are for specific platforms across multiple platforms: |
| 2799 | + // wrap a separate (:refer-clojure) per platform inside #?(...) |
| 2800 | + // (We cannot use :exclude #?@(...) here because #?@ splicing outside a |
| 2801 | + // collection produces invalid Clojure.) |
2799 | 2802 | } else if (numPlatforms > 1 && numSymbolsForAllPlatforms === 0) { |
2800 | 2803 | let s = '\n' |
2801 | 2804 | s = printCommentsAbove(s, ns.referClojureCommentsAbove, ' ') |
2802 | | - s = strConcat(s, ' (:refer-clojure\n') |
2803 | | - s = strConcat3(s, ' ', kwd) |
2804 | | - s = strConcat(s, ' #?@(') |
| 2805 | + s = strConcat(s, ' #?(') |
2805 | 2806 |
|
2806 | 2807 | let platformIdx = 0 |
2807 | 2808 | while (platformIdx < numPlatforms) { |
2808 | 2809 | const platform = platforms[platformIdx] |
2809 | 2810 | const symbolsForPlatform = arrayPluck(filterOnPlatform(symbolsArr, platform), 'symbol') |
2810 | 2811 |
|
2811 | | - s = strConcat(s, formatKeywordFollowedByListOfSymbols(platform, symbolsForPlatform)) |
2812 | | - |
2813 | | - if (inc(platformIdx) !== numPlatforms) { |
2814 | | - if (kwd === ':exclude') { |
2815 | | - s = strConcat3(s, '\n', repeatString(' ', 17)) |
2816 | | - } else if (kwd === ':only') { |
2817 | | - s = strConcat3(s, '\n', repeatString(' ', 14)) |
2818 | | - } else { |
2819 | | - // FIXME: throw error here? |
2820 | | - } |
| 2812 | + if (platformIdx === 0) { |
| 2813 | + s = strConcat3(s, platform, ' (:refer-clojure ') |
| 2814 | + } else { |
| 2815 | + s = strConcat(s, '\n ') |
| 2816 | + s = strConcat3(s, platform, ' (:refer-clojure ') |
2821 | 2817 | } |
| 2818 | + s = strConcat(s, formatKeywordFollowedByListOfSymbols(kwd, symbolsForPlatform)) |
| 2819 | + s = strConcat(s, ')') |
2822 | 2820 |
|
2823 | 2821 | platformIdx = inc(platformIdx) |
2824 | 2822 | } |
2825 | 2823 |
|
2826 | | - s = strConcat(s, '))') |
| 2824 | + s = strConcat(s, ')') |
2827 | 2825 |
|
2828 | 2826 | return s |
2829 | 2827 |
|
|
0 commit comments