| 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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 if (member.isFunction) { | 390 if (member.isFunction) { |
| 391 FunctionElement fn = member; | 391 FunctionElement fn = member; |
| 392 functionType = fn.type; | 392 functionType = fn.type; |
| 393 } else if (member.isGetter) { | 393 } else if (member.isGetter) { |
| 394 if (_compiler.options.trustTypeAnnotations) { | 394 if (_compiler.options.trustTypeAnnotations) { |
| 395 GetterElement getter = member; | 395 GetterElement getter = member; |
| 396 ResolutionDartType returnType = getter.type.returnType; | 396 ResolutionDartType returnType = getter.type.returnType; |
| 397 if (returnType.isFunctionType) { | 397 if (returnType.isFunctionType) { |
| 398 functionType = returnType; | 398 functionType = returnType; |
| 399 } else if (returnType.treatAsDynamic || | 399 } else if (returnType.treatAsDynamic || |
| 400 _compiler.types.isSubtype(returnType, | 400 _compiler.types.isSubtype( |
| 401 returnType, |
| 402 // ignore: UNNECESSARY_CAST |
| 401 backend.commonElements.functionType as DartType)) { | 403 backend.commonElements.functionType as DartType)) { |
| 402 if (returnType.isTypedef) { | 404 if (returnType.isTypedef) { |
| 403 ResolutionTypedefType typedef = returnType; | 405 ResolutionTypedefType typedef = returnType; |
| 404 // TODO(jacobr): can we just use typdef.unaliased instead? | 406 // TODO(jacobr): can we just use typdef.unaliased instead? |
| 405 functionType = typedef.element.functionSignature.type; | 407 functionType = typedef.element.functionSignature.type; |
| 406 } else { | 408 } else { |
| 407 // Other misc function type such as commonElements.Function. | 409 // Other misc function type such as commonElements.Function. |
| 408 // Allow any number of arguments. | 410 // Allow any number of arguments. |
| 409 isFunctionLike = true; | 411 isFunctionLike = true; |
| 410 } | 412 } |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 970 Constant constant = new Constant(name, holder, constantValue); | 972 Constant constant = new Constant(name, holder, constantValue); |
| 971 _constants[constantValue] = constant; | 973 _constants[constantValue] = constant; |
| 972 } | 974 } |
| 973 } | 975 } |
| 974 | 976 |
| 975 Holder _registerStaticStateHolder() { | 977 Holder _registerStaticStateHolder() { |
| 976 return _registry.registerHolder(namer.staticStateHolder, | 978 return _registry.registerHolder(namer.staticStateHolder, |
| 977 isStaticStateHolder: true); | 979 isStaticStateHolder: true); |
| 978 } | 980 } |
| 979 } | 981 } |
| OLD | NEW |