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

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: 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;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 bool get isConstructor => true; 276 bool get isConstructor => true;
273 277
274 AsyncMarker get asyncModifier => AsyncMarker.Sync; 278 AsyncMarker get asyncModifier => AsyncMarker.Sync;
275 279
276 ProcedureKind get kind => null; 280 ProcedureKind get kind => null;
277 281
278 Constructor build(LibraryBuilder library) { 282 Constructor build(LibraryBuilder library) {
279 if (constructor.name == null) { 283 if (constructor.name == null) {
280 constructor.function = buildFunction(library); 284 constructor.function = buildFunction(library);
281 constructor.function.parent = constructor; 285 constructor.function.parent = constructor;
286 constructor.function.fileOffset = constructor.fileOffset;
287 constructor.function.fileEndOffset = constructor.fileEndOffset;
282 constructor.isConst = isConst; 288 constructor.isConst = isConst;
283 constructor.isExternal = isExternal; 289 constructor.isExternal = isExternal;
284 constructor.name = new Name(name, library.target); 290 constructor.name = new Name(name, library.target);
285 } 291 }
286 return constructor; 292 return constructor;
287 } 293 }
288 294
289 FunctionNode buildFunction(LibraryBuilder library) { 295 FunctionNode buildFunction(LibraryBuilder library) {
290 // TODO(ahe): Should complain if another type is explicitly set. 296 // TODO(ahe): Should complain if another type is explicitly set.
291 return super.buildFunction(library)..returnType = const VoidType(); 297 return super.buildFunction(library)..returnType = const VoidType();
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 } 354 }
349 } 355 }
350 initializers.add(initializer..parent = constructor); 356 initializers.add(initializer..parent = constructor);
351 initializers.add(superInitializer); 357 initializers.add(superInitializer);
352 return; 358 return;
353 } 359 }
354 initializers.add(initializer); 360 initializers.add(initializer);
355 initializer.parent = constructor; 361 initializer.parent = constructor;
356 } 362 }
357 } 363 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698