UNPKG

1.05 kBJavaScriptView Raw
1"use strict";
2/**
3 * @license
4 * Copyright Google LLC All Rights Reserved.
5 *
6 * Use of this source code is governed by an MIT-style license that can be
7 * found in the LICENSE file at https://angular.io/license
8 */
9Object.defineProperty(exports, "__esModule", { value: true });
10exports.SourceFileCache = void 0;
11class SourceFileCache extends Map {
12 constructor() {
13 super(...arguments);
14 this.angularDiagnostics = new Map();
15 }
16 invalidate(file) {
17 const sourceFile = this.get(file);
18 if (sourceFile) {
19 this.delete(file);
20 this.angularDiagnostics.delete(sourceFile);
21 }
22 }
23 updateAngularDiagnostics(sourceFile, diagnostics) {
24 if (diagnostics.length > 0) {
25 this.angularDiagnostics.set(sourceFile, diagnostics);
26 }
27 else {
28 this.angularDiagnostics.delete(sourceFile);
29 }
30 }
31 getAngularDiagnostics(sourceFile) {
32 return this.angularDiagnostics.get(sourceFile);
33 }
34}
35exports.SourceFileCache = SourceFileCache;