Scrub all non-identifier characters from JavaScript class names

Class names from kernel contain "&", "#", "^" etc

BUG=
R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2999473002 .
This commit is contained in:
Stephen Adams 2017-08-07 13:12:58 -07:00
parent 20d05b68aa
commit 84b615df3d
3 changed files with 6 additions and 57 deletions

View file

@ -1286,9 +1286,11 @@ class Namer {
/// Returns a proposed name for the given typedef or class [element].
/// The returned id is guaranteed to be a valid JavaScript identifier.
String _proposeNameForType(Entity element) {
return element.name.replaceAll('+', '_');
return element.name.replaceAll(_nonIdentifierRE, '_');
}
static RegExp _nonIdentifierRE = new RegExp(r'[^A-Za-z0-9_$]');
/// Returns a proposed name for the given top-level or static member
/// [element]. The returned id is guaranteed to be a valid JavaScript
/// identifier.

View file

@ -183,7 +183,6 @@ regress/4562_test/01: Crash # Issue 27394
22776_test: Crash
22868_test: Crash
22917_test: Crash
23056_test: RuntimeError
23264_test: Crash
23404_test: Crash
23432_test: Crash

View file

@ -1034,7 +1034,6 @@ generic_function_typedef2_test/04: Crash
generic_function_typedef2_test/none: Crash
generic_function_typedef_test: Crash
generic_functions_test: Crash
generic_instanceof5_test: Crash
generic_instanceof_test: Crash
generic_list_checked_test: Crash
generic_local_functions_test: Crash
@ -1238,7 +1237,6 @@ issue_22780_test/01: Crash
issue_23914_test: Crash
issue_25671a_test/01: Crash
issue_25671b_test/01: Crash
issue_25671b_test/none: Crash
label_test: Crash
lazy_map_test: Crash
lazy_static3_test: Crash
@ -1322,7 +1320,6 @@ malbounded_type_cast_test: Crash
malbounded_type_literal_test: Crash
malbounded_type_test2_test: Crash
malformed2_test/00: Crash
malformed_inheritance_test/04: Crash
malformed_test/01: Crash
malformed_test/02: Crash
malformed_test/03: Crash
@ -1367,9 +1364,7 @@ mint_compares_test: Crash
missing_const_constructor_test/01: Crash
missing_const_constructor_test/none: Crash
mixin_black_listed_test/02: Crash
mixin_black_listed_test/none: Crash
mixin_bound_test: Crash
mixin_class_from_core_library_test: Crash
mixin_extends_field_test: Crash
mixin_extends_is_test: Crash
mixin_extends_method_test: Crash
@ -1379,21 +1374,13 @@ mixin_forwarding_constructor1_test: Crash
mixin_forwarding_constructor2_test: Crash
mixin_forwarding_constructor3_test: Crash
mixin_forwarding_constructor4_test/01: Crash
mixin_forwarding_constructor4_test/01: MissingCompileTimeError
mixin_forwarding_constructor4_test/02: Crash
mixin_forwarding_constructor4_test/02: MissingCompileTimeError
mixin_forwarding_constructor4_test/03: Crash
mixin_forwarding_constructor4_test/none: Crash
mixin_forwarding_constructor4_test/03: MissingCompileTimeError
mixin_generic_test: Crash
mixin_getter_regression_test: Crash
generic_instanceof5_test: RuntimeError
issue_25671b_test/none: RuntimeError
malformed_inheritance_test/04: RuntimeError
mixin_black_listed_test/none: RuntimeError
mixin_class_from_core_library_test: RuntimeError
mixin_forwarding_constructor4_test/01: MissingCompileTimeError
mixin_forwarding_constructor4_test/02: MissingCompileTimeError
mixin_forwarding_constructor4_test/03: MissingCompileTimeError
mixin_forwarding_constructor4_test/none: RuntimeError
mixin_illegal_constructor_test/none: RuntimeError
mixin_illegal_static_access_test: Crash
mixin_illegal_super_use_test/01: Crash
mixin_illegal_super_use_test/02: Crash
@ -1437,34 +1424,7 @@ mixin_illegal_superclass_test/27: MissingCompileTimeError
mixin_illegal_superclass_test/28: Crash
mixin_illegal_superclass_test/29: MissingCompileTimeError
mixin_illegal_superclass_test/30: Crash
mixin_illegal_superclass_test/none: RuntimeError
mixin_illegal_syntax_test/none: RuntimeError
mixin_implements_test: Crash
mixin_invalid_bound2_test/01: RuntimeError
mixin_invalid_bound2_test/02: RuntimeError
mixin_invalid_bound2_test/03: RuntimeError
mixin_invalid_bound2_test/04: RuntimeError
mixin_invalid_bound2_test/05: RuntimeError
mixin_invalid_bound2_test/06: RuntimeError
mixin_invalid_bound2_test/07: RuntimeError
mixin_invalid_bound2_test/08: RuntimeError
mixin_invalid_bound2_test/09: RuntimeError
mixin_invalid_bound2_test/10: RuntimeError
mixin_invalid_bound2_test/11: RuntimeError
mixin_invalid_bound2_test/12: RuntimeError
mixin_invalid_bound2_test/13: RuntimeError
mixin_invalid_bound2_test/14: RuntimeError
mixin_invalid_bound_test/01: RuntimeError
mixin_invalid_bound_test/02: RuntimeError
mixin_invalid_bound_test/03: RuntimeError
mixin_invalid_bound_test/04: RuntimeError
mixin_invalid_bound_test/05: RuntimeError
mixin_invalid_bound_test/06: RuntimeError
mixin_invalid_bound_test/07: RuntimeError
mixin_invalid_bound_test/08: RuntimeError
mixin_invalid_bound_test/09: RuntimeError
mixin_invalid_bound_test/10: RuntimeError
mixin_is_test: RuntimeError
mixin_issue10216_2_test: Crash
mixin_issue10216_test: Crash
mixin_lib_extends_field_test: Crash
@ -1550,18 +1510,10 @@ mixin_supertype_subclass_test/04: CompileTimeError
mixin_supertype_subclass_test/05: CompileTimeError
mixin_supertype_subclass_test/none: CompileTimeError
mixin_this_use_test: Crash
mixin_type_parameter1_test: RuntimeError
mixin_type_parameter2_test: RuntimeError
mixin_type_parameter3_test: Crash
mixin_type_parameter4_test: Crash
mixin_type_parameter5_test: Crash
mixin_type_parameter6_test: Crash
mixin_type_parameters_errors_test/01: RuntimeError
mixin_type_parameters_errors_test/02: RuntimeError
mixin_type_parameters_errors_test/03: RuntimeError
mixin_type_parameters_errors_test/04: RuntimeError
mixin_type_parameters_errors_test/05: RuntimeError
mixin_type_parameters_errors_test/none: RuntimeError
mixin_type_parameters_mixin_extends_test: Crash
mixin_type_parameters_mixin_test: Crash
mixin_type_parameters_simple_test: Crash
@ -1755,7 +1707,6 @@ regress_18435_test: Crash
regress_18535_test: Crash
regress_18713_test: Crash
regress_20394_test/01: Crash
regress_20394_test/none: RuntimeError
regress_20840_test: Crash
regress_21016_test: Crash
regress_21795_test: Crash
@ -1877,7 +1828,6 @@ super_field_access_test: Crash
super_getter_setter_test: Crash
super_implicit_closure_test: Crash
super_inferrer_test: Crash
super_mixin_test: RuntimeError
super_no_such_method1_test/01: Crash
super_no_such_method2_test/01: Crash
super_no_such_method3_test/01: Crash
@ -2050,9 +2000,7 @@ type_variable_typedef_test: Crash
typecheck_multifield_declaration_test: Crash
typedef_is_test: Crash
typedef_uses_test: Crash # type 'FunctionType' is not a subtype of type 'ResolutionFunctionType' of 'type' where
typevariable_substitution2_test/01: RuntimeError
typevariable_substitution2_test/02: Crash
typevariable_substitution2_test/none: RuntimeError
unresolved_default_constructor_test/01: Crash
value_range2_test: Crash
value_range3_test: Crash