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

Unified Diff: pkg/compiler/lib/src/js_backend/backend.dart

Issue 2898403002: Use failedAt in more places (Closed)
Patch Set: merge; address comments Created 3 years, 7 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/io/source_information.dart ('k') | pkg/compiler/lib/src/js_backend/backend_usage.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_backend/backend.dart
diff --git a/pkg/compiler/lib/src/js_backend/backend.dart b/pkg/compiler/lib/src/js_backend/backend.dart
index 3106ddbed9e6c901cae54c06492df0ec5356497d..7bea8280e7ee2ed39c1164974712eb1bf2839e60 100644
--- a/pkg/compiler/lib/src/js_backend/backend.dart
+++ b/pkg/compiler/lib/src/js_backend/backend.dart
@@ -353,8 +353,8 @@ class JavaScriptBackend {
Namer _namer;
Namer get namer {
- assert(invariant(NO_LOCATION_SPANNABLE, _namer != null,
- message: "Namer has not been created yet."));
+ assert(_namer != null,
+ failedAt(NO_LOCATION_SPANNABLE, "Namer has not been created yet."));
return _namer;
}
@@ -536,24 +536,28 @@ class JavaScriptBackend {
/// Resolution support for generating table of interceptors and
/// constructors for custom elements.
CustomElementsResolutionAnalysis get customElementsResolutionAnalysis {
- assert(invariant(
- NO_LOCATION_SPANNABLE, _customElementsResolutionAnalysis != null,
- message: "CustomElementsResolutionAnalysis has not been created yet."));
+ assert(
+ _customElementsResolutionAnalysis != null,
+ failedAt(NO_LOCATION_SPANNABLE,
+ "CustomElementsResolutionAnalysis has not been created yet."));
return _customElementsResolutionAnalysis;
}
/// Codegen support for generating table of interceptors and
/// constructors for custom elements.
CustomElementsCodegenAnalysis get customElementsCodegenAnalysis {
- assert(invariant(
- NO_LOCATION_SPANNABLE, _customElementsCodegenAnalysis != null,
- message: "CustomElementsCodegenAnalysis has not been created yet."));
+ assert(
+ _customElementsCodegenAnalysis != null,
+ failedAt(NO_LOCATION_SPANNABLE,
+ "CustomElementsCodegenAnalysis has not been created yet."));
return _customElementsCodegenAnalysis;
}
NativeBasicData get nativeBasicData {
- assert(invariant(NO_LOCATION_SPANNABLE, _nativeBasicData != null,
- message: "NativeBasicData has not been computed yet."));
+ assert(
+ _nativeBasicData != null,
+ failedAt(NO_LOCATION_SPANNABLE,
+ "NativeBasicData has not been computed yet."));
return _nativeBasicData;
}
@@ -561,17 +565,19 @@ class JavaScriptBackend {
/// Resolution analysis for tracking reflective access to type variables.
TypeVariableResolutionAnalysis get typeVariableResolutionAnalysis {
- assert(invariant(
- NO_LOCATION_SPANNABLE, _typeVariableCodegenAnalysis == null,
- message: "TypeVariableHandler has already been created."));
+ assert(
+ _typeVariableCodegenAnalysis == null,
+ failedAt(NO_LOCATION_SPANNABLE,
+ "TypeVariableHandler has already been created."));
return _typeVariableResolutionAnalysis;
}
/// Codegen handler for reflective access to type variables.
TypeVariableCodegenAnalysis get typeVariableCodegenAnalysis {
- assert(invariant(
- NO_LOCATION_SPANNABLE, _typeVariableCodegenAnalysis != null,
- message: "TypeVariableHandler has not been created yet."));
+ assert(
+ _typeVariableCodegenAnalysis != null,
+ failedAt(NO_LOCATION_SPANNABLE,
+ "TypeVariableHandler has not been created yet."));
return _typeVariableCodegenAnalysis;
}
@@ -585,47 +591,61 @@ class JavaScriptBackend {
/// Codegen support for computing reflectable elements.
MirrorsCodegenAnalysis get mirrorsCodegenAnalysis {
- assert(invariant(NO_LOCATION_SPANNABLE, _mirrorsCodegenAnalysis != null,
- message: "MirrorsCodegenAnalysis has not been created yet."));
+ assert(
+ _mirrorsCodegenAnalysis != null,
+ failedAt(NO_LOCATION_SPANNABLE,
+ "MirrorsCodegenAnalysis has not been created yet."));
return _mirrorsCodegenAnalysis;
}
/// Codegen support for tree-shaking entries of `LookupMap`.
LookupMapAnalysis get lookupMapAnalysis {
- assert(invariant(NO_LOCATION_SPANNABLE, _lookupMapAnalysis != null,
- message: "LookupMapAnalysis has not been created yet."));
+ assert(
+ _lookupMapAnalysis != null,
+ failedAt(NO_LOCATION_SPANNABLE,
+ "LookupMapAnalysis has not been created yet."));
return _lookupMapAnalysis;
}
OneShotInterceptorData get oneShotInterceptorData {
- assert(invariant(NO_LOCATION_SPANNABLE, _oneShotInterceptorData != null,
- message: "OneShotInterceptorData has not been prepared yet."));
+ assert(
+ _oneShotInterceptorData != null,
+ failedAt(NO_LOCATION_SPANNABLE,
+ "OneShotInterceptorData has not been prepared yet."));
return _oneShotInterceptorData;
}
RuntimeTypesNeed get rtiNeed {
- assert(invariant(NO_LOCATION_SPANNABLE, _rtiNeed != null,
- message: "RuntimeTypesNeed has not been computed yet."));
+ assert(
+ _rtiNeed != null,
+ failedAt(NO_LOCATION_SPANNABLE,
+ "RuntimeTypesNeed has not been computed yet."));
return _rtiNeed;
}
RuntimeTypesNeedBuilder get rtiNeedBuilder {
- assert(invariant(NO_LOCATION_SPANNABLE, _rtiNeed == null,
- message: "RuntimeTypesNeed has already been computed."));
+ assert(
+ _rtiNeed == null,
+ failedAt(NO_LOCATION_SPANNABLE,
+ "RuntimeTypesNeed has already been computed."));
return _rtiNeedBuilder;
}
RuntimeTypesChecksBuilder get rtiChecksBuilder {
- assert(invariant(NO_LOCATION_SPANNABLE, !_rti.rtiChecksBuilderClosed,
- message: "RuntimeTypesChecks has already been computed."));
+ assert(
+ !_rti.rtiChecksBuilderClosed,
+ failedAt(NO_LOCATION_SPANNABLE,
+ "RuntimeTypesChecks has already been computed."));
return _rti;
}
RuntimeTypesSubstitutions get rtiSubstitutions => _rti;
RuntimeTypesEncoder get rtiEncoder {
- assert(invariant(NO_LOCATION_SPANNABLE, _rtiEncoder != null,
- message: "RuntimeTypesEncoder has not been created."));
+ assert(
+ _rtiEncoder != null,
+ failedAt(NO_LOCATION_SPANNABLE,
+ "RuntimeTypesEncoder has not been created."));
return _rtiEncoder;
}
@@ -720,9 +740,10 @@ class JavaScriptBackend {
.lookupClassMember(interceptorClass, member.name);
// Interceptors must override all Object methods due to calling convention
// differences.
- assert(invariant(interceptorMember,
+ assert(
interceptorMember.enclosingClass == interceptorClass,
- message:
+ failedAt(
+ interceptorMember,
"Member ${member.name} not overridden in ${interceptorClass}. "
"Found $interceptorMember from "
"${interceptorMember.enclosingClass}."));
@@ -964,7 +985,7 @@ class JavaScriptBackend {
* Invariant: [element] must be a declaration element.
*/
String getGeneratedCode(Element element) {
- assert(invariant(element, element.isDeclaration));
+ assert(element.isDeclaration, failedAt(element));
return jsAst.prettyPrint(generatedCode[element], compiler.options);
}
« no previous file with comments | « pkg/compiler/lib/src/io/source_information.dart ('k') | pkg/compiler/lib/src/js_backend/backend_usage.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698