@@ -163,6 +163,15 @@ module Vue {
163
163
result = getAsClassComponent ( ) .getDecoratorOption ( name )
164
164
}
165
165
166
+ /**
167
+ * Gets a source node flowing into the option `name` of this instance, including those from
168
+ * extended objects and mixins.
169
+ */
170
+ pragma [ nomagic]
171
+ DataFlow:: SourceNode getOptionSource ( string name ) {
172
+ result = getOption ( name ) .getALocalSource ( )
173
+ }
174
+
166
175
/**
167
176
* Gets the template element used by this instance, if any.
168
177
*/
@@ -190,38 +199,43 @@ module Vue {
190
199
/**
191
200
* Gets the node for the `template` option of this instance.
192
201
*/
193
- DataFlow:: Node getTemplate ( ) { result = getOption ( "template" ) }
202
+ pragma [ nomagic]
203
+ DataFlow:: SourceNode getTemplate ( ) { result = getOptionSource ( "template" ) }
194
204
195
205
/**
196
206
* Gets the node for the `render` option of this instance.
197
207
*/
198
- DataFlow:: Node getRender ( ) {
199
- result = getOption ( "render" )
208
+ pragma [ nomagic]
209
+ DataFlow:: SourceNode getRender ( ) {
210
+ result = getOptionSource ( "render" )
200
211
or
201
212
result = getAsClassComponent ( ) .getInstanceMethod ( "render" )
202
213
}
203
214
204
215
/**
205
216
* Gets the node for the `methods` option of this instance.
206
217
*/
207
- DataFlow:: Node getMethods ( ) { result = getOption ( "methods" ) }
218
+ pragma [ nomagic]
219
+ DataFlow:: SourceNode getMethods ( ) { result = getOptionSource ( "methods" ) }
208
220
209
221
/**
210
222
* Gets the node for the `computed` option of this instance.
211
223
*/
212
- DataFlow:: Node getComputed ( ) { result = getOption ( "computed" ) }
224
+ pragma [ nomagic]
225
+ DataFlow:: SourceNode getComputed ( ) { result = getOptionSource ( "computed" ) }
213
226
214
227
/**
215
228
* Gets the node for the `watch` option of this instance.
216
229
*/
217
- DataFlow:: Node getWatch ( ) { result = getOption ( "watch" ) }
230
+ pragma [ nomagic]
231
+ DataFlow:: SourceNode getWatch ( ) { result = getOptionSource ( "watch" ) }
218
232
219
233
/**
220
234
* Gets the function responding to changes to the given `propName`.
221
235
*/
222
236
DataFlow:: FunctionNode getWatchHandler ( string propName ) {
223
237
exists ( DataFlow:: SourceNode watcher |
224
- watcher = getWatch ( ) .getALocalSource ( ) . getAPropertySource ( propName )
238
+ watcher = getWatch ( ) .getAPropertySource ( propName )
225
239
|
226
240
result = watcher
227
241
or
@@ -232,12 +246,9 @@ module Vue {
232
246
/**
233
247
* Gets a node for a member of the `methods` option of this instance.
234
248
*/
235
- pragma [ noinline]
236
- private DataFlow:: Node getAMethod ( ) {
237
- exists ( DataFlow:: ObjectLiteralNode methods |
238
- methods .flowsTo ( getMethods ( ) ) and
239
- result = methods .getAPropertyWrite ( ) .getRhs ( )
240
- )
249
+ pragma [ nomagic]
250
+ private DataFlow:: SourceNode getAMethod ( ) {
251
+ result = getMethods ( ) .getAPropertySource ( )
241
252
or
242
253
result = getAsClassComponent ( ) .getAnInstanceMethod ( ) and
243
254
not result = getAsClassComponent ( ) .getInstanceMethod ( [ lifecycleHookName ( ) , "render" , "data" ] )
@@ -246,19 +257,11 @@ module Vue {
246
257
/**
247
258
* Gets a node for a member of the `computed` option of this instance that matches `kind`.
248
259
*/
249
- pragma [ noinline]
250
- private DataFlow:: Node getAnAccessor ( DataFlow:: MemberKind kind ) {
251
- exists ( DataFlow:: ObjectLiteralNode computedObj , DataFlow:: Node accessorObjOrGetter |
252
- computedObj .flowsTo ( getComputed ( ) ) and
253
- computedObj .getAPropertyWrite ( ) .getRhs ( ) = accessorObjOrGetter
254
- |
255
- result = accessorObjOrGetter and kind = DataFlow:: MemberKind:: getter ( )
256
- or
257
- exists ( DataFlow:: ObjectLiteralNode accessorObj |
258
- accessorObj .flowsTo ( accessorObjOrGetter ) and
259
- result = accessorObj .getAPropertyWrite ( memberKindVerb ( kind ) ) .getRhs ( )
260
- )
261
- )
260
+ pragma [ nomagic]
261
+ private DataFlow:: SourceNode getAnAccessor ( DataFlow:: MemberKind kind ) {
262
+ result = getComputed ( ) .getAPropertySource ( ) and kind = DataFlow:: MemberKind:: getter ( )
263
+ or
264
+ result = getComputed ( ) .getAPropertySource ( ) .getAPropertySource ( memberKindVerb ( kind ) )
262
265
or
263
266
result = getAsClassComponent ( ) .getAnInstanceMember ( kind ) and
264
267
kind .isAccessor ( )
@@ -267,18 +270,10 @@ module Vue {
267
270
/**
268
271
* Gets a node for a member `name` of the `computed` option of this instance that matches `kind`.
269
272
*/
270
- private DataFlow:: Node getAccessor ( string name , DataFlow:: MemberKind kind ) {
271
- exists ( DataFlow:: ObjectLiteralNode computedObj , DataFlow:: SourceNode accessorObjOrGetter |
272
- computedObj .flowsTo ( getComputed ( ) ) and
273
- accessorObjOrGetter .flowsTo ( computedObj .getAPropertyWrite ( name ) .getRhs ( ) )
274
- |
275
- result = accessorObjOrGetter and kind = DataFlow:: MemberKind:: getter ( )
276
- or
277
- exists ( DataFlow:: ObjectLiteralNode accessorObj |
278
- accessorObj .flowsTo ( accessorObjOrGetter ) and
279
- result = accessorObj .getAPropertyWrite ( memberKindVerb ( kind ) ) .getRhs ( )
280
- )
281
- )
273
+ private DataFlow:: SourceNode getAccessor ( string name , DataFlow:: MemberKind kind ) {
274
+ result = getComputed ( ) .getAPropertySource ( name ) and kind = DataFlow:: MemberKind:: getter ( )
275
+ or
276
+ result = getComputed ( ) .getAPropertySource ( name ) .getAPropertySource ( memberKindVerb ( kind ) )
282
277
or
283
278
result = getAsClassComponent ( ) .getInstanceMember ( name , kind ) and
284
279
kind .isAccessor ( )
@@ -287,11 +282,11 @@ module Vue {
287
282
/**
288
283
* Gets the node for the life cycle hook of the `hookName` option of this instance.
289
284
*/
290
- pragma [ noinline ]
291
- DataFlow:: Node getALifecycleHook ( string hookName ) {
285
+ pragma [ nomagic ]
286
+ DataFlow:: SourceNode getALifecycleHook ( string hookName ) {
292
287
hookName = lifecycleHookName ( ) and
293
288
(
294
- result = getOption ( hookName )
289
+ result = getOptionSource ( hookName )
295
290
or
296
291
result = getAsClassComponent ( ) .getInstanceMethod ( hookName )
297
292
)
@@ -300,20 +295,21 @@ module Vue {
300
295
/**
301
296
* Gets a node for a function that will be invoked with `this` bound to this instance.
302
297
*/
303
- DataFlow:: Node getABoundFunction ( ) {
298
+ DataFlow:: FunctionNode getABoundFunction ( ) {
304
299
result = getAMethod ( )
305
300
or
306
301
result = getAnAccessor ( _)
307
302
or
308
303
result = getALifecycleHook ( _)
309
304
or
310
- result = getOption ( _ ) . ( DataFlow :: FunctionNode )
305
+ result = getOptionSource ( _ )
311
306
or
312
- result = getOption ( _) .getALocalSource ( ) . getAPropertySource ( ) . ( DataFlow :: FunctionNode )
307
+ result = getOptionSource ( _) .getAPropertySource ( )
313
308
}
314
309
315
310
/**
316
- * Gets a node for the value for property `name` of this instance.
311
+ * Gets the data flow node that flows into the property `name` of this instance, or is
312
+ * returned form a getter defining that property.
317
313
*/
318
314
DataFlow:: Node getAPropertyValue ( string name ) {
319
315
exists ( DataFlow:: SourceNode obj | obj .getAPropertyWrite ( name ) .getRhs ( ) = result |
0 commit comments