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

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

Issue 2896393003: Remove factory body in *.fromEnvironment, and implement this same behavior (Closed)
Patch Set: turn warning into a hint 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 unified diff | Download patch
« no previous file with comments | « pkg/compiler/lib/src/kernel/kernel_visitor.dart ('k') | pkg/compiler/lib/src/ssa/builder.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.members; 5 library dart2js.resolution.members;
6 6
7 import 'package:front_end/src/fasta/scanner.dart' show isUserDefinableOperator; 7 import 'package:front_end/src/fasta/scanner.dart' show isUserDefinableOperator;
8 8
9 import '../common.dart'; 9 import '../common.dart';
10 import '../common/names.dart' show Selectors; 10 import '../common/names.dart' show Selectors;
(...skipping 3833 matching lines...) Expand 10 before | Expand all | Expand 10 after
3844 ConstructorResult result = resolveConstructor(node); 3844 ConstructorResult result = resolveConstructor(node);
3845 ConstructorElement constructor = result.element; 3845 ConstructorElement constructor = result.element;
3846 if (resolution.commonElements.isSymbolConstructor(constructor)) { 3846 if (resolution.commonElements.isSymbolConstructor(constructor)) {
3847 registry.registerFeature(Feature.SYMBOL_CONSTRUCTOR); 3847 registry.registerFeature(Feature.SYMBOL_CONSTRUCTOR);
3848 } 3848 }
3849 ArgumentsResult argumentsResult; 3849 ArgumentsResult argumentsResult;
3850 if (node.isConst) { 3850 if (node.isConst) {
3851 argumentsResult = 3851 argumentsResult =
3852 inConstantContext(() => resolveArguments(node.send.argumentsNode)); 3852 inConstantContext(() => resolveArguments(node.send.argumentsNode));
3853 } else { 3853 } else {
3854 if (!node.isConst && constructor.isFromEnvironmentConstructor) {
3855 // TODO(sigmund): consider turning this into a compile-time-error.
3856 reporter.reportHintMessage(
3857 node,
3858 MessageKind.FROM_ENVIRONMENT_MUST_BE_CONST,
3859 {'className': constructor.enclosingClass.name});
3860 registry.registerFeature(Feature.THROW_UNSUPPORTED_ERROR);
3861 }
3854 argumentsResult = resolveArguments(node.send.argumentsNode); 3862 argumentsResult = resolveArguments(node.send.argumentsNode);
3855 } 3863 }
3856 // TODO(johnniwinther): Avoid the need for a [Selector]. 3864 // TODO(johnniwinther): Avoid the need for a [Selector].
3857 Selector selector = resolveSelector(node.send, constructor); 3865 Selector selector = resolveSelector(node.send, constructor);
3858 CallStructure callStructure = selector.callStructure; 3866 CallStructure callStructure = selector.callStructure;
3859 registry.useElement(node.send, constructor); 3867 registry.useElement(node.send, constructor);
3860 3868
3861 ResolutionDartType type = result.type; 3869 ResolutionDartType type = result.type;
3862 ConstructorAccessKind kind; 3870 ConstructorAccessKind kind;
3863 bool isInvalid = false; 3871 bool isInvalid = false;
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after
4803 } 4811 }
4804 return const NoneResult(); 4812 return const NoneResult();
4805 } 4813 }
4806 } 4814 }
4807 4815
4808 /// Looks up [name] in [scope] and unwraps the result. 4816 /// Looks up [name] in [scope] and unwraps the result.
4809 Element lookupInScope( 4817 Element lookupInScope(
4810 DiagnosticReporter reporter, Node node, Scope scope, String name) { 4818 DiagnosticReporter reporter, Node node, Scope scope, String name) {
4811 return Elements.unwrap(scope.lookup(name), reporter, node); 4819 return Elements.unwrap(scope.lookup(name), reporter, node);
4812 } 4820 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/kernel/kernel_visitor.dart ('k') | pkg/compiler/lib/src/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698