File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
src/compiler/phases/1-parse/read
tests/parser-modern/samples/snippets Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -22,12 +22,14 @@ export default function read_context(parser) {
2222 const code = full_char_code_at ( parser . template , i ) ;
2323 if ( isIdentifierStart ( code , true ) ) {
2424 const name = /** @type {string } */ ( parser . read_identifier ( ) ) ;
25+ const typeAnnotation = read_type_annotation ( parser ) ;
26+
2527 return {
2628 type : 'Identifier' ,
2729 name,
2830 start,
2931 end : parser . index ,
30- typeAnnotation : read_type_annotation ( parser )
32+ typeAnnotation
3133 } ;
3234 }
3335
@@ -81,6 +83,10 @@ export default function read_context(parser) {
8183 ) . left ;
8284
8385 expression . typeAnnotation = read_type_annotation ( parser ) ;
86+ if ( expression . typeAnnotation ) {
87+ expression . end = expression . typeAnnotation . end ;
88+ }
89+
8490 return expression ;
8591 } catch ( error ) {
8692 parser . acorn_error ( error ) ;
Original file line number Diff line number Diff line change 2828 "type" : " Identifier" ,
2929 "name" : " msg" ,
3030 "start" : 43 ,
31- "end" : 46 ,
31+ "end" : 54 ,
3232 "typeAnnotation" : {
3333 "type" : " TSStringKeyword" ,
3434 "start" : 48 ,
You can’t perform that action at this time.
0 commit comments