File tree Expand file tree Collapse file tree 2 files changed +8
-13
lines changed
Expand file tree Collapse file tree 2 files changed +8
-13
lines changed Original file line number Diff line number Diff line change 11coverage /
2- dist /
2+ dist * /
33node_modules /
44* .log
55.yarn /*
Original file line number Diff line number Diff line change @@ -27,21 +27,13 @@ function isOptionalObjectOrCallee(node: NGNode): boolean {
2727 ) ;
2828}
2929
30- function isImplicitThis ( node : angular . AST , text : string ) : boolean {
31- const { start, end } = node . sourceSpan ;
32- return start >= end || / ^ \s + $ / . test ( text . slice ( start , end ) ) ;
33- }
34-
3530type NodeTransformOptions = {
3631 ancestors : angular . AST [ ] ;
3732} ;
3833
3934class Transformer extends Source {
40- #text;
41-
4235 constructor ( text : string ) {
4336 super ( text ) ;
44- this . #text = text ;
4537 }
4638
4739 transform < T extends NGNode > (
@@ -457,24 +449,27 @@ class Transformer extends Source {
457449
458450 const { receiver } = node ;
459451
460- const implicit = isImplicitThis ( receiver , this . #text ) ;
452+ let isImplicitThis ;
461453
462454 let property ;
463455 if ( isComputed ) {
456+ isImplicitThis = node . sourceSpan . start === node . key . sourceSpan . start ;
464457 property = this . transform < babel . Expression > ( node . key ) ;
465458 } else {
466- const { name } = node ;
459+ const { name, nameSpan } = node ;
460+
461+ isImplicitThis = node . sourceSpan . start === nameSpan . start ;
467462 property = this . #create< babel . Identifier > (
468463 {
469464 type : 'Identifier' ,
470465 name,
471466 ...node . nameSpan ,
472467 } ,
473- implicit ? ancestors : [ ] ,
468+ isImplicitThis ? ancestors : [ ] ,
474469 ) ;
475470 }
476471
477- if ( implicit || receiver . sourceSpan . start === property . start ) {
472+ if ( isImplicitThis ) {
478473 return property ;
479474 }
480475
You can’t perform that action at this time.
0 commit comments