@@ -21,7 +21,7 @@ module Vue {
2121 VueExtend ( ) { this = vue ( ) .getAMemberCall ( "extend" ) }
2222 }
2323
24- private newtype TInstance =
24+ private newtype TComponent =
2525 MkVueInstance ( DataFlow:: NewNode def ) { def = vue ( ) .getAnInstantiation ( ) } or
2626 MkExtendedVue ( VueExtend extend ) or
2727 MkExtendedInstance ( VueExtend extend , DataFlow:: NewNode sub ) {
@@ -82,20 +82,24 @@ module Vue {
8282 }
8383
8484 /**
85- * A Vue instance definition .
85+ * A Vue component, such as a `new Vue({ ... })` call or a `.vue` file .
8686 *
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))`.
9092 *
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:
9296 * - `new Vue({...})`
9397 * - `Vue.extend({...})`
9498 * - `new ExtendedVue({...})`
9599 * - `Vue.component("my-component", {...})`
96100 * - single file components in .vue files
97101 */
98- class Instance extends TInstance {
102+ class Component extends TComponent {
99103 /** Gets a textual representation of this element. */
100104 string toString ( ) { none ( ) } // overridden in subclasses
101105
@@ -332,7 +336,7 @@ module Vue {
332336 /**
333337 * A Vue instance from `new Vue({...})`.
334338 */
335- class VueInstance extends Instance , MkVueInstance {
339+ class VueInstance extends Component , MkVueInstance {
336340 DataFlow:: NewNode def ;
337341
338342 VueInstance ( ) { this = MkVueInstance ( def ) }
@@ -353,7 +357,7 @@ module Vue {
353357 /**
354358 * An extended Vue from `Vue.extend({...})`.
355359 */
356- class ExtendedVue extends Instance , MkExtendedVue {
360+ class ExtendedVue extends Component , MkExtendedVue {
357361 VueExtend extend ;
358362
359363 ExtendedVue ( ) { this = MkExtendedVue ( extend ) }
@@ -374,7 +378,7 @@ module Vue {
374378 /**
375379 * An instance of an extended Vue, for example `instance` of `var Ext = Vue.extend({...}); var instance = new Ext({...})`.
376380 */
377- class ExtendedInstance extends Instance , MkExtendedInstance {
381+ class ExtendedInstance extends Component , MkExtendedInstance {
378382 VueExtend extend ;
379383 DataFlow:: NewNode sub ;
380384
@@ -391,7 +395,7 @@ module Vue {
391395 override DataFlow:: Node getOwnOptionsObject ( ) { result = sub .getArgument ( 0 ) }
392396
393397 override DataFlow:: Node getOption ( string name ) {
394- result = Instance .super .getOption ( name )
398+ result = Component .super .getOption ( name )
395399 or
396400 result = MkExtendedVue ( extend ) .( ExtendedVue ) .getOption ( name )
397401 }
@@ -402,7 +406,7 @@ module Vue {
402406 /**
403407 * A Vue component from `Vue.component("my-component", { ... })`.
404408 */
405- class ComponentRegistration extends Instance , MkComponentRegistration {
409+ class ComponentRegistration extends Component , MkComponentRegistration {
406410 DataFlow:: CallNode def ;
407411
408412 ComponentRegistration ( ) { this = MkComponentRegistration ( def ) }
@@ -423,7 +427,7 @@ module Vue {
423427 /**
424428 * A single file Vue component in a `.vue` file.
425429 */
426- class SingleFileComponent extends Instance , MkSingleFileComponent {
430+ class SingleFileComponent extends Component , MkSingleFileComponent {
427431 VueFile file ;
428432
429433 SingleFileComponent ( ) { this = MkSingleFileComponent ( file ) }
@@ -496,7 +500,7 @@ module Vue {
496500 */
497501 class InstanceHeapStep extends TaintTracking:: SharedTaintStep {
498502 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 |
500504 bound .flowsTo ( i .getABoundFunction ( ) ) and
501505 not bound .getFunction ( ) instanceof ArrowFunctionExpr and
502506 succ = bound .getReceiver ( ) .getAPropertyRead ( name ) and
@@ -531,7 +535,7 @@ module Vue {
531535 */
532536 class VHtmlSourceWrite extends TaintTracking:: SharedTaintStep {
533537 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 |
535539 attr .getAttr ( ) .getRoot ( ) =
536540 instance .getTemplateElement ( ) .( Vue:: Template:: HtmlElement ) .getElement ( ) and
537541 expr = attr .getAttr ( ) .getValue ( ) and
@@ -638,7 +642,7 @@ module Vue {
638642 or
639643 result = routeConfig ( ) .getMember ( "beforeEnter" ) .getParameter ( [ 0 , 1 ] ) .getAnImmediateUse ( )
640644 or
641- exists ( Instance i |
645+ exists ( Component i |
642646 result = i .getABoundFunction ( ) .getAFunctionValue ( ) .getReceiver ( ) .getAPropertyRead ( "$route" )
643647 or
644648 result =
@@ -664,7 +668,7 @@ module Vue {
664668 this = routeObject ( ) .getAPropertyRead ( name )
665669 or
666670 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
668672 name = prop .regexpCapture ( "\\$route\\.(params|query|hash|path|fullPath)\\b.*" , 1 )
669673 )
670674 |
0 commit comments