| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 27cfec6 commit c7f1619
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -371,6 +371,9 @@ util.formatWithOptions({ colors: true }, 'See object %O', { foo: 42 }); | |||
| 371 | 371 | <!-- YAML | |
| 372 | 372 | added: v22.9.0 | |
| 373 | 373 | changes: | |
| 374 | + - version: REPLACEME | ||
| 375 | + pr-url: https://github.com/nodejs/node/pull/56584 | ||
| 376 | + description: Property `column` is deprecated in favor of `columnNumber`. | ||
| 374 | 377 | - version: REPLACEME | |
| 375 | 378 | pr-url: https://github.com/nodejs/node/pull/56551 | |
| 376 | 379 | description: Property `CallSite.scriptId` is exposed. | |
@@ -389,8 +392,8 @@ changes: | |||
| 389 | 392 | * `scriptName` {string} Returns the name of the resource that contains the script for the | |
| 390 | 393 | function for this call site. | |
| 391 | 394 | * `scriptId` {string} Returns the unique id of the script, as in Chrome DevTools protocol [`Runtime.ScriptId`][]. | |
| 392 | - * `lineNumber` {number} Returns the number, 1-based, of the line for the associate function call. | ||
| 393 | - * `column` {number} Returns the 1-based column offset on the line for the associated function call. | ||
| 395 | + * `lineNumber` {number} Returns the JavaScript script line number (1-based). | ||
| 396 | + * `columnNumber` {number} Returns the JavaScript script column number (1-based). | ||
| 394 | 397 | ||
| 395 | 398 | Returns an array of call site objects containing the stack of | |
| 396 | 399 | the caller function. | |
@@ -407,7 +410,7 @@ function exampleFunction() { | |||
| 407 | 410 | console.log(`Function Name: ${callSite.functionName}`); | |
| 408 | 411 | console.log(`Script Name: ${callSite.scriptName}`); | |
| 409 | 412 | console.log(`Line Number: ${callSite.lineNumber}`); | |
| 410 | - console.log(`Column Number: ${callSite.column}`); | ||
| 413 | + console.log(`Column Number: ${callSite.columnNumber}`); | ||
| 411 | 414 | }); | |
| 412 | 415 | // CallSite 1: | |
| 413 | 416 | // Function Name: exampleFunction | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -348,10 +348,10 @@ const lazySourceMap = getLazy(() => require('internal/source_map/source_map_cach | |||
| 348 | 348 | * @returns {CallSite | undefined} // The reconstructed call site object | |
| 349 | 349 | */ | |
| 350 | 350 | function reconstructCallSite(callSite) { | |
| 351 | - const { scriptName, lineNumber, column } = callSite; | ||
| 351 | + const { scriptName, lineNumber, columnNumber } = callSite; | ||
| 352 | 352 | const sourceMap = lazySourceMap().findSourceMap(scriptName); | |
| 353 | 353 | if (!sourceMap) return; | |
| 354 | - const entry = sourceMap.findEntry(lineNumber - 1, column - 1); | ||
| 354 | + const entry = sourceMap.findEntry(lineNumber - 1, columnNumber - 1); | ||
| 355 | 355 | if (!entry?.originalSource) return; | |
| 356 | 356 | return { | |
| 357 | 357 | __proto__: null, | |
@@ -360,6 +360,7 @@ function reconstructCallSite(callSite) { | |||
| 360 | 360 | scriptName: entry.originalSource, | |
| 361 | 361 | lineNumber: entry.originalLine + 1, | |
| 362 | 362 | column: entry.originalColumn + 1, | |
| 363 | + columnNumber: entry.originalColumn + 1, | ||
| 363 | 364 | }; | |
| 364 | 365 | } | |
| 365 | 366 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -99,6 +99,7 @@ | |||
| 99 | 99 | "transferList") \ | |
| 100 | 100 | V(clone_untransferable_str, "Found invalid value in transferList.") \ | |
| 101 | 101 | V(code_string, "code") \ | |
| 102 | + V(column_number_string, "columnNumber") \ | ||
| 102 | 103 | V(column_string, "column") \ | |
| 103 | 104 | V(commonjs_string, "commonjs") \ | |
| 104 | 105 | V(config_string, "config") \ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -282,6 +282,8 @@ static void GetCallSites(const FunctionCallbackInfo<Value>& args) { | |||
| 282 | 282 | env->script_id_string(), | |
| 283 | 283 | env->script_name_string(), | |
| 284 | 284 | env->line_number_string(), | |
| 285 | + env->column_number_string(), | ||
| 286 | + // TODO(legendecas): deprecate CallSite.column. | ||
| 285 | 287 | env->column_string(), | |
| 286 | 288 | }; | |
| 287 | 289 | Local<Value> values[] = { | |
@@ -290,6 +292,8 @@ static void GetCallSites(const FunctionCallbackInfo<Value>& args) { | |||
| 290 | 292 | script_name, | |
| 291 | 293 | Integer::NewFromUnsigned(isolate, stack_frame->GetLineNumber()), | |
| 292 | 294 | Integer::NewFromUnsigned(isolate, stack_frame->GetColumn()), | |
| 295 | + // TODO(legendecas): deprecate CallSite.column. | ||
| 296 | + Integer::NewFromUnsigned(isolate, stack_frame->GetColumn()), | ||
| 293 | 297 | }; | |
| 294 | 298 | Local<Object> obj = Object::New( | |
| 295 | 299 | isolate, v8::Null(isolate), names, values, arraysize(names)); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -133,6 +133,7 @@ const assert = require('node:assert'); | |||
| 133 | 133 | assert.strictEqual(stderr.toString(), ''); | |
| 134 | 134 | assert.match(output, /lineNumber: 8/); | |
| 135 | 135 | assert.match(output, /column: 18/); | |
| 136 | + assert.match(output, /columnNumber: 18/); | ||
| 136 | 137 | assert.match(output, /test-get-callsite\.ts/); | |
| 137 | 138 | assert.strictEqual(status, 0); | |
| 138 | 139 | } | |
@@ -150,6 +151,7 @@ const assert = require('node:assert'); | |||
| 150 | 151 | // Line should be wrong when sourcemaps are disable | |
| 151 | 152 | assert.match(output, /lineNumber: 2/); | |
| 152 | 153 | assert.match(output, /column: 18/); | |
| 154 | + assert.match(output, /columnNumber: 18/); | ||
| 153 | 155 | assert.match(output, /test-get-callsite\.ts/); | |
| 154 | 156 | assert.strictEqual(status, 0); | |
| 155 | 157 | } | |
@@ -166,6 +168,7 @@ const assert = require('node:assert'); | |||
| 166 | 168 | assert.strictEqual(stderr.toString(), ''); | |
| 167 | 169 | assert.match(output, /lineNumber: 2/); | |
| 168 | 170 | assert.match(output, /column: 18/); | |
| 171 | + assert.match(output, /columnNumber: 18/); | ||
| 169 | 172 | assert.match(output, /test-get-callsite-explicit\.ts/); | |
| 170 | 173 | assert.strictEqual(status, 0); | |
| 171 | 174 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments