Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 12 matching lines...) Expand all Loading... | |
| 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/entities.dart'; | 32 import '../../elements/entities.dart'; |
| 33 import '../../elements/types.dart' show DartType; | |
| 34 import '../../js/js.dart' as js; | 33 import '../../js/js.dart' as js; |
| 35 import '../../js_backend/backend_helpers.dart' show BackendHelpers; | 34 import '../../js_backend/backend_helpers.dart' show BackendHelpers; |
| 36 import '../../js_backend/js_backend.dart' | 35 import '../../js_backend/js_backend.dart' |
| 37 show Namer, JavaScriptBackend, JavaScriptConstantCompiler, StringBackedName; | 36 show Namer, JavaScriptBackend, JavaScriptConstantCompiler, StringBackedName; |
| 38 import '../../universe/selector.dart' show Selector; | 37 import '../../universe/selector.dart' show Selector; |
| 39 import '../../universe/world_builder.dart' | 38 import '../../universe/world_builder.dart' |
| 40 show CodegenWorldBuilder, SelectorConstraints; | 39 show CodegenWorldBuilder, SelectorConstraints; |
| 41 import '../../world.dart' show ClosedWorld; | 40 import '../../world.dart' show ClosedWorld; |
| 42 import '../js_emitter.dart' | 41 import '../js_emitter.dart' |
| 43 show | 42 show |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 390 if (member.isFunction) { | 389 if (member.isFunction) { |
| 391 FunctionElement fn = member; | 390 FunctionElement fn = member; |
| 392 functionType = fn.type; | 391 functionType = fn.type; |
| 393 } else if (member.isGetter) { | 392 } else if (member.isGetter) { |
| 394 if (_compiler.options.trustTypeAnnotations) { | 393 if (_compiler.options.trustTypeAnnotations) { |
| 395 GetterElement getter = member; | 394 GetterElement getter = member; |
| 396 ResolutionDartType returnType = getter.type.returnType; | 395 ResolutionDartType returnType = getter.type.returnType; |
| 397 if (returnType.isFunctionType) { | 396 if (returnType.isFunctionType) { |
| 398 functionType = returnType; | 397 functionType = returnType; |
| 399 } else if (returnType.treatAsDynamic || | 398 } else if (returnType.treatAsDynamic || |
| 400 _compiler.types.isSubtype(returnType, | 399 _compiler.types.isSubtype( |
| 401 backend.commonElements.functionType as DartType)) { | 400 returnType, |
| 401 // ignore: ARGUMENT_TYPE_NOT_ASSIGNABLE | |
| 402 backend.commonElements.functionType)) { | |
|
Johnni Winther
2017/04/03 12:07:33
Reinsert the cast and ignore the hint.
ahe
2017/04/03 12:25:07
Done.
| |
| 402 if (returnType.isTypedef) { | 403 if (returnType.isTypedef) { |
| 403 ResolutionTypedefType typedef = returnType; | 404 ResolutionTypedefType typedef = returnType; |
| 404 // TODO(jacobr): can we just use typdef.unaliased instead? | 405 // TODO(jacobr): can we just use typdef.unaliased instead? |
| 405 functionType = typedef.element.functionSignature.type; | 406 functionType = typedef.element.functionSignature.type; |
| 406 } else { | 407 } else { |
| 407 // Other misc function type such as commonElements.Function. | 408 // Other misc function type such as commonElements.Function. |
| 408 // Allow any number of arguments. | 409 // Allow any number of arguments. |
| 409 isFunctionLike = true; | 410 isFunctionLike = true; |
| 410 } | 411 } |
| 411 } | 412 } |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 970 Constant constant = new Constant(name, holder, constantValue); | 971 Constant constant = new Constant(name, holder, constantValue); |
| 971 _constants[constantValue] = constant; | 972 _constants[constantValue] = constant; |
| 972 } | 973 } |
| 973 } | 974 } |
| 974 | 975 |
| 975 Holder _registerStaticStateHolder() { | 976 Holder _registerStaticStateHolder() { |
| 976 return _registry.registerHolder(namer.staticStateHolder, | 977 return _registry.registerHolder(namer.staticStateHolder, |
| 977 isStaticStateHolder: true); | 978 isStaticStateHolder: true); |
| 978 } | 979 } |
| 979 } | 980 } |
| OLD | NEW |