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

Unified Diff: pkg/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart

Issue 2930093002: Complain about external methods with a body. (Closed)
Patch Set: Created 3 years, 6 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/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart
index 210e5a11886da11fda5cb602790742f26eeabbcf..0893ca26e3d1c8867e1a52ba21880bb69577b9db 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart
@@ -80,8 +80,14 @@ abstract class KernelFunctionBuilder
compilationUnit, charOffset);
void set body(Statement newBody) {
- if (isAbstract && newBody != null) {
- return internalError("Attempting to set body on abstract method.");
+ if (newBody != null) {
+ if (isAbstract) {
+ return internalError("Attempting to set body on abstract method.");
+ }
+ if (isExternal) {
+ return library.addCompileTimeError(
+ newBody.fileOffset, "An external method can't have a body.");
+ }
}
actualBody = newBody;
if (function != null) {

Powered by Google App Engine
This is Rietveld 408576698