| 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 '../common_elements.dart' show ElementEnvironment; | 8 import '../common_elements.dart' show ElementEnvironment; |
| 9 import '../elements/entities.dart'; | 9 import '../elements/entities.dart'; |
| 10 import '../native/behavior.dart' show NativeBehavior; | 10 import '../native/behavior.dart' show NativeBehavior; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 Set<LibraryEntity> jsInteropLibraries = new Set<LibraryEntity>(); | 149 Set<LibraryEntity> jsInteropLibraries = new Set<LibraryEntity>(); |
| 150 | 150 |
| 151 /// The JavaScript classes implemented via typed JavaScript interop. | 151 /// The JavaScript classes implemented via typed JavaScript interop. |
| 152 Set<ClassEntity> jsInteropClasses = new Set<ClassEntity>(); | 152 Set<ClassEntity> jsInteropClasses = new Set<ClassEntity>(); |
| 153 | 153 |
| 154 /// Sets the native tag info for [cls]. | 154 /// Sets the native tag info for [cls]. |
| 155 /// | 155 /// |
| 156 /// The tag info string contains comma-separated 'words' which are either | 156 /// The tag info string contains comma-separated 'words' which are either |
| 157 /// dispatch tags (having JavaScript identifier syntax) and directives that | 157 /// dispatch tags (having JavaScript identifier syntax) and directives that |
| 158 /// begin with `!`. | 158 /// begin with `!`. |
| 159 void setNativeClassTagInfo(ClassEntity cls, String tagInfo) { | 159 void setNativeClassTagInfo(ClassEntity cls, String tagText) { |
| 160 String tagText = tagInfo.substring(1, tagInfo.length - 1); | |
| 161 // TODO(johnniwinther): Assert that this is only called once. The memory | 160 // TODO(johnniwinther): Assert that this is only called once. The memory |
| 162 // compiler copies pre-processed elements into a new compiler through | 161 // compiler copies pre-processed elements into a new compiler through |
| 163 // [Compiler.onLibraryScanned] and thereby causes multiple calls to this | 162 // [Compiler.onLibraryScanned] and thereby causes multiple calls to this |
| 164 // method. | 163 // method. |
| 165 assert(invariant( | 164 assert(invariant( |
| 166 cls, | 165 cls, |
| 167 nativeClassTagInfo[cls] == null || | 166 nativeClassTagInfo[cls] == null || |
| 168 nativeClassTagInfo[cls].text == tagText, | 167 nativeClassTagInfo[cls].text == tagText, |
| 169 message: "Native tag info set inconsistently on $cls: " | 168 message: "Native tag info set inconsistently on $cls: " |
| 170 "Existing tag info '${nativeClassTagInfo[cls]}', " | 169 "Existing tag info '${nativeClassTagInfo[cls]}', " |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 int get hashCode => Hashing.listHash(names, isNonLeaf.hashCode); | 533 int get hashCode => Hashing.listHash(names, isNonLeaf.hashCode); |
| 535 | 534 |
| 536 bool operator ==(other) { | 535 bool operator ==(other) { |
| 537 if (identical(this, other)) return true; | 536 if (identical(this, other)) return true; |
| 538 if (other is! NativeClassTag) return false; | 537 if (other is! NativeClassTag) return false; |
| 539 return equalElements(names, other.names) && isNonLeaf == other.isNonLeaf; | 538 return equalElements(names, other.names) && isNonLeaf == other.isNonLeaf; |
| 540 } | 539 } |
| 541 | 540 |
| 542 String toString() => text; | 541 String toString() => text; |
| 543 } | 542 } |
| OLD | NEW |