@@ -21,7 +21,7 @@ module Vue {
21
21
VueExtend ( ) { this = vue ( ) .getAMemberCall ( "extend" ) }
22
22
}
23
23
24
- private newtype TInstance =
24
+ private newtype TComponent =
25
25
MkVueInstance ( DataFlow:: NewNode def ) { def = vue ( ) .getAnInstantiation ( ) } or
26
26
MkExtendedVue ( VueExtend extend ) or
27
27
MkExtendedInstance ( VueExtend extend , DataFlow:: NewNode sub ) {
@@ -82,20 +82,24 @@ module Vue {
82
82
}
83
83
84
84
/**
85
- * A Vue instance definition .
85
+ * A Vue component, such as a `new Vue({ ... })` call or a `.vue` file .
86
86
*
87
- * This includes both explicit instantiations of Vue objects, and
88
- * implicit instantiations in the form of components or Vue
89
- * extensions that have not yet been instantiated to a Vue instance.
87
+ * Generally speaking, a component is always created by calling `Vue.extend()` or
88
+ * calling `extend` on another component.
89
+ * Often the `Vue.extend()` call is performed by the Vue
90
+ * framework, however, so the call is not always visible in the user code.
91
+ * For instance, `new Vue(obj)` is shorthand for `new (Vue.extend(obj))`.
90
92
*
91
- * The following instances are recognized:
93
+ * This class covers both the explicit `Vue.extend()` calls an those implicit in the framework.
94
+ *
95
+ * The following types of components are recognized:
92
96
* - `new Vue({...})`
93
97
* - `Vue.extend({...})`
94
98
* - `new ExtendedVue({...})`
95
99
* - `Vue.component("my-component", {...})`
96
100
* - single file components in .vue files
97
101
*/
98
- class Instance extends TInstance {
102
+ class Component extends TComponent {
99
103
/** Gets a textual representation of this element. */
100
104
string toString ( ) { none ( ) } // overridden in subclasses
101
105
@@ -332,7 +336,7 @@ module Vue {
332
336
/**
333
337
* A Vue instance from `new Vue({...})`.
334
338
*/
335
- class VueInstance extends Instance , MkVueInstance {
339
+ class VueInstance extends Component , MkVueInstance {
336
340
DataFlow:: NewNode def ;
337
341
338
342
VueInstance ( ) { this = MkVueInstance ( def ) }
@@ -353,7 +357,7 @@ module Vue {
353
357
/**
354
358
* An extended Vue from `Vue.extend({...})`.
355
359
*/
356
- class ExtendedVue extends Instance , MkExtendedVue {
360
+ class ExtendedVue extends Component , MkExtendedVue {
357
361
VueExtend extend ;
358
362
359
363
ExtendedVue ( ) { this = MkExtendedVue ( extend ) }
@@ -374,7 +378,7 @@ module Vue {
374
378
/**
375
379
* An instance of an extended Vue, for example `instance` of `var Ext = Vue.extend({...}); var instance = new Ext({...})`.
376
380
*/
377
- class ExtendedInstance extends Instance , MkExtendedInstance {
381
+ class ExtendedInstance extends Component , MkExtendedInstance {
378
382
VueExtend extend ;
379
383
DataFlow:: NewNode sub ;
380
384
@@ -391,7 +395,7 @@ module Vue {
391
395
override DataFlow:: Node getOwnOptionsObject ( ) { result = sub .getArgument ( 0 ) }
392
396
393
397
override DataFlow:: Node getOption ( string name ) {
394
- result = Instance .super .getOption ( name )
398
+ result = Component .super .getOption ( name )
395
399
or
396
400
result = MkExtendedVue ( extend ) .( ExtendedVue ) .getOption ( name )
397
401
}
@@ -402,7 +406,7 @@ module Vue {
402
406
/**
403
407
* A Vue component from `Vue.component("my-component", { ... })`.
404
408
*/
405
- class ComponentRegistration extends Instance , MkComponentRegistration {
409
+ class ComponentRegistration extends Component , MkComponentRegistration {
406
410
DataFlow:: CallNode def ;
407
411
408
412
ComponentRegistration ( ) { this = MkComponentRegistration ( def ) }
@@ -423,7 +427,7 @@ module Vue {
423
427
/**
424
428
* A single file Vue component in a `.vue` file.
425
429
*/
426
- class SingleFileComponent extends Instance , MkSingleFileComponent {
430
+ class SingleFileComponent extends Component , MkSingleFileComponent {
427
431
VueFile file ;
428
432
429
433
SingleFileComponent ( ) { this = MkSingleFileComponent ( file ) }
@@ -496,7 +500,7 @@ module Vue {
496
500
*/
497
501
class InstanceHeapStep extends TaintTracking:: SharedTaintStep {
498
502
override predicate step ( DataFlow:: Node pred , DataFlow:: Node succ ) {
499
- exists ( Instance i , string name , DataFlow:: FunctionNode bound |
503
+ exists ( Component i , string name , DataFlow:: FunctionNode bound |
500
504
bound .flowsTo ( i .getABoundFunction ( ) ) and
501
505
not bound .getFunction ( ) instanceof ArrowFunctionExpr and
502
506
succ = bound .getReceiver ( ) .getAPropertyRead ( name ) and
@@ -531,7 +535,7 @@ module Vue {
531
535
*/
532
536
class VHtmlSourceWrite extends TaintTracking:: SharedTaintStep {
533
537
override predicate step ( DataFlow:: Node pred , DataFlow:: Node succ ) {
534
- exists ( Vue:: Instance instance , string expr , VHtmlAttribute attr |
538
+ exists ( Vue:: Component instance , string expr , VHtmlAttribute attr |
535
539
attr .getAttr ( ) .getRoot ( ) =
536
540
instance .getTemplateElement ( ) .( Vue:: Template:: HtmlElement ) .getElement ( ) and
537
541
expr = attr .getAttr ( ) .getValue ( ) and
@@ -638,7 +642,7 @@ module Vue {
638
642
or
639
643
result = routeConfig ( ) .getMember ( "beforeEnter" ) .getParameter ( [ 0 , 1 ] ) .getAnImmediateUse ( )
640
644
or
641
- exists ( Instance i |
645
+ exists ( Component i |
642
646
result = i .getABoundFunction ( ) .getAFunctionValue ( ) .getReceiver ( ) .getAPropertyRead ( "$route" )
643
647
or
644
648
result =
@@ -664,7 +668,7 @@ module Vue {
664
668
this = routeObject ( ) .getAPropertyRead ( name )
665
669
or
666
670
exists ( string prop |
667
- this = any ( Instance i ) .getWatchHandler ( prop ) .getParameter ( [ 0 , 1 ] ) and
671
+ this = any ( Component i ) .getWatchHandler ( prop ) .getParameter ( [ 0 , 1 ] ) and
668
672
name = prop .regexpCapture ( "\\$route\\.(params|query|hash|path|fullPath)\\b.*" , 1 )
669
673
)
670
674
|
0 commit comments