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

Unified Diff: pkg/compiler/lib/src/kernel/element_map_impl.dart

Issue 2896393003: Remove factory body in *.fromEnvironment, and implement this same behavior (Closed)
Patch Set: address comments and fix unit test 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
Index: pkg/compiler/lib/src/kernel/element_map_impl.dart
diff --git a/pkg/compiler/lib/src/kernel/element_map_impl.dart b/pkg/compiler/lib/src/kernel/element_map_impl.dart
index f39c7050c08581a174fb38f1d506e9e989806e05..33edd262e399b3070ec8cf7f8d8cb30b4943fbc7 100644
--- a/pkg/compiler/lib/src/kernel/element_map_impl.dart
+++ b/pkg/compiler/lib/src/kernel/element_map_impl.dart
@@ -270,9 +270,14 @@ class KernelToElementMapImpl extends KernelToElementMapMixin {
isExternal: isExternal, isConst: node.isConst);
} else if (node is ir.Procedure) {
functionNode = node.function;
+ bool isFromEnvironment = isExternal &&
+ name.text == 'fromEnvironment' &&
+ const ['int', 'bool', 'String'].contains(enclosingClass.name);
constructor = new KFactoryConstructor(memberIndex, enclosingClass, name,
_getParameterStructure(functionNode),
- isExternal: isExternal, isConst: node.isConst);
+ isExternal: isExternal,
+ isConst: node.isConst,
+ isFromEnvironmentConstructor: isFromEnvironment);
} else {
// TODO(johnniwinther): Convert `node.location` to a [SourceSpan].
throw new SpannableAssertionFailure(

Powered by Google App Engine
This is Rietveld 408576698