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

Side by Side Diff: pkg/compiler/lib/src/js_backend/patch_resolver.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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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.js_backend.patch_resolver; 5 library dart2js.js_backend.patch_resolver;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/resolution.dart' show Resolution; 8 import '../common/resolution.dart' show Resolution;
9 import '../common/tasks.dart' show CompilerTask; 9 import '../common/tasks.dart' show CompilerTask;
10 import '../compiler.dart' show Compiler; 10 import '../compiler.dart' show Compiler;
(...skipping 16 matching lines...) Expand all
27 27
28 FunctionElement resolveExternalFunction(FunctionElementX element) { 28 FunctionElement resolveExternalFunction(FunctionElementX element) {
29 if (element.isPatched) { 29 if (element.isPatched) {
30 FunctionElementX patch = element.patch; 30 FunctionElementX patch = element.patch;
31 reporter.withCurrentElement(patch, () { 31 reporter.withCurrentElement(patch, () {
32 patch.computeType(resolution); 32 patch.computeType(resolution);
33 }); 33 });
34 checkMatchingPatchSignatures(element, patch); 34 checkMatchingPatchSignatures(element, patch);
35 element = patch; 35 element = patch;
36 } else { 36 } else {
37 if (element.isConstructor) {
38 // Note: currently we allow a couple external methods without a patch,
39 // namely the *.fromEnvironment const constructors in int, bool, and
40 // String. In the future we might also represent native DOM methods in
41 // dart:html this way.
42 ConstructorElementX constructor = element;
43 if (constructor.isFromEnvironmentConstructor) return element;
44 }
37 reporter.reportErrorMessage( 45 reporter.reportErrorMessage(
38 element, MessageKind.PATCH_EXTERNAL_WITHOUT_IMPLEMENTATION); 46 element, MessageKind.PATCH_EXTERNAL_WITHOUT_IMPLEMENTATION);
39 } 47 }
40 return element; 48 return element;
41 } 49 }
42 50
43 void checkMatchingPatchParameters(FunctionElement origin, 51 void checkMatchingPatchParameters(FunctionElement origin,
44 List<Element> originParameters, List<Element> patchParameters) { 52 List<Element> originParameters, List<Element> patchParameters) {
45 bool isUnnamedListConstructor = origin is ConstructorElement && 53 bool isUnnamedListConstructor = origin is ConstructorElement &&
46 compiler.commonElements.isUnnamedListConstructor(origin); 54 compiler.commonElements.isUnnamedListConstructor(origin);
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 'originParameterCount': originSignature.optionalParameterCount, 184 'originParameterCount': originSignature.optionalParameterCount,
177 'patchParameterCount': patchSignature.optionalParameterCount 185 'patchParameterCount': patchSignature.optionalParameterCount
178 }); 186 });
179 }); 187 });
180 } else { 188 } else {
181 checkMatchingPatchParameters(origin, originSignature.optionalParameters, 189 checkMatchingPatchParameters(origin, originSignature.optionalParameters,
182 patchSignature.optionalParameters); 190 patchSignature.optionalParameters);
183 } 191 }
184 } 192 }
185 } 193 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/mirrors_analysis.dart ('k') | pkg/compiler/lib/src/kernel/element_map_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698