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

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

Issue 2741753002: Handle bad factory names correctly. (Closed)
Patch Set: Update status files. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/co19/co19-kernel.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
index 4eac6a14505866ac4bb8f5f3d6b00eae7530421d..8c0031c4b81aa67282c039d66ff3cba7cf755dac 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
@@ -153,6 +153,12 @@ class KernelLibraryBuilder
charOffset);
}
+ String computeConstructorName(String name) {
+ assert(isConstructorName(name, currentDeclaration.name));
+ int index = name.indexOf(".");
+ return index == -1 ? "" : name.substring(index + 1);
+ }
+
void addProcedure(
List<MetadataBuilder> metadata,
int modifiers,
@@ -171,8 +177,7 @@ class KernelLibraryBuilder
endNestedDeclaration().resolveTypes(typeVariables, this);
ProcedureBuilder procedure;
if (!isTopLevel && isConstructorName(name, currentDeclaration.name)) {
- int index = name.indexOf(".");
- name = index == -1 ? "" : name.substring(index + 1);
+ name = computeConstructorName(name);
procedure = new KernelConstructorBuilder(
metadata,
modifiers & ~abstractMask,
@@ -219,8 +224,9 @@ class KernelLibraryBuilder
DeclarationBuilder<KernelTypeBuilder> factoryDeclaration =
endNestedDeclaration();
String name = constructorName.name;
- int index = name.indexOf(".");
- name = index == -1 ? "" : name.substring(index + 1);
+ if (isConstructorName(name, currentDeclaration.name)) {
+ name = computeConstructorName(name);
+ }
assert(constructorName.suffix == null);
KernelProcedureBuilder procedure = new KernelProcedureBuilder(
metadata,
« no previous file with comments | « no previous file | tests/co19/co19-kernel.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698