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

Unified Diff: pkg/compiler/lib/src/native/ssa.dart

Issue 2813603002: Less direct Compiler use in SSA (Closed)
Patch Set: Created 3 years, 8 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
Index: pkg/compiler/lib/src/native/ssa.dart
diff --git a/pkg/compiler/lib/src/native/ssa.dart b/pkg/compiler/lib/src/native/ssa.dart
index 970a7e64a5a97a7a4b07fbb4db1c66aec286544c..70b022171a6aa8975c98dc25ed047e1ad8262338 100644
--- a/pkg/compiler/lib/src/native/ssa.dart
+++ b/pkg/compiler/lib/src/native/ssa.dart
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
import '../common.dart';
-import '../compiler.dart' show Compiler;
import '../constants/values.dart';
import '../elements/resolution_types.dart';
import '../elements/elements.dart';
@@ -18,11 +17,9 @@ import '../universe/side_effects.dart' show SideEffects;
final RegExp nativeRedirectionRegExp = new RegExp(r'^[a-zA-Z][a-zA-Z_$0-9]*$');
void handleSsaNative(SsaBuilder builder, Expression nativeBody) {
- Compiler compiler = builder.compiler;
MethodElement element = builder.target;
NativeEmitter nativeEmitter = builder.nativeEmitter;
JavaScriptBackend backend = builder.backend;
- DiagnosticReporter reporter = compiler.reporter;
HInstruction convertDartClosure(
ParameterElement parameter, ResolutionFunctionType type) {
@@ -53,7 +50,7 @@ void handleSsaNative(SsaBuilder builder, Expression nativeBody) {
LiteralString jsCode = nativeBody.asLiteralString();
String str = jsCode.dartString.slowToString();
if (nativeRedirectionRegExp.hasMatch(str)) {
- reporter.internalError(
+ throw new SpannableAssertionFailure(
nativeBody, "Deprecated syntax, use @JSName('name') instead.");
}
hasBody = true;
@@ -93,8 +90,8 @@ void handleSsaNative(SsaBuilder builder, Expression nativeBody) {
} else if (element.kind == ElementKind.SETTER) {
nativeMethodCall = '$receiver$nativeMethodName = $foreignParameters';
} else {
- builder.reporter
- .internalError(element, 'Unexpected kind: "${element.kind}".');
+ throw new SpannableAssertionFailure(
+ element, 'Unexpected kind: "${element.kind}".');
}
builder.push(new HForeignCode(
@@ -111,7 +108,7 @@ void handleSsaNative(SsaBuilder builder, Expression nativeBody) {
.addSuccessor(builder.graph.exit);
} else {
if (parameters.parameterCount != 0) {
- reporter.internalError(
+ throw new SpannableAssertionFailure(
nativeBody,
'native "..." syntax is restricted to '
'functions with zero parameters.');

Powered by Google App Engine
This is Rietveld 408576698