| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 js_backend.native_data; | 5 library js_backend.native_data; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../elements/elements.dart' | 8 import '../elements/elements.dart' |
| 9 show ClassElement, Element, FieldElement, FunctionElement, MemberElement; | 9 show ClassElement, Element, FieldElement, FunctionElement, MemberElement; |
| 10 import '../native/behavior.dart' show NativeBehavior; | 10 import '../native/behavior.dart' show NativeBehavior; |
| 11 | 11 |
| 12 /// Additional element information for native classes and methods and js-interop | 12 /// Additional element information for native classes and methods and js-interop |
| 13 /// methods. | 13 /// methods. |
| 14 class NativeData { | 14 class NativeData { |
| 15 /// The JavaScript names for elements implemented via typed JavaScript | 15 /// The JavaScript names for elements implemented via typed JavaScript |
| 16 /// interop. | 16 /// interop. |
| 17 Map<Element, String> jsInteropNames = <Element, String>{}; | 17 Map<Element, String> jsInteropNames = <Element, String>{}; |
| 18 | 18 |
| 19 /// The JavaScript names for native JavaScript elements implemented. | 19 /// The JavaScript names for native JavaScript elements implemented. |
| 20 Map<Element, String> nativeMemberName = <Element, String>{}; | 20 Map<Element, String> nativeMemberName = <Element, String>{}; |
| 21 | 21 |
| 22 /// Tag info for native JavaScript classes names. See | 22 /// Tag info for native JavaScript classes names. See |
| 23 /// [setNativeClassTagInfo]. | 23 /// [setNativeClassTagInfo]. |
| 24 Map<ClassElement, String> nativeClassTagInfo = <ClassElement, String>{}; | 24 Map<ClassElement, String> nativeClassTagInfo = <ClassElement, String>{}; |
| 25 | 25 |
| 26 // TODO(johnniwinther): Serialize these. | |
| 27 /// Cache for [NativeBehavior]s for calling native methods. | 26 /// Cache for [NativeBehavior]s for calling native methods. |
| 28 Map<FunctionElement, NativeBehavior> nativeMethodBehavior = | 27 Map<FunctionElement, NativeBehavior> nativeMethodBehavior = |
| 29 <FunctionElement, NativeBehavior>{}; | 28 <FunctionElement, NativeBehavior>{}; |
| 30 | 29 |
| 31 /// Cache for [NativeBehavior]s for reading from native fields. | 30 /// Cache for [NativeBehavior]s for reading from native fields. |
| 32 Map<MemberElement, NativeBehavior> nativeFieldLoadBehavior = | 31 Map<MemberElement, NativeBehavior> nativeFieldLoadBehavior = |
| 33 <FieldElement, NativeBehavior>{}; | 32 <FieldElement, NativeBehavior>{}; |
| 34 | 33 |
| 35 /// Cache for [NativeBehavior]s for writing to native fields. | 34 /// Cache for [NativeBehavior]s for writing to native fields. |
| 36 Map<MemberElement, NativeBehavior> nativeFieldStoreBehavior = | 35 Map<MemberElement, NativeBehavior> nativeFieldStoreBehavior = |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 void setNativeFieldLoadBehavior(FieldElement field, NativeBehavior behavior) { | 210 void setNativeFieldLoadBehavior(FieldElement field, NativeBehavior behavior) { |
| 212 nativeFieldLoadBehavior[field] = behavior; | 211 nativeFieldLoadBehavior[field] = behavior; |
| 213 } | 212 } |
| 214 | 213 |
| 215 /// Registers the [behavior] for writing to the native [field]. | 214 /// Registers the [behavior] for writing to the native [field]. |
| 216 void setNativeFieldStoreBehavior( | 215 void setNativeFieldStoreBehavior( |
| 217 FieldElement field, NativeBehavior behavior) { | 216 FieldElement field, NativeBehavior behavior) { |
| 218 nativeFieldStoreBehavior[field] = behavior; | 217 nativeFieldStoreBehavior[field] = behavior; |
| 219 } | 218 } |
| 220 } | 219 } |
| OLD | NEW |