MCPcopy
hub / github.com/jquery/esprima / finalize

Method finalize

src/parser.ts:397–435  ·  view source on GitHub ↗
(marker: Marker, node)

Source from the content-addressed store, hash-verified

395 }
396
397 finalize(marker: Marker, node) {
398 if (this.config.range) {
399 node.range = [marker.index, this.lastMarker.index];
400 }
401
402 if (this.config.loc) {
403 node.loc = {
404 start: {
405 line: marker.line,
406 column: marker.column,
407 },
408 end: {
409 line: this.lastMarker.line,
410 column: this.lastMarker.column
411 }
412 };
413 if (this.config.source) {
414 node.loc.source = this.config.source;
415 }
416 }
417
418 if (this.delegate) {
419 const metadata = {
420 start: {
421 line: marker.line,
422 column: marker.column,
423 offset: marker.index
424 },
425 end: {
426 line: this.lastMarker.line,
427 column: this.lastMarker.column,
428 offset: this.lastMarker.index
429 }
430 };
431 this.delegate(node, metadata);
432 }
433
434 return node;
435 }
436
437 // Expect the next token to match the specified punctuator.
438 // If not, an exception will be thrown.

Callers 15

parseSpreadElementMethod · 0.95
parseArrayInitializerMethod · 0.95
parseObjectPropertyMethod · 0.95
parseTemplateHeadMethod · 0.95
parseTemplateElementMethod · 0.95
parseTemplateLiteralMethod · 0.95
parseGroupExpressionMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected