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

Side by Side Diff: pkg/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart

Issue 2746013003: [fasta] Add and correct even more offsets (Closed)
Patch Set: Removed formalParametersToken parameter Created 3 years, 9 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) 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 fasta.kernel_procedure_builder; 5 library fasta.kernel_procedure_builder;
6 6
7 import 'package:kernel/ast.dart' 7 import 'package:kernel/ast.dart'
8 show 8 show
9 Arguments, 9 Arguments,
10 AsyncMarker, 10 AsyncMarker,
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 } else { 168 } else {
169 annotation = new StaticInvocation(constructor.target, arguments) 169 annotation = new StaticInvocation(constructor.target, arguments)
170 ..isConst = true; 170 ..isConst = true;
171 } 171 }
172 target.addAnnotation(annotation); 172 target.addAnnotation(annotation);
173 } 173 }
174 } 174 }
175 175
176 class KernelProcedureBuilder extends KernelFunctionBuilder { 176 class KernelProcedureBuilder extends KernelFunctionBuilder {
177 final Procedure procedure; 177 final Procedure procedure;
178 final int charOpenParenOffset;
178 179
179 AsyncMarker actualAsyncModifier; 180 AsyncMarker actualAsyncModifier;
180 181
181 final ConstructorReferenceBuilder redirectionTarget; 182 final ConstructorReferenceBuilder redirectionTarget;
182 183
183 KernelProcedureBuilder( 184 KernelProcedureBuilder(
184 List<MetadataBuilder> metadata, 185 List<MetadataBuilder> metadata,
185 int modifiers, 186 int modifiers,
186 KernelTypeBuilder returnType, 187 KernelTypeBuilder returnType,
187 String name, 188 String name,
188 List<TypeVariableBuilder> typeVariables, 189 List<TypeVariableBuilder> typeVariables,
189 List<FormalParameterBuilder> formals, 190 List<FormalParameterBuilder> formals,
190 this.actualAsyncModifier, 191 this.actualAsyncModifier,
191 ProcedureKind kind, 192 ProcedureKind kind,
192 KernelLibraryBuilder compilationUnit, 193 KernelLibraryBuilder compilationUnit,
193 int charOffset, 194 int charOffset,
195 this.charOpenParenOffset,
194 int charEndOffset, 196 int charEndOffset,
195 [String nativeMethodName, 197 [String nativeMethodName,
196 this.redirectionTarget]) 198 this.redirectionTarget])
197 : procedure = new Procedure(null, kind, null, 199 : procedure = new Procedure(null, kind, null,
198 fileUri: compilationUnit?.relativeFileUri) 200 fileUri: compilationUnit?.relativeFileUri)
199 ..fileOffset = charOffset 201 ..fileOffset = charOffset
200 ..fileEndOffset = charEndOffset, 202 ..fileEndOffset = charEndOffset,
201 super(metadata, modifiers, returnType, name, typeVariables, formals, 203 super(metadata, modifiers, returnType, name, typeVariables, formals,
202 compilationUnit, charOffset, nativeMethodName); 204 compilationUnit, charOffset, nativeMethodName);
203 205
(...skipping 17 matching lines...) Expand all
221 // No parent, it's an enum. 223 // No parent, it's an enum.
222 function.asyncMarker = actualAsyncModifier; 224 function.asyncMarker = actualAsyncModifier;
223 } 225 }
224 } 226 }
225 227
226 Procedure build(LibraryBuilder library) { 228 Procedure build(LibraryBuilder library) {
227 // TODO(ahe): I think we may call this twice on parts. Investigate. 229 // TODO(ahe): I think we may call this twice on parts. Investigate.
228 if (procedure.name == null) { 230 if (procedure.name == null) {
229 procedure.function = buildFunction(library); 231 procedure.function = buildFunction(library);
230 procedure.function.parent = procedure; 232 procedure.function.parent = procedure;
233 procedure.function.fileOffset = charOpenParenOffset;
234 procedure.function.fileEndOffset = procedure.fileEndOffset;
231 procedure.isAbstract = isAbstract; 235 procedure.isAbstract = isAbstract;
232 procedure.isStatic = isStatic; 236 procedure.isStatic = isStatic;
233 procedure.isExternal = isExternal; 237 procedure.isExternal = isExternal;
234 procedure.isConst = isConst; 238 procedure.isConst = isConst;
235 procedure.name = new Name(name, library.target); 239 procedure.name = new Name(name, library.target);
236 } 240 }
237 return procedure; 241 return procedure;
238 } 242 }
239 243
240 Procedure get target => procedure; 244 Procedure get target => procedure;
241 } 245 }
242 246
243 // TODO(ahe): Move this to own file? 247 // TODO(ahe): Move this to own file?
244 class KernelConstructorBuilder extends KernelFunctionBuilder { 248 class KernelConstructorBuilder extends KernelFunctionBuilder {
245 final Constructor constructor; 249 final Constructor constructor;
250 final int charOpenParenOffset;
246 251
247 bool hasMovedSuperInitializer = false; 252 bool hasMovedSuperInitializer = false;
248 253
249 SuperInitializer superInitializer; 254 SuperInitializer superInitializer;
250 255
251 RedirectingInitializer redirectingInitializer; 256 RedirectingInitializer redirectingInitializer;
252 257
253 KernelConstructorBuilder( 258 KernelConstructorBuilder(
254 List<MetadataBuilder> metadata, 259 List<MetadataBuilder> metadata,
255 int modifiers, 260 int modifiers,
256 KernelTypeBuilder returnType, 261 KernelTypeBuilder returnType,
257 String name, 262 String name,
258 List<TypeVariableBuilder> typeVariables, 263 List<TypeVariableBuilder> typeVariables,
259 List<FormalParameterBuilder> formals, 264 List<FormalParameterBuilder> formals,
260 KernelLibraryBuilder compilationUnit, 265 KernelLibraryBuilder compilationUnit,
261 int charOffset, 266 int charOffset,
267 this.charOpenParenOffset,
262 int charEndOffset, 268 int charEndOffset,
263 [String nativeMethodName]) 269 [String nativeMethodName])
264 : constructor = new Constructor(null) 270 : constructor = new Constructor(null)
265 ..fileOffset = charOffset 271 ..fileOffset = charOffset
266 ..fileEndOffset = charEndOffset, 272 ..fileEndOffset = charEndOffset,
267 super(metadata, modifiers, returnType, name, typeVariables, formals, 273 super(metadata, modifiers, returnType, name, typeVariables, formals,
268 compilationUnit, charOffset, nativeMethodName); 274 compilationUnit, charOffset, nativeMethodName);
269 275
270 bool get isInstanceMember => false; 276 bool get isInstanceMember => false;
271 277
272 bool get isConstructor => true; 278 bool get isConstructor => true;
273 279
274 AsyncMarker get asyncModifier => AsyncMarker.Sync; 280 AsyncMarker get asyncModifier => AsyncMarker.Sync;
275 281
276 ProcedureKind get kind => null; 282 ProcedureKind get kind => null;
277 283
278 Constructor build(LibraryBuilder library) { 284 Constructor build(LibraryBuilder library) {
279 if (constructor.name == null) { 285 if (constructor.name == null) {
280 constructor.function = buildFunction(library); 286 constructor.function = buildFunction(library);
281 constructor.function.parent = constructor; 287 constructor.function.parent = constructor;
288 constructor.function.fileOffset = charOpenParenOffset;
289 constructor.function.fileEndOffset = constructor.fileEndOffset;
282 constructor.isConst = isConst; 290 constructor.isConst = isConst;
283 constructor.isExternal = isExternal; 291 constructor.isExternal = isExternal;
284 constructor.name = new Name(name, library.target); 292 constructor.name = new Name(name, library.target);
285 } 293 }
286 return constructor; 294 return constructor;
287 } 295 }
288 296
289 FunctionNode buildFunction(LibraryBuilder library) { 297 FunctionNode buildFunction(LibraryBuilder library) {
290 // TODO(ahe): Should complain if another type is explicitly set. 298 // TODO(ahe): Should complain if another type is explicitly set.
291 return super.buildFunction(library)..returnType = const VoidType(); 299 return super.buildFunction(library)..returnType = const VoidType();
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 } 356 }
349 } 357 }
350 initializers.add(initializer..parent = constructor); 358 initializers.add(initializer..parent = constructor);
351 initializers.add(superInitializer); 359 initializers.add(superInitializer);
352 return; 360 return;
353 } 361 }
354 initializers.add(initializer); 362 initializers.add(initializer);
355 initializer.parent = constructor; 363 initializer.parent = constructor;
356 } 364 }
357 } 365 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart ('k') | pkg/front_end/lib/src/fasta/kernel/kernel_target.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698