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) {
22
22
const code = full_char_code_at ( parser . template , i ) ;
23
23
if ( isIdentifierStart ( code , true ) ) {
24
24
const name = /** @type {string } */ ( parser . read_identifier ( ) ) ;
25
+ const typeAnnotation = read_type_annotation ( parser ) ;
26
+
25
27
return {
26
28
type : 'Identifier' ,
27
29
name,
28
30
start,
29
31
end : parser . index ,
30
- typeAnnotation : read_type_annotation ( parser )
32
+ typeAnnotation
31
33
} ;
32
34
}
33
35
@@ -81,6 +83,10 @@ export default function read_context(parser) {
81
83
) . left ;
82
84
83
85
expression . typeAnnotation = read_type_annotation ( parser ) ;
86
+ if ( expression . typeAnnotation ) {
87
+ expression . end = expression . typeAnnotation . end ;
88
+ }
89
+
84
90
return expression ;
85
91
} catch ( error ) {
86
92
parser . acorn_error ( error ) ;
Original file line number Diff line number Diff line change 28
28
"type" : " Identifier" ,
29
29
"name" : " msg" ,
30
30
"start" : 43 ,
31
- "end" : 46 ,
31
+ "end" : 54 ,
32
32
"typeAnnotation" : {
33
33
"type" : " TSStringKeyword" ,
34
34
"start" : 48 ,
You can’t perform that action at this time.
0 commit comments