Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Unified Diff: pkg/compiler/lib/src/resolution/members.dart

Issue 819183005: Wrap standalone invariant() calls in assert(). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/dart_types.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/resolution/members.dart
diff --git a/pkg/compiler/lib/src/resolution/members.dart b/pkg/compiler/lib/src/resolution/members.dart
index 74ec34ed69822593b30a10e80cef15ad78e02202..3936f504d44b66a2f3c50bf0be1288b09e059e5e 100644
--- a/pkg/compiler/lib/src/resolution/members.dart
+++ b/pkg/compiler/lib/src/resolution/members.dart
@@ -2051,7 +2051,9 @@ abstract class MappingVisitor<T> extends CommonResolverVisitor<T> {
/// Register [node] as the definition of [element].
void defineLocalVariable(Node node, LocalVariableElement element) {
- invariant(node, element != null);
+ if (element == null) {
+ throw compiler.internalError(node, 'element is null');
+ }
checkLocalDefinitionName(node, element);
registry.defineElement(node, element);
}
@@ -4174,9 +4176,13 @@ class ClassResolverVisitor extends TypeDefinitionVisitor {
: super(compiler, classElement, registry);
DartType visitClassNode(ClassNode node) {
- invariant(node, element != null);
- invariant(element, element.resolutionState == STATE_STARTED,
- message: () => 'cyclic resolution of class $element');
+ if (element == null) {
+ throw compiler.internalError(node, 'element is null');
+ }
+ if (element.resolutionState != STATE_STARTED) {
+ throw compiler.internalError(element,
+ 'cyclic resolution of class $element');
+ }
InterfaceType type = element.computeType(compiler);
scope = new TypeDeclarationScope(scope, element);
@@ -4261,9 +4267,13 @@ class ClassResolverVisitor extends TypeDefinitionVisitor {
compiler.reportError(node, MessageKind.EXPERIMENTAL_ENUMS);
}
- invariant(node, element != null);
- invariant(element, element.resolutionState == STATE_STARTED,
- message: () => 'cyclic resolution of class $element');
+ if (element == null) {
+ throw compiler.internalError(node, 'element is null');
+ }
+ if (element.resolutionState != STATE_STARTED) {
+ throw compiler.internalError(element,
+ 'cyclic resolution of class $element');
+ }
InterfaceType enumType = element.computeType(compiler);
element.supertype = compiler.objectClass.computeType(compiler);
@@ -4301,9 +4311,13 @@ class ClassResolverVisitor extends TypeDefinitionVisitor {
}
DartType visitNamedMixinApplication(NamedMixinApplication node) {
- invariant(node, element != null);
- invariant(element, element.resolutionState == STATE_STARTED,
- message: () => 'cyclic resolution of class $element');
+ if (element == null) {
+ throw compiler.internalError(node, 'element is null');
+ }
+ if (element.resolutionState != STATE_STARTED) {
+ throw compiler.internalError(element,
+ 'cyclic resolution of class $element');
+ }
if (identical(node.classKeyword.stringValue, 'typedef')) {
// TODO(aprelev@gmail.com): Remove this deprecation diagnostic
« no previous file with comments | « pkg/compiler/lib/src/dart_types.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698