# Source Map Debug Report

[Open in Source Map Viewer](https://source-map-viewer.void.app/rNLHvxnW)

## Overview

| Metric | Value |
|--------|-------|
| Sources | decorators.ts |
| Total mappings | 182 |
| Coverage | 61% of generated code |
| Invalid mappings | 0 |
| Boundary-crossing heuristics | 0 |
| Suspicious mappings | 16 |
| Quality warnings | 1 |
| Names | none |

## Issues

- 16 mapping(s) point into leading whitespace on the generated side. This often indicates generated columns were recorded before final indentation or formatting was applied.

## Pattern summary

- Suspicious mappings cluster into 11 regions, so this looks systematic rather than isolated.
- 16/16 suspicious mapping(s) also point into generated indentation.
- 16/16 suspicious mapping(s) start at line starts or emitted headers, which is consistent with statement-span or pre-print column recording.
- Region 1: original 56-56 → generated 43-43 around statement start (`return `${this._value}${this.u` → `return `${this._value}${this.u`).
- Region 2: original 23-25 → generated 22-24 around emitted code region (`descriptor.value = function (v` → `descriptor.value = function(va`).
- Region 3: original 51-51 → generated 40-40 around statement start (`return this._value * 9 / 5 + 3` → `return this._value * 9 / 5 + 3`).
- One plausible common cause: generated columns are recorded before indentation or whitespace is applied to the final output.

## Primary suspect

- Segment #146
- Suspicious region: 1 mapping(s), original lines 56-56, generated lines 43-43
- Raw mapping point: Original 56:4 `return `${this._value}${this.u` → Generated 43:0 `return `${this._value}${this.u`
- Flags: ⚡ generated-whitespace
- Original inferred range to next boundary: 56:4-56:11 `····[[return·]]`${this._val...`
- Generated inferred range to next boundary: 43:0-43:9 `[[⇥⇥return·]]`${this._val...`
- Next generated boundary: 43:9
- Why suspicious: the generated column points into indentation, which usually means generated columns were recorded before final formatting or indentation was applied.

## Original code excerpts

### decorators.ts

```typescript {3-5,11,16}
 21 |   return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) {
 22 |     const original = descriptor.value;
 23 |     descriptor.value = function (value: number) {
 24 |       if (value < min || value > max) {
 25 |         throw new RangeError(`${propertyKey}: value ${value} is out of range [${min}, ${max}]`);
 26 |       }
 27 |       return original.call(this, value);
  ... | ...
 49 |   @log
 50 |   toFahrenheit(): number {
 51 |     return this._value * 9 / 5 + 32;
 52 |   }
 53 | 
 54 |   @log
 55 |   toString(): string {
 56 |     return `${this._value}${this.unit}`;
 57 |   }
 58 | }
```

## Generated code excerpt

```javascript {3-5,11,14}
 20 | 	return function(target, propertyKey, descriptor) {
 21 | 		const original = descriptor.value;
 22 | 		descriptor.value = function(value) {
 23 | 			if (value < min || value > max) {
 24 | 				throw new RangeError(`${propertyKey}: value ${value} is out of range [${min}, ${max}]`);
 25 | 			}
 26 | 			return original.call(this, value);
  ... | ...
 38 | 	}
 39 | 	toFahrenheit() {
 40 | 		return this._value * 9 / 5 + 32;
 41 | 	}
 42 | 	toString() {
 43 | 		return `${this._value}${this.unit}`;
 44 | 	}
 45 | };
```

## Mapping table (showing 18 focused rows from 3 suspicious regions out of 182 total)

Original → Generated. Flags: ⚠️ invalid position, ✂️ boundary-crossing heuristic, ⚡ generated-whitespace, ⚡ original-whitespace.

| Orig | Original code | → | Gen | Generated code | Source | Flags |
|------|--------------|---|-----|---------------|--------|-------|
| 22:21 | `descriptor.value;` | → | 21:19 | `descriptor.value;` | decorators.ts |  |
| 22:32 | `value;` | → | 21:30 | `value;` | decorators.ts |  |
| 23:4 | `descriptor.value = function (v` | → | 22:0 | `descriptor.value = function(va` | decorators.ts | ⚡ generated-whitespace |
| 23:15 | `value = function (value: numbe` | → | 22:13 | `value = function(value) {` | decorators.ts |  |
| 23:23 | `function (value: number) {` | → | 22:21 | `function(value) {` | decorators.ts |  |
| 23:33 | `value: number) {` | → | 22:30 | `value) {` | decorators.ts |  |
| ... | _49 mapping(s) omitted_ |  | ... | _focused around likely issues_ |  |  |
| 50:2 | `toFahrenheit(): number {` | → | 39:1 | `toFahrenheit() {` | decorators.ts |  |
| 50:25 | `{` | → | 39:16 | `{` | decorators.ts |  |
| 51:4 | `return this._value * 9 / 5 + 3` | → | 40:0 | `return this._value * 9 / 5 + 3` | decorators.ts | ⚡ generated-whitespace |
| 51:11 | `this._value * 9 / 5 + 32;` | → | 40:9 | `this._value * 9 / 5 + 32;` | decorators.ts |  |
| 51:16 | `_value * 9 / 5 + 32;` | → | 40:14 | `_value * 9 / 5 + 32;` | decorators.ts |  |
| 51:25 | `9 / 5 + 32;` | → | 40:23 | `9 / 5 + 32;` | decorators.ts |  |
| ... | _3 mapping(s) omitted_ |  | ... | _focused around likely issues_ |  |  |
| 55:2 | `toString(): string {` | → | 42:1 | `toString() {` | decorators.ts |  |
| 55:21 | `{` | → | 42:12 | `{` | decorators.ts |  |
| 56:4 | `return `${this._value}${this.u` | → | 43:0 | `return `${this._value}${this.u` | decorators.ts | ⚡ generated-whitespace |
| 56:11 | ``${this._value}${this.unit}`;` | → | 43:9 | ``${this._value}${this.unit}`;` | decorators.ts |  |
| 56:14 | `this._value}${this.unit}`;` | → | 43:12 | `this._value}${this.unit}`;` | decorators.ts |  |
| 56:19 | `_value}${this.unit}`;` | → | 43:17 | `_value}${this.unit}`;` | decorators.ts |  |

## Analysis instructions

1. **Start with the primary suspect** — Explain whether that mapping is genuinely wrong or merely reflects expected source-level changes (type erasure, helper insertion, wrapper generation, minification, etc.).
2. **Inspect the boundary** — Use the raw mapping point and the inferred next-boundary ranges above to identify the exact generated/original token boundary that should have been recorded instead.
3. **Identify the pattern** — Decide whether the bug is indentation drift, token-span selection, helper or wrapper generation, printer timing, or another source-map generation pattern.
4. **Suggest a fix** — Point to the source-map recording logic that should change, and describe the exact span/column that should be recorded.

## Reference

- [ECMA-426: Source Map Format](https://tc39.es/ecma426/)

## Appendix: Raw mappings (VLQ)

```text
;;AAAA,SAAS,IAAI,QAAa,aAAqB,YAAgC;CAC7E,MAAM,WAAW,WAAW;AAC5B,YAAW,QAAQ,SAAU,GAAG,MAAa;AAC3C,UAAQ,IAAI,WAAW,YAAY,QAAQ,KAAK;EAChD,MAAM,SAAS,SAAS,MAAM,MAAM,KAAK;AACzC,UAAQ,IAAI,GAAG,YAAY,YAAY,OAAO;AAC9C,SAAO;;;AAIX,SAAS,OAAO,aAAuB;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