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

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

Issue 2653203002: Use entities in CommonElements interface. (Closed)
Patch Set: 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) 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_emitter.program_builder; 5 library dart2js.js_emitter.program_builder;
6 6
7 import '../../closure.dart' show ClosureFieldElement; 7 import '../../closure.dart' show ClosureFieldElement;
8 import '../../common.dart'; 8 import '../../common.dart';
9 import '../../common/names.dart' show Names, Selectors; 9 import '../../common/names.dart' show Names, Selectors;
10 import '../../compiler.dart' show Compiler; 10 import '../../compiler.dart' show Compiler;
(...skipping 11 matching lines...) Expand all
22 FieldElement, 22 FieldElement,
23 FunctionElement, 23 FunctionElement,
24 FunctionSignature, 24 FunctionSignature,
25 GetterElement, 25 GetterElement,
26 LibraryElement, 26 LibraryElement,
27 MemberElement, 27 MemberElement,
28 MethodElement, 28 MethodElement,
29 ParameterElement, 29 ParameterElement,
30 TypedefElement, 30 TypedefElement,
31 VariableElement; 31 VariableElement;
32 import '../../elements/types.dart' show DartType;
32 import '../../js/js.dart' as js; 33 import '../../js/js.dart' as js;
33 import '../../js_backend/backend_helpers.dart' show BackendHelpers; 34 import '../../js_backend/backend_helpers.dart' show BackendHelpers;
34 import '../../js_backend/js_backend.dart' 35 import '../../js_backend/js_backend.dart'
35 show Namer, JavaScriptBackend, JavaScriptConstantCompiler, StringBackedName; 36 show Namer, JavaScriptBackend, JavaScriptConstantCompiler, StringBackedName;
36 import '../../universe/selector.dart' show Selector; 37 import '../../universe/selector.dart' show Selector;
37 import '../../universe/world_builder.dart' 38 import '../../universe/world_builder.dart'
38 show CodegenWorldBuilder, SelectorConstraints; 39 show CodegenWorldBuilder, SelectorConstraints;
39 import '../../world.dart' show ClosedWorld; 40 import '../../world.dart' show ClosedWorld;
40 import '../js_emitter.dart' 41 import '../js_emitter.dart'
41 show 42 show
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 if (member.isFunction) { 390 if (member.isFunction) {
390 FunctionElement fn = member; 391 FunctionElement fn = member;
391 functionType = fn.type; 392 functionType = fn.type;
392 } else if (member.isGetter) { 393 } else if (member.isGetter) {
393 if (_compiler.options.trustTypeAnnotations) { 394 if (_compiler.options.trustTypeAnnotations) {
394 GetterElement getter = member; 395 GetterElement getter = member;
395 ResolutionDartType returnType = getter.type.returnType; 396 ResolutionDartType returnType = getter.type.returnType;
396 if (returnType.isFunctionType) { 397 if (returnType.isFunctionType) {
397 functionType = returnType; 398 functionType = returnType;
398 } else if (returnType.treatAsDynamic || 399 } else if (returnType.treatAsDynamic ||
399 _compiler.types.isSubtype( 400 _compiler.types.isSubtype(returnType,
400 returnType, backend.commonElements.functionType)) { 401 backend.commonElements.functionType as DartType)) {
401 if (returnType.isTypedef) { 402 if (returnType.isTypedef) {
402 ResolutionTypedefType typedef = returnType; 403 ResolutionTypedefType typedef = returnType;
403 // TODO(jacobr): can we just use typdef.unaliased instead? 404 // TODO(jacobr): can we just use typdef.unaliased instead?
404 functionType = typedef.element.functionSignature.type; 405 functionType = typedef.element.functionSignature.type;
405 } else { 406 } else {
406 // Other misc function type such as commonElements.Function. 407 // Other misc function type such as commonElements.Function.
407 // Allow any number of arguments. 408 // Allow any number of arguments.
408 isFunctionLike = true; 409 isFunctionLike = true;
409 } 410 }
410 } 411 }
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 Constant constant = new Constant(name, holder, constantValue); 992 Constant constant = new Constant(name, holder, constantValue);
992 _constants[constantValue] = constant; 993 _constants[constantValue] = constant;
993 } 994 }
994 } 995 }
995 996
996 Holder _registerStaticStateHolder() { 997 Holder _registerStaticStateHolder() {
997 return _registry.registerHolder(namer.staticStateHolder, 998 return _registry.registerHolder(namer.staticStateHolder,
998 isStaticStateHolder: true); 999 isStaticStateHolder: true);
999 } 1000 }
1000 } 1001 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698