File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ export class IdentifierPath implements SlangNode {
1818 separators : string [ ] ;
1919
2020 constructor ( ast : ast . IdentifierPath , offset : number ) {
21- const metadata = getNodeMetadata ( ast , offset , true ) ;
21+ const metadata = getNodeMetadata ( ast , offset ) ;
2222 const { offsets } = metadata ;
2323
2424 this . items = ast . items . map (
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ function getLeadingOffset(children: Node[]): number {
2929export function getNodeMetadata (
3030 ast : SlangAstNode ,
3131 initialOffset : number ,
32- isHubNode = false
32+ includePeripheralComments = false
3333) : Metadata {
3434 if ( typeof initialOffset === 'undefined' ) {
3535 throw new Error ( "Can't initiate metadata with an undefined initialOffset" ) ;
@@ -78,8 +78,12 @@ export function getNodeMetadata(
7878 return offsetsArray ;
7979 } , [ ] ) ;
8080
81- const leadingOffset = isHubNode ? 0 : getLeadingOffset ( children ) ;
82- const trailingOffset = isHubNode ? 0 : getLeadingOffset ( children . reverse ( ) ) ;
81+ const leadingOffset = includePeripheralComments
82+ ? 0
83+ : getLeadingOffset ( children ) ;
84+ const trailingOffset = includePeripheralComments
85+ ? 0
86+ : getLeadingOffset ( children . reverse ( ) ) ;
8387 const loc = {
8488 start : initialOffset + leadingOffset ,
8589 end : initialOffset + ast . cst . textLength . utf8 - trailingOffset ,
You can’t perform that action at this time.
0 commit comments