@@ -175,6 +175,10 @@ class Transformer extends Source {
175175
176176 if ( node instanceof angular . LiteralMap ) {
177177 const { keys, values } = node ;
178+ const createChild = < T extends NGNode > (
179+ properties : Partial < T > & { type : T [ 'type' ] } ,
180+ location : angular . AST | RawNGSpan | [ number , number ] = node ,
181+ ) => this . #create( properties , location , [ node , ...ancestors ] ) ;
178182 const tProperties = keys . map ( ( property , index ) => {
179183 const { key, quoted, isShorthandInitialized = false } = property ;
180184 const { start : valueStart , end : valueEnd } = values [ index ] . sourceSpan ;
@@ -186,6 +190,8 @@ class Transformer extends Source {
186190 if ( isShorthandInitialized ) {
187191 tKey = transformChild < babel . Identifier > ( values [ index ] ) ;
188192 } else {
193+ // No location information
194+ // https://github.com/angular/angular/issues/66175
189195 const keyStart = super . getCharacterIndex (
190196 / \S / ,
191197 index === 0
@@ -201,19 +207,17 @@ class Transformer extends Source {
201207 super . getCharacterLastIndex ( ':' , valueStart - 1 ) - 1 ,
202208 ) + 1 ;
203209 tKey = quoted
204- ? createNode < babel . StringLiteral > (
210+ ? createChild < babel . StringLiteral > (
205211 { type : 'StringLiteral' , value : key } ,
206212 [ keyStart , keyEnd ] ,
207- [ ] ,
208213 )
209- : createNode < babel . Identifier > (
210- { type : 'Identifier' , name : key } ,
211- [ keyStart , keyEnd ] ,
212- [ ] ,
213- ) ;
214+ : createChild < babel . Identifier > ( { type : 'Identifier' , name : key } , [
215+ keyStart ,
216+ keyEnd ,
217+ ] ) ;
214218 }
215219
216- return createNode < babel . ObjectPropertyNonComputed > (
220+ return createChild < babel . ObjectPropertyNonComputed > (
217221 {
218222 type : 'ObjectProperty' ,
219223 key : tKey ,
@@ -224,7 +228,6 @@ class Transformer extends Source {
224228 method : false ,
225229 } ,
226230 [ tKey . range [ 0 ] , valueEnd ] ,
227- [ ] ,
228231 ) ;
229232 } ) ;
230233 return createNode < babel . ObjectExpression > ( {
0 commit comments