(source)
| 107 | } |
| 108 | |
| 109 | function splitTopLevelCommaList(source) { |
| 110 | const items = [] |
| 111 | let quote = null |
| 112 | let inLineComment = false |
| 113 | let inBlockComment = false |
| 114 | let parenDepth = 0 |
| 115 | let bracketDepth = 0 |
| 116 | let braceDepth = 0 |
| 117 | let start = 0 |
| 118 | |
| 119 | for (let i = 0; i < source.length; i += 1) { |
| 120 | const char = source[i] |
| 121 | const next = source[i + 1] |
| 122 | |
| 123 | if (inLineComment) { |
| 124 | if (char === '\n') inLineComment = false |
| 125 | continue |
| 126 | } |
| 127 | |
| 128 | if (inBlockComment) { |
| 129 | if (char === '*' && next === '/') { |
| 130 | inBlockComment = false |
| 131 | i += 1 |
| 132 | } |
| 133 | continue |
| 134 | } |
| 135 | |
| 136 | if (quote) { |
| 137 | if (char === '\\') { |
| 138 | i += 1 |
| 139 | continue |
| 140 | } |
| 141 | if (char === quote) { |
| 142 | quote = null |
| 143 | } |
| 144 | continue |
| 145 | } |
| 146 | |
| 147 | if (char === '/' && next === '/') { |
| 148 | inLineComment = true |
| 149 | i += 1 |
| 150 | continue |
| 151 | } |
| 152 | |
| 153 | if (char === '/' && next === '*') { |
| 154 | inBlockComment = true |
| 155 | i += 1 |
| 156 | continue |
| 157 | } |
| 158 | |
| 159 | if (char === "'" || char === '"' || char === '`') { |
| 160 | quote = char |
| 161 | continue |
| 162 | } |
| 163 | |
| 164 | if (char === '(') { |
| 165 | parenDepth += 1 |
| 166 | continue |
no outgoing calls
no test coverage detected