From afb0b37796d374700f4f8d86feaa81ac837ecd1e Mon Sep 17 00:00:00 2001 From: Justin Ridgewell Date: Mon, 22 Jul 2024 00:59:29 -0400 Subject: [PATCH] Scopes: Update `kind` to be an arbitrary string in the `names` field (#107) Update `kind` to be an arbitrary string in the `names` field. --- proposals/scopes.md | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/proposals/scopes.md b/proposals/scopes.md index 1c61bef..74c3574 100644 --- a/proposals/scopes.md +++ b/proposals/scopes.md @@ -125,7 +125,7 @@ interface SourceMap { interface OriginalScope { start: OriginalPosition; end: OriginalPosition; - kind: ScopeKind; + kind: string; /** Class/module/function name. Can be used for stack traces or naming scopes in a debugger's scope view */ name?: string; /** Symbols defined in this scope */ @@ -152,8 +152,6 @@ interface GeneratedRange { children?: GeneratedRange[]; } -type ScopeKind = 'global' | 'class' | 'function' | 'block'; - interface BindingRange { from: GeneratedPosition; to: GeneratedPosition; @@ -194,12 +192,10 @@ Note: Each DATA represents one VLQ number. * Note: this is the point in the original code where the scope starts. `line` is relative to the `line` of the preceding "start/end original scope" item. * DATA column in the original code * Note: Column is always absolute. -* DATA kind +* DATA kind offset into `names` field + * Note: This offset is relative to the offset of the last `kind` or absolute if this is the first `kind`. * Note: This is type of the scope. - * 0x1 toplevel - * 0x2 function - * 0x3 class - * 0x4 block + * Note: JavaScript implementations should use `'global'`, `'class'`, `'function'`, and `'block'`. * DATA field flags * Note: binary flags that specify if a field is used for this scope. * Note: Unknown flags would skip the whole scope.