Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library analyzer2dart.semantic_visitor; | 5 library analyzer2dart.semantic_visitor; |
| 6 | 6 |
| 7 import 'package:analyzer/analyzer.dart'; | 7 import 'package:analyzer/analyzer.dart'; |
| 8 import 'package:analyzer/src/generated/source.dart'; | 8 import 'package:analyzer/src/generated/source.dart'; |
| 9 | 9 |
| 10 import 'util.dart'; | 10 import 'util.dart'; |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 reportMessage(node, message); | 24 reportMessage(node, message); |
| 25 throw new UnimplementedError(message); | 25 throw new UnimplementedError(message); |
| 26 } | 26 } |
| 27 | 27 |
| 28 bool invariant(AstNode node, condition, String message) { | 28 bool invariant(AstNode node, condition, String message) { |
| 29 if (condition is Function) { | 29 if (condition is Function) { |
| 30 condition = condition(); | 30 condition = condition(); |
| 31 } | 31 } |
| 32 if (!condition) { | 32 if (!condition) { |
| 33 reportMessage(node, message); | 33 reportMessage(node, message); |
| 34 throw new AssertionError(); | 34 return false; |
|
floitsch
2014/10/16 12:23:59
If that's not just debugging code, I would do it i
Johnni Winther
2014/10/16 13:01:26
It is only for debugging.
| |
| 35 } | 35 } |
| 36 return true; | 36 return true; |
| 37 } | 37 } |
| 38 | 38 |
| 39 R visitDynamicInvocation(MethodInvocation node, | 39 R visitDynamicInvocation(MethodInvocation node, |
| 40 AccessSemantics semantics) { | 40 AccessSemantics semantics) { |
| 41 return giveUp(node, 'visitDynamicInvocation of $semantics'); | 41 return giveUp(node, 'visitDynamicInvocation of $semantics'); |
| 42 } | 42 } |
| 43 | 43 |
| 44 R visitLocalFunctionInvocation(MethodInvocation node, | 44 R visitLocalFunctionInvocation(MethodInvocation node, |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 return visitStaticMethodAccess(node, semantics); | 168 return visitStaticMethodAccess(node, semantics); |
| 169 case AccessKind.STATIC_PROPERTY: | 169 case AccessKind.STATIC_PROPERTY: |
| 170 return visitStaticPropertyAccess(node, semantics); | 170 return visitStaticPropertyAccess(node, semantics); |
| 171 default: | 171 default: |
| 172 // Unexpected access kind. | 172 // Unexpected access kind. |
| 173 return giveUp(node, | 173 return giveUp(node, |
| 174 'Unexpected ${semantics} in _handlePropertyAccess.'); | 174 'Unexpected ${semantics} in _handlePropertyAccess.'); |
| 175 } | 175 } |
| 176 } | 176 } |
| 177 } | 177 } |
| OLD | NEW |