(src: string)
| 1 | export function containsRealNgDeclare(src: string): boolean { |
| 2 | let inStr = false, |
| 3 | strCh = '', |
| 4 | esc = false, |
| 5 | inBlk = false, |
| 6 | inLine = false; |
| 7 | |
| 8 | for (let i = 0; i < src.length; i++) { |
| 9 | const ch = src[i]; |
| 10 | const next = src[i + 1]; |
| 11 | |
| 12 | if (inLine) { |
| 13 | if (ch === '\n') inLine = false; |
| 14 | continue; |
| 15 | } |
| 16 | if (inBlk) { |
| 17 | if (ch === '*' && next === '/') { |
| 18 | inBlk = false; |
| 19 | i++; |
| 20 | } |
| 21 | continue; |
| 22 | } |
| 23 | if (inStr) { |
| 24 | if (esc) { |
| 25 | esc = false; |
| 26 | continue; |
| 27 | } |
| 28 | if (ch === '\\') { |
| 29 | esc = true; |
| 30 | continue; |
| 31 | } |
| 32 | if (ch === strCh) { |
| 33 | inStr = false; |
| 34 | strCh = ''; |
| 35 | } |
| 36 | continue; |
| 37 | } |
| 38 | if (ch === '/' && next === '/') { |
| 39 | inLine = true; |
| 40 | i++; |
| 41 | continue; |
| 42 | } |
| 43 | if (ch === '/' && next === '*') { |
| 44 | inBlk = true; |
| 45 | i++; |
| 46 | continue; |
| 47 | } |
| 48 | if (ch === '"' || ch === "'" || ch === '`') { |
| 49 | inStr = true; |
| 50 | strCh = ch; |
| 51 | continue; |
| 52 | } |
| 53 | if (ch === 'ɵ' && next === 'ɵ' && src.startsWith('ɵɵngDeclare', i)) { |
| 54 | let j = i + 'ɵɵngDeclare'.length; |
| 55 | while (j < src.length) { |
| 56 | const cj = src.charCodeAt(j); |
| 57 | if ((cj >= 65 && cj <= 90) || (cj >= 97 && cj <= 122) || (cj >= 48 && cj <= 57) || cj === 95 || cj === 36) { |
| 58 | j++; |
| 59 | } else { |
| 60 | break; |
no test coverage detected