@@ -139,6 +139,12 @@ module Vue {
139
139
endcolumn = 0
140
140
}
141
141
142
+ /**
143
+ * Gets an API node referring to the options passed to the Vue object,
144
+ * such as the object literal `{...}` in `new Vue{{...})` or the default export of a single-file component.
145
+ */
146
+ API:: Node getOwnOptions ( ) { none ( ) } // overridden in subclass
147
+
142
148
/**
143
149
* Gets the options passed to the Vue object, such as the object literal `{...}` in `new Vue{{...})`
144
150
* or the default export of a single-file component.
@@ -356,7 +362,7 @@ module Vue {
356
362
* A Vue component from `new Vue({...})`.
357
363
*/
358
364
class VueInstance extends Component , MkVueInstance {
359
- DataFlow :: NewNode def ;
365
+ API :: NewNode def ;
360
366
361
367
VueInstance ( ) { this = MkVueInstance ( def ) }
362
368
@@ -368,6 +374,8 @@ module Vue {
368
374
def .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
369
375
}
370
376
377
+ override API:: Node getOwnOptions ( ) { result = def .getParameter ( 0 ) }
378
+
371
379
override DataFlow:: Node getOwnOptionsObject ( ) { result = def .getArgument ( 0 ) }
372
380
373
381
override Template:: Element getTemplateElement ( ) { none ( ) }
@@ -389,6 +397,8 @@ module Vue {
389
397
extend .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
390
398
}
391
399
400
+ override API:: Node getOwnOptions ( ) { result = extend .getParameter ( 0 ) }
401
+
392
402
override DataFlow:: Node getOwnOptionsObject ( ) { result = extend .getArgument ( 0 ) }
393
403
394
404
override Template:: Element getTemplateElement ( ) { none ( ) }
@@ -399,7 +409,7 @@ module Vue {
399
409
*/
400
410
class ExtendedInstance extends Component , MkExtendedInstance {
401
411
VueExtend extend ;
402
- DataFlow :: NewNode sub ;
412
+ API :: NewNode sub ;
403
413
404
414
ExtendedInstance ( ) { this = MkExtendedInstance ( extend , sub ) }
405
415
@@ -411,6 +421,8 @@ module Vue {
411
421
sub .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
412
422
}
413
423
424
+ override API:: Node getOwnOptions ( ) { result = sub .getParameter ( 0 ) }
425
+
414
426
override DataFlow:: Node getOwnOptionsObject ( ) { result = sub .getArgument ( 0 ) }
415
427
416
428
override DataFlow:: Node getOption ( string name ) {
@@ -426,7 +438,7 @@ module Vue {
426
438
* A Vue component from `Vue.component("my-component", { ... })`.
427
439
*/
428
440
class ComponentRegistration extends Component , MkComponentRegistration {
429
- DataFlow :: CallNode def ;
441
+ API :: CallNode def ;
430
442
431
443
ComponentRegistration ( ) { this = MkComponentRegistration ( def ) }
432
444
@@ -438,6 +450,8 @@ module Vue {
438
450
def .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn )
439
451
}
440
452
453
+ override API:: Node getOwnOptions ( ) { result = def .getParameter ( 1 ) }
454
+
441
455
override DataFlow:: Node getOwnOptionsObject ( ) { result = def .getArgument ( 1 ) }
442
456
443
457
override Template:: Element getTemplateElement ( ) { none ( ) }
@@ -476,6 +490,13 @@ module Vue {
476
490
)
477
491
}
478
492
493
+ override API:: Node getOwnOptions ( ) {
494
+ exists ( ExportDefaultDeclaration decl |
495
+ decl .getTopLevel ( ) = getModule ( ) and
496
+ result .getARhs ( ) = DataFlow:: valueNode ( decl .getOperand ( ) )
497
+ )
498
+ }
499
+
479
500
override DataFlow:: Node getOwnOptionsObject ( ) {
480
501
exists ( ExportDefaultDeclaration decl |
481
502
decl .getTopLevel ( ) = getModule ( ) and
0 commit comments