Skip to content

Commit 4ff135e

Browse files
committed
JS: Port class-based components to API graphs
1 parent 5cd0996 commit 4ff135e

File tree

1 file changed

+6
-7
lines changed
  • javascript/ql/lib/semmle/javascript/frameworks

1 file changed

+6
-7
lines changed

javascript/ql/lib/semmle/javascript/frameworks/Vue.qll

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ module Vue {
8686
/**
8787
* A class with a `@Component` decorator, making it usable as an "options" object in Vue.
8888
*/
89-
private class ClassComponent extends DataFlow::ClassNode {
89+
class ClassComponent extends DataFlow::ClassNode {
9090
DataFlow::Node decorator;
9191

9292
ClassComponent() {
@@ -102,12 +102,12 @@ module Vue {
102102
}
103103

104104
/**
105-
* Gets an option passed to the `@Component` decorator.
105+
* Gets the options object passed to the `@Component` decorator, if any.
106106
*
107107
* These options correspond to the options one would pass to `new Vue({...})` or similar.
108108
*/
109-
DataFlow::Node getDecoratorOption(string name) {
110-
result = decorator.(DataFlow::CallNode).getOptionArgument(0, name)
109+
API::Node getDecoratorOptions() {
110+
result = decorator.(API::CallNode).getParameter(0)
111111
}
112112
}
113113

@@ -187,6 +187,8 @@ module Vue {
187187
result = getOwnOptions().getMember(["extends", "mixins"]).getAMember()
188188
or
189189
result = getABaseComponent().getOptions()
190+
or
191+
result = getAsClassComponent().getDecoratorOptions()
190192
}
191193

192194
/**
@@ -219,9 +221,6 @@ module Vue {
219221
*/
220222
DataFlow::Node getOption(string name) {
221223
result = getOptions().getMember(name).getARhs()
222-
or
223-
// not ported to API graphs yet
224-
result = getAsClassComponent().getDecoratorOption(name)
225224
}
226225

227226
/**

0 commit comments

Comments
 (0)