| 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 /// Entity model for elements derived from Kernel IR. | 5 /// Entity model for elements derived from Kernel IR. |
| 6 | 6 |
| 7 import '../elements/elements.dart'; | 7 import '../elements/elements.dart'; |
| 8 import '../elements/entities.dart'; | 8 import '../elements/entities.dart'; |
| 9 | 9 |
| 10 class KLibrary implements LibraryEntity { | 10 class KLibrary implements LibraryEntity { |
| 11 /// Library index used for fast lookup in [KernelWorldBuilder]. | 11 /// Library index used for fast lookup in [KernelWorldBuilder]. |
| 12 final int libraryIndex; | 12 final int libraryIndex; |
| 13 final String name; | 13 final String name; |
| 14 final String libraryName; | 14 final String libraryName; |
| 15 | 15 |
| 16 KLibrary(this.libraryIndex, this.name, this.libraryName); | 16 KLibrary(this.libraryIndex, this.name, this.libraryName); |
| 17 | 17 |
| 18 String toString() => 'library($name)'; | 18 String toString() => 'library($name)'; |
| 19 } | 19 } |
| 20 | 20 |
| 21 class KClass implements ClassEntity { | 21 class KClass implements ClassEntity { |
| 22 /// Class index used for fast lookup in [KernelWorldBuilder]. |
| 23 final int classIndex; |
| 22 final String name; | 24 final String name; |
| 23 | 25 |
| 24 KClass(this.name); | 26 KClass(this.classIndex, this.name); |
| 25 | 27 |
| 26 @override | 28 @override |
| 27 bool get isClosure => false; | 29 bool get isClosure => false; |
| 28 | 30 |
| 29 String toString() => 'class($name)'; | 31 String toString() => 'class($name)'; |
| 30 } | 32 } |
| 31 | 33 |
| 32 abstract class KMember implements MemberEntity { | 34 abstract class KMember implements MemberEntity { |
| 33 final KClass enclosingClass; | 35 final KClass enclosingClass; |
| 34 final Name _name; | 36 final Name _name; |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 163 |
| 162 String get _kind => 'field'; | 164 String get _kind => 'field'; |
| 163 } | 165 } |
| 164 | 166 |
| 165 class KTypeVariable implements TypeVariableEntity { | 167 class KTypeVariable implements TypeVariableEntity { |
| 166 final Entity typeDeclaration; | 168 final Entity typeDeclaration; |
| 167 final String name; | 169 final String name; |
| 168 final int index; | 170 final int index; |
| 169 | 171 |
| 170 KTypeVariable(this.typeDeclaration, this.name, this.index); | 172 KTypeVariable(this.typeDeclaration, this.name, this.index); |
| 173 |
| 174 String toString() => 'type_variable(${typeDeclaration.name}.$name)'; |
| 171 } | 175 } |
| 172 | 176 |
| 173 class KLocalFunction implements Local { | 177 class KLocalFunction implements Local { |
| 174 final String name; | 178 final String name; |
| 175 final MemberEntity memberContext; | 179 final MemberEntity memberContext; |
| 176 final Entity executableContext; | 180 final Entity executableContext; |
| 177 | 181 |
| 178 KLocalFunction(this.name, this.memberContext, this.executableContext); | 182 KLocalFunction(this.name, this.memberContext, this.executableContext); |
| 183 |
| 184 String toString() => |
| 185 'local_function(${memberContext.name}.${name ?? '<anonymous>'})'; |
| 179 } | 186 } |
| OLD | NEW |