derivedImpl.ts ×9

Frontier kind: Code frontier

unlabeled · c_923b9a380880

190 tests · 6674 LOC · 59 files · introduces 0 tests · 47 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
9 ranges47 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
986 ranges6674 lines · 59 files · Browse complete extent
All tests (intent)
190 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 47 introduced LOC across 9 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/base/common/observableInternal/observables/derivedImpl.ts 47 introduced LOC · 9 ranges

Open complete file

246
247 public beginUpdate<T>(_observable: IObservable<T>): void {
248 > if (this._isUpdating) { derivedImpl.ts
249 throw new BugIndicatingError('Cyclic deriveds are not supported yet!');
250 }
252 > this._updateCount++;
253 > this._isUpdating = true;
254 > try {
255 > const propagateBeginUpdate = this._updateCount === 1;
256 > if (this._state === DerivedState.upToDate) {
257 > this._state = DerivedState.dependenciesMightHaveChanged;
258 > // If we propagate begin update, that will already signal a possible change.
259 > if (!propagateBeginUpdate) {
260 for (const r of this._observers) {
261 r.handlePossibleChange(this);
262 }
263 }
264 > } derivedImpl.ts
265 > if (propagateBeginUpdate) {
266 > for (const r of this._observers) {
267 > r.beginUpdate(this); // This signals a possible change
268 > }
269 > }
270 > } finally {
271 > this._isUpdating = false;
272 > }
273 > }
274
275 public endUpdate<T>(_observable: IObservable<T>): void {
276 > this._updateCount--; derivedImpl.ts
277 > if (this._updateCount === 0) {
278 > // End update could change the observer list.
279 > const observers = [...this._observers];
280 > for (const r of observers) {
281 > r.endUpdate(this);
282 > }
283 > if (this._removedObserverToCallEndUpdateOn) {
284 const observers = [...this._removedObserverToCallEndUpdateOn];
285 this._removedObserverToCallEndUpdateOn = null;
288 }
289 }
290 > } derivedImpl.ts
291 > assertFn(() => this._updateCount >= 0);
292 > }
293
294 public handlePossibleChange<T>(observable: IObservable<T>): void {
303
304 public handleChange<T, TChange>(observable: IObservableWithChange<T, TChange>, change: TChange): void {
305 > if (this._dependencies.has(observable) && !this._dependenciesToBeRemoved.has(observable) || this._isInBeforeUpdate) { derivedImpl.ts
306 > getLogger()?.handleDerivedDependencyChanged(this, observable, change);
307 >
308 > let shouldReact = false;
309 > try {
310 > shouldReact = this._changeTracker ? this._changeTracker.handleChange({
311 changedObservable: observable,
312 change,
313 // eslint-disable-next-line local/code-no-any-casts
314 didChange: (o): this is any => o === observable as any,
315 > }, this._changeSummary!) : true; derivedImpl.ts
316 > } catch (e) {
317 onBugIndicatingError(e);
318 }
320 > const wasUpToDate = this._state === DerivedState.upToDate;
321 > if (shouldReact && (this._state === DerivedState.dependenciesMightHaveChanged || wasUpToDate)) {
322 > this._state = DerivedState.stale;
323 > if (wasUpToDate) {
324 for (const r of this._observers) {
325 r.handlePossibleChange(this);
326 }
327 }
328 > } derivedImpl.ts
329 > }
330 > }
331
332 // IReader Implementation