Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(453)

Side by Side Diff: pkg/compiler/lib/src/kernel/elements.dart

Issue 2809603002: Introduce ParameterStructure (Closed)
Patch Set: Fix. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 @override 82 @override
83 bool get isTopLevel => enclosingClass == null; 83 bool get isTopLevel => enclosingClass == null;
84 84
85 String get _kind; 85 String get _kind;
86 86
87 String toString() => 87 String toString() =>
88 '$_kind(${enclosingClass != null ? '${enclosingClass.name}.' : ''}$name)'; 88 '$_kind(${enclosingClass != null ? '${enclosingClass.name}.' : ''}$name)';
89 } 89 }
90 90
91 abstract class KFunction extends KMember implements FunctionEntity { 91 abstract class KFunction extends KMember implements FunctionEntity {
92 final ParameterStructure parameterStructure;
92 final bool isExternal; 93 final bool isExternal;
93 94
94 KFunction(int memberIndex, KLibrary library, KClass enclosingClass, Name name, 95 KFunction(int memberIndex, KLibrary library, KClass enclosingClass, Name name,
96 this.parameterStructure,
95 {bool isStatic: false, this.isExternal: false}) 97 {bool isStatic: false, this.isExternal: false})
96 : super(memberIndex, library, enclosingClass, name, isStatic: isStatic); 98 : super(memberIndex, library, enclosingClass, name, isStatic: isStatic);
97 } 99 }
98 100
99 abstract class KConstructor extends KFunction implements ConstructorEntity { 101 abstract class KConstructor extends KFunction implements ConstructorEntity {
100 final bool isConst; 102 final bool isConst;
101 103
102 KConstructor(int memberIndex, KClass enclosingClass, Name name, 104 KConstructor(int memberIndex, KClass enclosingClass, Name name,
103 {bool isExternal, this.isConst}) 105 ParameterStructure parameterStructure, {bool isExternal, this.isConst})
104 : super(memberIndex, enclosingClass.library, enclosingClass, name, 106 : super(memberIndex, enclosingClass.library, enclosingClass, name,
107 parameterStructure,
105 isExternal: isExternal); 108 isExternal: isExternal);
106 109
107 @override 110 @override
108 bool get isConstructor => true; 111 bool get isConstructor => true;
109 112
110 @override 113 @override
111 bool get isInstanceMember => false; 114 bool get isInstanceMember => false;
112 115
113 @override 116 @override
114 bool get isStatic => false; 117 bool get isStatic => false;
115 118
116 @override 119 @override
117 bool get isTopLevel => false; 120 bool get isTopLevel => false;
118 121
119 String get _kind => 'constructor'; 122 String get _kind => 'constructor';
120 } 123 }
121 124
122 class KGenerativeConstructor extends KConstructor { 125 class KGenerativeConstructor extends KConstructor {
123 KGenerativeConstructor(int constructorIndex, KClass enclosingClass, Name name, 126 KGenerativeConstructor(int constructorIndex, KClass enclosingClass, Name name,
124 {bool isExternal, bool isConst}) 127 ParameterStructure parameterStructure, {bool isExternal, bool isConst})
125 : super(constructorIndex, enclosingClass, name, 128 : super(constructorIndex, enclosingClass, name, parameterStructure,
126 isExternal: isExternal, isConst: isConst); 129 isExternal: isExternal, isConst: isConst);
127 130
128 @override 131 @override
129 bool get isFactoryConstructor => false; 132 bool get isFactoryConstructor => false;
130 133
131 @override 134 @override
132 bool get isGenerativeConstructor => true; 135 bool get isGenerativeConstructor => true;
133 } 136 }
134 137
135 class KFactoryConstructor extends KConstructor { 138 class KFactoryConstructor extends KConstructor {
136 KFactoryConstructor(int memberIndex, KClass enclosingClass, Name name, 139 KFactoryConstructor(int memberIndex, KClass enclosingClass, Name name,
137 {bool isExternal, bool isConst}) 140 ParameterStructure parameterStructure, {bool isExternal, bool isConst})
138 : super(memberIndex, enclosingClass, name, 141 : super(memberIndex, enclosingClass, name, parameterStructure,
139 isExternal: isExternal, isConst: isConst); 142 isExternal: isExternal, isConst: isConst);
140 143
141 @override 144 @override
142 bool get isFactoryConstructor => true; 145 bool get isFactoryConstructor => true;
143 146
144 @override 147 @override
145 bool get isGenerativeConstructor => false; 148 bool get isGenerativeConstructor => false;
146 } 149 }
147 150
148 class KMethod extends KFunction { 151 class KMethod extends KFunction {
149 final bool isAbstract; 152 final bool isAbstract;
150 153
151 KMethod(int memberIndex, KLibrary library, KClass enclosingClass, Name name, 154 KMethod(int memberIndex, KLibrary library, KClass enclosingClass, Name name,
155 ParameterStructure parameterStructure,
152 {bool isStatic, bool isExternal, this.isAbstract}) 156 {bool isStatic, bool isExternal, this.isAbstract})
153 : super(memberIndex, library, enclosingClass, name, 157 : super(memberIndex, library, enclosingClass, name, parameterStructure,
154 isStatic: isStatic, isExternal: isExternal); 158 isStatic: isStatic, isExternal: isExternal);
155 159
156 @override 160 @override
157 bool get isFunction => true; 161 bool get isFunction => true;
158 162
159 String get _kind => 'method'; 163 String get _kind => 'method';
160 } 164 }
161 165
162 class KGetter extends KFunction { 166 class KGetter extends KFunction {
163 final bool isAbstract; 167 final bool isAbstract;
164 168
165 KGetter(int memberIndex, KLibrary library, KClass enclosingClass, Name name, 169 KGetter(int memberIndex, KLibrary library, KClass enclosingClass, Name name,
166 {bool isStatic, bool isExternal, this.isAbstract}) 170 {bool isStatic, bool isExternal, this.isAbstract})
167 : super(memberIndex, library, enclosingClass, name, 171 : super(memberIndex, library, enclosingClass, name,
172 const ParameterStructure.getter(),
168 isStatic: isStatic, isExternal: isExternal); 173 isStatic: isStatic, isExternal: isExternal);
169 174
170 @override 175 @override
171 bool get isGetter => true; 176 bool get isGetter => true;
172 177
173 String get _kind => 'getter'; 178 String get _kind => 'getter';
174 } 179 }
175 180
176 class KSetter extends KFunction { 181 class KSetter extends KFunction {
177 final bool isAbstract; 182 final bool isAbstract;
178 183
179 KSetter(int memberIndex, KLibrary library, KClass enclosingClass, Name name, 184 KSetter(int memberIndex, KLibrary library, KClass enclosingClass, Name name,
180 {bool isStatic, bool isExternal, this.isAbstract}) 185 {bool isStatic, bool isExternal, this.isAbstract})
181 : super(memberIndex, library, enclosingClass, name, 186 : super(memberIndex, library, enclosingClass, name,
187 const ParameterStructure.setter(),
182 isStatic: isStatic, isExternal: isExternal); 188 isStatic: isStatic, isExternal: isExternal);
183 189
184 @override 190 @override
185 bool get isAssignable => true; 191 bool get isAssignable => true;
186 192
187 @override 193 @override
188 bool get isSetter => true; 194 bool get isSetter => true;
189 195
190 String get _kind => 'setter'; 196 String get _kind => 'setter';
191 } 197 }
(...skipping 25 matching lines...) Expand all
217 class KLocalFunction implements Local { 223 class KLocalFunction implements Local {
218 final String name; 224 final String name;
219 final MemberEntity memberContext; 225 final MemberEntity memberContext;
220 final Entity executableContext; 226 final Entity executableContext;
221 227
222 KLocalFunction(this.name, this.memberContext, this.executableContext); 228 KLocalFunction(this.name, this.memberContext, this.executableContext);
223 229
224 String toString() => 230 String toString() =>
225 'local_function(${memberContext.name}.${name ?? '<anonymous>'})'; 231 'local_function(${memberContext.name}.${name ?? '<anonymous>'})';
226 } 232 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/inferrer/closure_tracer.dart ('k') | pkg/compiler/lib/src/kernel/world_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698