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

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

Issue 2730093002: Avoid crashing on function syntax. (Closed)
Patch Set: Update status. 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_library_builder; 5 library fasta.kernel_library_builder;
6 6
7 import 'package:kernel/ast.dart'; 7 import 'package:kernel/ast.dart';
8 8
9 import 'package:kernel/clone.dart' show CloneVisitor; 9 import 'package:kernel/clone.dart' show CloneVisitor;
10 10
(...skipping 16 matching lines...) Expand all
27 ClassBuilder, 27 ClassBuilder,
28 ConstructorReferenceBuilder, 28 ConstructorReferenceBuilder,
29 DynamicTypeBuilder, 29 DynamicTypeBuilder,
30 FormalParameterBuilder, 30 FormalParameterBuilder,
31 FunctionTypeAliasBuilder, 31 FunctionTypeAliasBuilder,
32 KernelConstructorBuilder, 32 KernelConstructorBuilder,
33 KernelEnumBuilder, 33 KernelEnumBuilder,
34 KernelFieldBuilder, 34 KernelFieldBuilder,
35 KernelFormalParameterBuilder, 35 KernelFormalParameterBuilder,
36 KernelFunctionTypeAliasBuilder, 36 KernelFunctionTypeAliasBuilder,
37 KernelFunctionTypeBuilder,
37 KernelInvalidTypeBuilder, 38 KernelInvalidTypeBuilder,
38 KernelMixinApplicationBuilder, 39 KernelMixinApplicationBuilder,
39 KernelNamedMixinApplicationBuilder, 40 KernelNamedMixinApplicationBuilder,
40 KernelNamedTypeBuilder, 41 KernelNamedTypeBuilder,
41 KernelProcedureBuilder, 42 KernelProcedureBuilder,
42 KernelTypeBuilder, 43 KernelTypeBuilder,
43 KernelTypeVariableBuilder, 44 KernelTypeVariableBuilder,
44 MemberBuilder, 45 MemberBuilder,
45 MetadataBuilder, 46 MetadataBuilder,
46 MixedAccessor, 47 MixedAccessor,
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 List<TypeVariableBuilder> typeVariables, 253 List<TypeVariableBuilder> typeVariables,
253 List<FormalParameterBuilder> formals, 254 List<FormalParameterBuilder> formals,
254 int charOffset) { 255 int charOffset) {
255 FunctionTypeAliasBuilder typedef = new KernelFunctionTypeAliasBuilder( 256 FunctionTypeAliasBuilder typedef = new KernelFunctionTypeAliasBuilder(
256 metadata, returnType, name, typeVariables, formals, this, charOffset); 257 metadata, returnType, name, typeVariables, formals, this, charOffset);
257 // Nested declaration began in `OutlineBuilder.beginFunctionTypeAlias`. 258 // Nested declaration began in `OutlineBuilder.beginFunctionTypeAlias`.
258 endNestedDeclaration().resolveTypes(typeVariables, this); 259 endNestedDeclaration().resolveTypes(typeVariables, this);
259 addBuilder(name, typedef, charOffset); 260 addBuilder(name, typedef, charOffset);
260 } 261 }
261 262
263 KernelFunctionTypeBuilder addFunctionType(
264 KernelTypeBuilder returnType,
265 List<TypeVariableBuilder> typeVariables,
266 List<FormalParameterBuilder> formals,
267 int charOffset) {
268 return new KernelFunctionTypeBuilder(
269 charOffset, fileUri, returnType, typeVariables, formals);
270 }
271
262 KernelFormalParameterBuilder addFormalParameter( 272 KernelFormalParameterBuilder addFormalParameter(
263 List<MetadataBuilder> metadata, 273 List<MetadataBuilder> metadata,
264 int modifiers, 274 int modifiers,
265 KernelTypeBuilder type, 275 KernelTypeBuilder type,
266 String name, 276 String name,
267 bool hasThis, 277 bool hasThis,
268 int charOffset) { 278 int charOffset) {
269 return new KernelFormalParameterBuilder( 279 return new KernelFormalParameterBuilder(
270 metadata, modifiers, type, name, hasThis, this, charOffset); 280 metadata, modifiers, type, name, hasThis, this, charOffset);
271 } 281 }
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 } 421 }
412 } 422 }
413 423
414 bool isConstructorName(String name, String className) { 424 bool isConstructorName(String name, String className) {
415 if (name.startsWith(className)) { 425 if (name.startsWith(className)) {
416 if (name.length == className.length) return true; 426 if (name.length == className.length) return true;
417 if (name.startsWith(".", className.length)) return true; 427 if (name.startsWith(".", className.length)) return true;
418 } 428 }
419 return false; 429 return false;
420 } 430 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698