| 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 { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 String toString() => | 72 String toString() => |
| 73 '$_kind(${enclosingClass != null ? '${enclosingClass.name}.' : ''}$name)'; | 73 '$_kind(${enclosingClass != null ? '${enclosingClass.name}.' : ''}$name)'; |
| 74 } | 74 } |
| 75 | 75 |
| 76 abstract class KFunction extends KMember implements FunctionEntity { | 76 abstract class KFunction extends KMember implements FunctionEntity { |
| 77 KFunction(KClass enclosingClass, Name name, {bool isStatic: false}) | 77 KFunction(KClass enclosingClass, Name name, {bool isStatic: false}) |
| 78 : super(enclosingClass, name, isStatic: isStatic); | 78 : super(enclosingClass, name, isStatic: isStatic); |
| 79 } | 79 } |
| 80 | 80 |
| 81 abstract class KConstructor extends KFunction implements ConstructorEntity { | 81 abstract class KConstructor extends KFunction implements ConstructorEntity { |
| 82 KConstructor(KClass enclosingClass, Name name) : super(enclosingClass, name); | 82 /// Constructor index used for fast lookup in [KernelWorldBuilder]. |
| 83 final int constructorIndex; |
| 84 |
| 85 KConstructor(this.constructorIndex, KClass enclosingClass, Name name) |
| 86 : super(enclosingClass, name); |
| 83 | 87 |
| 84 @override | 88 @override |
| 85 bool get isConstructor => true; | 89 bool get isConstructor => true; |
| 86 | 90 |
| 87 @override | 91 @override |
| 88 bool get isInstanceMember => false; | 92 bool get isInstanceMember => false; |
| 89 | 93 |
| 90 @override | 94 @override |
| 91 bool get isStatic => false; | 95 bool get isStatic => false; |
| 92 | 96 |
| 93 @override | 97 @override |
| 94 bool get isTopLevel => false; | 98 bool get isTopLevel => false; |
| 95 | 99 |
| 96 String get _kind => 'constructor'; | 100 String get _kind => 'constructor'; |
| 97 } | 101 } |
| 98 | 102 |
| 99 class KGenerativeConstructor extends KConstructor { | 103 class KGenerativeConstructor extends KConstructor { |
| 100 KGenerativeConstructor(KClass enclosingClass, Name name) | 104 KGenerativeConstructor(int constructorIndex, KClass enclosingClass, Name name) |
| 101 : super(enclosingClass, name); | 105 : super(constructorIndex, enclosingClass, name); |
| 102 | 106 |
| 103 @override | 107 @override |
| 104 bool get isFactoryConstructor => false; | 108 bool get isFactoryConstructor => false; |
| 105 | 109 |
| 106 @override | 110 @override |
| 107 bool get isGenerativeConstructor => true; | 111 bool get isGenerativeConstructor => true; |
| 108 } | 112 } |
| 109 | 113 |
| 110 class KFactoryConstructor extends KConstructor { | 114 class KFactoryConstructor extends KConstructor { |
| 111 KFactoryConstructor(KClass enclosingClass, Name name) | 115 KFactoryConstructor(int constructorIndex, KClass enclosingClass, Name name) |
| 112 : super(enclosingClass, name); | 116 : super(constructorIndex, enclosingClass, name); |
| 113 | 117 |
| 114 @override | 118 @override |
| 115 bool get isFactoryConstructor => true; | 119 bool get isFactoryConstructor => true; |
| 116 | 120 |
| 117 @override | 121 @override |
| 118 bool get isGenerativeConstructor => false; | 122 bool get isGenerativeConstructor => false; |
| 119 } | 123 } |
| 120 | 124 |
| 121 class KMethod extends KFunction { | 125 class KMethod extends KFunction { |
| 122 KMethod(KClass enclosingClass, Name name, {bool isStatic}) | 126 KMethod(KClass enclosingClass, Name name, {bool isStatic}) |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 class KLocalFunction implements Local { | 180 class KLocalFunction implements Local { |
| 177 final String name; | 181 final String name; |
| 178 final MemberEntity memberContext; | 182 final MemberEntity memberContext; |
| 179 final Entity executableContext; | 183 final Entity executableContext; |
| 180 | 184 |
| 181 KLocalFunction(this.name, this.memberContext, this.executableContext); | 185 KLocalFunction(this.name, this.memberContext, this.executableContext); |
| 182 | 186 |
| 183 String toString() => | 187 String toString() => |
| 184 'local_function(${memberContext.name}.${name ?? '<anonymous>'})'; | 188 'local_function(${memberContext.name}.${name ?? '<anonymous>'})'; |
| 185 } | 189 } |
| OLD | NEW |