OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /// API to get results from a static analysis of the source program. | 5 /// API to get results from a static analysis of the source program. |
6 // TODO(sigmund): split out implementations out of this file. | 6 // TODO(sigmund): split out implementations out of this file. |
7 library compiler.src.stats.naive_analysis_result; | 7 library compiler.src.stats.naive_analysis_result; |
8 | 8 |
9 import 'analysis_result.dart'; | 9 import 'analysis_result.dart'; |
10 import '../tree/tree.dart' show Node; | 10 import '../tree/tree.dart' show Node; |
11 import '../universe/selector.dart' show Selector; | 11 import '../universe/selector.dart' show Selector; |
12 | 12 |
13 /// A naive [AnalysisResult] that tells us very little. This is the most | 13 /// A naive [AnalysisResult] that tells us very little. This is the most |
14 /// conservative we can be when we only use information from the AST structure | 14 /// conservative we can be when we only use information from the AST structure |
15 /// and from resolution, but no type information. | 15 /// and from resolution, but no type information. |
16 class NaiveAnalysisResult implements AnalysisResult { | 16 class NaiveAnalysisResult implements AnalysisResult { |
17 NaiveAnalysisResult(); | 17 NaiveAnalysisResult(); |
18 | 18 |
19 ReceiverInfo infoForReceiver(Node receiver) => | 19 ReceiverInfo infoForReceiver(Node receiver) => |
20 new NaiveReceiverInfo(receiver); | 20 new NaiveReceiverInfo(receiver); |
21 SelectorInfo infoForSelector(Node receiver, Selector selector) => | 21 SelectorInfo infoForSelector(Node receiver, Selector selector) => |
22 new NaiveSelectorInfo(receiver, selector); | 22 new NaiveSelectorInfo(receiver, selector); |
23 } | 23 } |
24 | 24 |
25 class NaiveReceiverInfo implements ReceiverInfo { | 25 class NaiveReceiverInfo implements ReceiverInfo { |
26 final Node receiver; | 26 final Node receiver; |
27 | 27 |
28 NaiveReceiverInfo(this.receiver); | 28 NaiveReceiverInfo(this.receiver); |
29 Boolish get hasNoSuchMethod => Boolish.maybe; | 29 Boolish get hasNoSuchMethod => Boolish.maybe; |
30 Boolish get isNull => Boolish.maybe; | 30 Boolish get isNull => Boolish.maybe; |
31 int get possibleNsmTargets => -1; | 31 int get possibleNsmTargets => -1; |
32 } | 32 } |
33 | 33 |
34 class NaiveSelectorInfo implements SelectorInfo { | 34 class NaiveSelectorInfo implements SelectorInfo { |
35 final Node receiver; | 35 final Node receiver; |
36 final Selector selector; | 36 final Selector selector; |
37 | 37 |
38 NaiveSelectorInfo(this.receiver, this.selector); | 38 NaiveSelectorInfo(this.receiver, this.selector); |
39 | 39 |
40 Boolish get exists => Boolish.maybe; | 40 Boolish get exists => Boolish.maybe; |
41 Boolish get usesInterceptor => Boolish.maybe; | 41 Boolish get usesInterceptor => Boolish.maybe; |
42 int get possibleTargets => -1; | 42 int get possibleTargets => -1; |
43 bool get isAccurate => false; | 43 bool get isAccurate => false; |
44 } | 44 } |
OLD | NEW |