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

Side by Side Diff: pkg/compiler/lib/src/resolution/resolution.dart

Issue 1768143003: Use specific messages for const constructor with body. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 dart2js.resolution; 5 library dart2js.resolution;
6 6
7 import 'dart:collection' show Queue; 7 import 'dart:collection' show Queue;
8 8
9 import '../common.dart'; 9 import '../common.dart';
10 import '../common/names.dart' show 10 import '../common/names.dart' show
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 while (classElement != null) { 217 while (classElement != null) {
218 if (compiler.backend.isNative(classElement)) return true; 218 if (compiler.backend.isNative(classElement)) return true;
219 classElement = classElement.superclass; 219 classElement = classElement.superclass;
220 } 220 }
221 return false; 221 return false;
222 } 222 }
223 223
224 WorldImpact resolveMethodElementImplementation( 224 WorldImpact resolveMethodElementImplementation(
225 FunctionElement element, FunctionExpression tree) { 225 FunctionElement element, FunctionExpression tree) {
226 return reporter.withCurrentElement(element, () { 226 return reporter.withCurrentElement(element, () {
227 if (element.isExternal && tree.hasBody()) { 227 if (element.isExternal && tree.hasBody) {
228 reporter.reportErrorMessage( 228 reporter.reportErrorMessage(
229 element, 229 element,
230 MessageKind.EXTERNAL_WITH_BODY, 230 MessageKind.EXTERNAL_WITH_BODY,
231 {'functionName': element.name}); 231 {'functionName': element.name});
232 } 232 }
233 if (element.isConstructor) { 233 if (element.isConstructor) {
234 if (tree.returnType != null) { 234 if (tree.returnType != null) {
235 reporter.reportErrorMessage( 235 reporter.reportErrorMessage(
236 tree, MessageKind.CONSTRUCTOR_WITH_RETURN_TYPE); 236 tree, MessageKind.CONSTRUCTOR_WITH_RETURN_TYPE);
237 } 237 }
238 if (element.isConst && 238 if (tree.hasBody && element.isConst) {
239 tree.hasBody() && 239 if (element.isGenerativeConstructor) {
240 !tree.isRedirectingFactory) { 240 reporter.reportErrorMessage(
241 reporter.reportErrorMessage( 241 tree, MessageKind.CONST_CONSTRUCTOR_WITH_BODY);
242 tree, MessageKind.CONST_CONSTRUCTOR_OR_FACTORY_WITH_BODY); 242 } else if (!tree.isRedirectingFactory) {
243 reporter.reportErrorMessage(
244 tree, MessageKind.CONST_FACTORY);
245 }
243 } 246 }
244 } 247 }
245 248
246 ResolverVisitor visitor = visitorFor(element); 249 ResolverVisitor visitor = visitorFor(element);
247 ResolutionRegistry registry = visitor.registry; 250 ResolutionRegistry registry = visitor.registry;
248 registry.defineFunction(tree, element); 251 registry.defineFunction(tree, element);
249 visitor.setupFunction(tree, element); 252 visitor.setupFunction(tree, element);
250 processAsyncMarker(compiler, element, registry); 253 processAsyncMarker(compiler, element, registry);
251 254
252 if (element.isGenerativeConstructor) { 255 if (element.isGenerativeConstructor) {
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 TreeElements get treeElements { 1130 TreeElements get treeElements {
1128 assert(invariant(this, _treeElements !=null, 1131 assert(invariant(this, _treeElements !=null,
1129 message: "TreeElements have not been computed for $this.")); 1132 message: "TreeElements have not been computed for $this."));
1130 return _treeElements; 1133 return _treeElements;
1131 } 1134 }
1132 1135
1133 void reuseElement() { 1136 void reuseElement() {
1134 _treeElements = null; 1137 _treeElements = null;
1135 } 1138 }
1136 } 1139 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/resolution/constructors.dart ('k') | pkg/compiler/lib/src/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698