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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/native_emitter.dart

Issue 2647613004: Use entities in code_emitter_task (Closed)
Patch Set: Updated cf. comments Created 3 years, 11 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.js_emitter.native_emitter; 5 library dart2js.js_emitter.native_emitter;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../compiler.dart' show Compiler; 8 import '../compiler.dart' show Compiler;
9 import '../elements/resolution_types.dart' 9 import '../elements/resolution_types.dart'
10 show ResolutionDartType, ResolutionFunctionType; 10 show ResolutionDartType, ResolutionFunctionType;
11 import '../elements/elements.dart' 11 import '../elements/elements.dart'
12 show 12 show
13 ClassElement, 13 ClassElement,
14 Element, 14 Element,
15 FunctionElement, 15 FunctionElement,
16 FunctionSignature, 16 FunctionSignature,
17 MethodElement,
17 ParameterElement; 18 ParameterElement;
18 import '../js/js.dart' as jsAst; 19 import '../js/js.dart' as jsAst;
19 import '../js/js.dart' show js; 20 import '../js/js.dart' show js;
20 import '../js_backend/backend_helpers.dart' show BackendHelpers; 21 import '../js_backend/backend_helpers.dart' show BackendHelpers;
21 import '../js_backend/js_backend.dart' show JavaScriptBackend; 22 import '../js_backend/js_backend.dart' show JavaScriptBackend;
22 import 'full_emitter/emitter.dart' as full_js_emitter; 23 import 'full_emitter/emitter.dart' as full_js_emitter;
23 24
24 import 'code_emitter_task.dart' show CodeEmitterTask; 25 import 'code_emitter_task.dart' show CodeEmitterTask;
25 import 'model.dart'; 26 import 'model.dart';
26 27
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 return cls.methods.isEmpty && 269 return cls.methods.isEmpty &&
269 cls.isChecks.isEmpty && 270 cls.isChecks.isEmpty &&
270 cls.callStubs.isEmpty && 271 cls.callStubs.isEmpty &&
271 !cls.superclass.isMixinApplication && 272 !cls.superclass.isMixinApplication &&
272 !cls.fields.any(needsAccessor); 273 !cls.fields.any(needsAccessor);
273 } 274 }
274 275
275 void potentiallyConvertDartClosuresToJs(List<jsAst.Statement> statements, 276 void potentiallyConvertDartClosuresToJs(List<jsAst.Statement> statements,
276 FunctionElement member, List<jsAst.Parameter> stubParameters) { 277 FunctionElement member, List<jsAst.Parameter> stubParameters) {
277 FunctionSignature parameters = member.functionSignature; 278 FunctionSignature parameters = member.functionSignature;
278 Element converter = helpers.closureConverter; 279 MethodElement converter = helpers.closureConverter;
279 jsAst.Expression closureConverter = 280 jsAst.Expression closureConverter =
280 emitterTask.staticFunctionAccess(converter); 281 emitterTask.staticFunctionAccess(converter);
281 parameters.forEachParameter((ParameterElement parameter) { 282 parameters.forEachParameter((ParameterElement parameter) {
282 String name = parameter.name; 283 String name = parameter.name;
283 // If [name] is not in [stubParameters], then the parameter is an optional 284 // If [name] is not in [stubParameters], then the parameter is an optional
284 // parameter that was not provided for this stub. 285 // parameter that was not provided for this stub.
285 for (jsAst.Parameter stubParameter in stubParameters) { 286 for (jsAst.Parameter stubParameter in stubParameters) {
286 if (stubParameter.name == name) { 287 if (stubParameter.name == name) {
287 ResolutionDartType type = parameter.type.unaliased; 288 ResolutionDartType type = parameter.type.unaliased;
288 if (type is ResolutionFunctionType) { 289 if (type is ResolutionFunctionType) {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 // used. We should also use an interceptor if the check can't be satisfied 371 // used. We should also use an interceptor if the check can't be satisfied
371 // by a native class in case we get a native instance that tries to spoof 372 // by a native class in case we get a native instance that tries to spoof
372 // the type info. i.e the criteria for whether or not to use an interceptor 373 // the type info. i.e the criteria for whether or not to use an interceptor
373 // is whether the receiver can be native, not the type of the test. 374 // is whether the receiver can be native, not the type of the test.
374 if (element == null || !element.isClass) return false; 375 if (element == null || !element.isClass) return false;
375 ClassElement cls = element; 376 ClassElement cls = element;
376 if (backend.isNativeOrExtendsNative(cls)) return true; 377 if (backend.isNativeOrExtendsNative(cls)) return true;
377 return isSupertypeOfNativeClass(element); 378 return isSupertypeOfNativeClass(element);
378 } 379 }
379 } 380 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698