|
5 | 5 | import javascript
|
6 | 6 |
|
7 | 7 | module Vue {
|
| 8 | + /** The global variable `Vue`, as an API graph entry point. */ |
| 9 | + private class GlobalVueEntryPoint extends API::EntryPoint { |
| 10 | + GlobalVueEntryPoint() { this = "VueEntryPoint" } |
| 11 | + |
| 12 | + override DataFlow::SourceNode getAUse() { result = DataFlow::globalVarRef("Vue") } |
| 13 | + |
| 14 | + override DataFlow::Node getARhs() { none() } |
| 15 | + } |
| 16 | + |
8 | 17 | /**
|
9 |
| - * Gets a reference to the 'Vue' object. |
| 18 | + * Gets a reference to the `Vue` object. |
10 | 19 | */
|
11 |
| - DataFlow::SourceNode vue() { |
12 |
| - result = DataFlow::globalVarRef("Vue") |
| 20 | + API::Node vueLibrary() { |
| 21 | + result = API::moduleImport("vue") |
13 | 22 | or
|
14 |
| - result = DataFlow::moduleImport("vue") |
| 23 | + result = API::root().getASuccessor(any(GlobalVueEntryPoint e)) |
15 | 24 | }
|
16 | 25 |
|
| 26 | + /** |
| 27 | + * Gets a reference to the 'Vue' object. |
| 28 | + */ |
| 29 | + DataFlow::SourceNode vue() { result = vueLibrary().getAnImmediateUse() } |
| 30 | + |
17 | 31 | /**
|
18 | 32 | * A call to `vue.extend`.
|
19 | 33 | */
|
20 |
| - private class VueExtend extends DataFlow::CallNode { |
21 |
| - VueExtend() { this = vue().getAMemberCall("extend") } |
| 34 | + private class VueExtend extends API::CallNode { |
| 35 | + VueExtend() { this = vueLibrary().getMember("extend").getACall() } |
22 | 36 | }
|
23 | 37 |
|
24 | 38 | private newtype TComponent =
|
25 |
| - MkVueInstance(DataFlow::NewNode def) { def = vue().getAnInstantiation() } or |
| 39 | + MkVueInstance(DataFlow::NewNode def) { def = vueLibrary().getAnInstantiation() } or |
26 | 40 | MkExtendedVue(VueExtend extend) or
|
27 | 41 | MkExtendedInstance(VueExtend extend, DataFlow::NewNode sub) {
|
28 | 42 | sub = extend.getAnInstantiation()
|
29 | 43 | } or
|
30 |
| - MkComponentRegistration(DataFlow::CallNode def) { def = vue().getAMemberCall("component") } or |
| 44 | + MkComponentRegistration(DataFlow::CallNode def) { def = vueLibrary().getMember("component").getACall() } or |
31 | 45 | MkSingleFileComponent(VueFile file)
|
32 | 46 |
|
33 | 47 | /** Gets the name of a lifecycle hook method. */
|
|
0 commit comments