Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'package:js_runtime/shared/embedded_names.dart'; | 5 import 'package:js_runtime/shared/embedded_names.dart'; |
| 6 import 'package:kernel/ast.dart' as ir; | 6 import 'package:kernel/ast.dart' as ir; |
| 7 | 7 |
| 8 import '../common.dart'; | 8 import '../common.dart'; |
| 9 import '../common/names.dart'; | 9 import '../common/names.dart'; |
| 10 import '../constants/constructors.dart'; | 10 import '../constants/constructors.dart'; |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 395 isJsInterop: isJsInterop); | 395 isJsInterop: isJsInterop); |
| 396 } | 396 } |
| 397 | 397 |
| 398 /// Computes the native behavior for writing to the native [field]. | 398 /// Computes the native behavior for writing to the native [field]. |
| 399 // TODO(johnniwinther): Cache this for later use. | 399 // TODO(johnniwinther): Cache this for later use. |
| 400 native.NativeBehavior getNativeBehaviorForFieldStore(ir.Field field) { | 400 native.NativeBehavior getNativeBehaviorForFieldStore(ir.Field field) { |
| 401 DartType type = getDartType(field.type); | 401 DartType type = getDartType(field.type); |
| 402 return nativeBehaviorBuilder.buildFieldStoreBehavior(type); | 402 return nativeBehaviorBuilder.buildFieldStoreBehavior(type); |
| 403 } | 403 } |
| 404 | 404 |
| 405 /// Computes the native behavior for calling [procedure]. | 405 /// Computes the native behavior for calling [procedure]. |
|
Siggi Cherem (dart-lang)
2017/08/09 16:11:15
procedure => member
Johnni Winther
2017/08/10 08:02:08
Done.
| |
| 406 // TODO(johnniwinther): Cache this for later use. | 406 // TODO(johnniwinther): Cache this for later use. |
| 407 native.NativeBehavior getNativeBehaviorForMethod(ir.Procedure procedure, | 407 native.NativeBehavior getNativeBehaviorForMethod(ir.Member member, |
| 408 {bool isJsInterop}) { | 408 {bool isJsInterop}) { |
| 409 DartType type = getFunctionType(procedure.function); | 409 DartType type; |
| 410 List<ConstantValue> metadata = getMetadata(procedure.annotations); | 410 if (member is ir.Procedure) { |
| 411 type = getFunctionType(member.function); | |
| 412 } else if (member is ir.Constructor) { | |
| 413 type = getFunctionType(member.function); | |
| 414 } else { | |
| 415 failedAt(CURRENT_ELEMENT_SPANNABLE, "Unexpected method node $member."); | |
| 416 } | |
| 417 List<ConstantValue> metadata = getMetadata(member.annotations); | |
| 411 return nativeBehaviorBuilder.buildMethodBehavior( | 418 return nativeBehaviorBuilder.buildMethodBehavior( |
| 412 type, metadata, typeLookup(resolveAsRaw: false), | 419 type, metadata, typeLookup(resolveAsRaw: false), |
| 413 isJsInterop: isJsInterop); | 420 isJsInterop: isJsInterop); |
| 414 } | 421 } |
| 415 } | 422 } |
| 416 | 423 |
| 417 abstract class KernelToElementMapForBuildingMixin | 424 abstract class KernelToElementMapForBuildingMixin |
| 418 implements KernelToElementMapForBuilding, KernelToElementMapBaseMixin { | 425 implements KernelToElementMapForBuilding, KernelToElementMapBaseMixin { |
| 419 js.Template getJsBuiltinTemplate( | 426 js.Template getJsBuiltinTemplate( |
| 420 ConstantValue constant, CodeEmitterTask emitter) { | 427 ConstantValue constant, CodeEmitterTask emitter) { |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 843 } | 850 } |
| 844 if (isRedirecting) { | 851 if (isRedirecting) { |
| 845 return new RedirectingGenerativeConstantConstructor( | 852 return new RedirectingGenerativeConstantConstructor( |
| 846 defaultValues, superConstructorInvocation); | 853 defaultValues, superConstructorInvocation); |
| 847 } else { | 854 } else { |
| 848 return new GenerativeConstantConstructor( | 855 return new GenerativeConstantConstructor( |
| 849 type, defaultValues, fieldMap, superConstructorInvocation); | 856 type, defaultValues, fieldMap, superConstructorInvocation); |
| 850 } | 857 } |
| 851 } | 858 } |
| 852 } | 859 } |
| OLD | NEW |