OLD | NEW |
---|---|
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import '../common/names.dart' show Identifiers, Names; | 5 import '../common/names.dart' show Identifiers, Names; |
6 import '../elements/elements.dart'; | 6 import '../elements/elements.dart'; |
7 import '../js_backend/no_such_method_registry.dart'; | 7 import '../js_backend/no_such_method_registry.dart'; |
8 import '../tree/tree.dart'; | 8 import '../tree/tree.dart'; |
9 | 9 |
10 /// AST-based implementation of [NoSuchMethodResolver]. | 10 /// AST-based implementation of [NoSuchMethodResolver]. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 if (expr is Send && | 45 if (expr is Send && |
46 expr.isSuperCall && | 46 expr.isSuperCall && |
47 expr.selector is Identifier && | 47 expr.selector is Identifier && |
48 (expr.selector as Identifier).source == Identifiers.noSuchMethod_) { | 48 (expr.selector as Identifier).source == Identifiers.noSuchMethod_) { |
49 var arg = expr.arguments.head; | 49 var arg = expr.arguments.head; |
50 if (expr.arguments.tail.isEmpty && | 50 if (expr.arguments.tail.isEmpty && |
51 arg is Send && | 51 arg is Send && |
52 arg.argumentsNode == null && | 52 arg.argumentsNode == null && |
53 arg.receiver == null && | 53 arg.receiver == null && |
54 arg.selector is Identifier && | 54 arg.selector is Identifier && |
55 // ignore: UNDEFINED_GETTER | |
ahe
2017/06/15 09:36:39
Type of arg is *known* to be Send due to is test,
Johnni Winther
2017/06/15 10:21:26
We probably need to nest ifs to make 'arg.selector
ahe
2017/06/15 11:41:57
Done.
| |
55 arg.selector.source == param) { | 56 arg.selector.source == param) { |
56 return true; | 57 return true; |
57 } | 58 } |
58 } | 59 } |
59 return false; | 60 return false; |
60 } | 61 } |
61 | 62 |
62 bool hasThrowingSyntax(MethodElement element) { | 63 bool hasThrowingSyntax(MethodElement element) { |
63 if (!element.hasResolvedAst) { | 64 if (!element.hasResolvedAst) { |
64 // TODO(johnniwinther): Why do we see unresolved elements here? | 65 // TODO(johnniwinther): Why do we see unresolved elements here? |
(...skipping 16 matching lines...) Expand all Loading... | |
81 return stmt.expression is Throw; | 82 return stmt.expression is Throw; |
82 } | 83 } |
83 } | 84 } |
84 return false; | 85 return false; |
85 } | 86 } |
86 | 87 |
87 MethodElement getSuperNoSuchMethod(MethodElement method) { | 88 MethodElement getSuperNoSuchMethod(MethodElement method) { |
88 return method.enclosingClass.lookupSuperByName(Names.noSuchMethod_); | 89 return method.enclosingClass.lookupSuperByName(Names.noSuchMethod_); |
89 } | 90 } |
90 } | 91 } |
OLD | NEW |