Move super initializer to end of list.

Introduce --warn_super flag to print a warning when a super call is found that is not at the end of the initializer list.

Mark failing tests as Fail, OK.

In a later step, we can eliminate the implicit 'phase' parameter in constructors.

BUG=
R=iposva@google.com

Review URL: https://codereview.chromium.org/1540673002 .
This commit is contained in:
Matthias Hausner 2015-12-18 15:37:07 -08:00
parent a34bab7fde
commit f51f96816d
3 changed files with 19 additions and 4 deletions

View file

@ -48,7 +48,9 @@ DEFINE_FLAG(bool, load_deferred_eagerly, false,
DEFINE_FLAG(bool, trace_parser, false, "Trace parser operations.");
DEFINE_FLAG(bool, warn_mixin_typedef, true, "Warning on legacy mixin typedef.");
DEFINE_FLAG(bool, link_natives_lazily, false, "Link native calls lazily");
DEFINE_FLAG(bool, move_super, false, "Move super initializer to end of list");
DEFINE_FLAG(bool, move_super, true, "Move super initializer to end of list.");
DEFINE_FLAG(bool, warn_super, false,
"Warning if super initializer not last in initializer list.");
DECLARE_FLAG(bool, lazy_dispatchers);
DECLARE_FLAG(bool, load_deferred_eagerly);
@ -2816,7 +2818,9 @@ void Parser::ParseInitializers(const Class& cls,
// A(x) : super(x), f = x++ { ... }
// is transformed to:
// A(x) : temp = x, f = x++, super(temp) { ... }
ReportWarning("Super initizlizer not at end");
if (FLAG_warn_super) {
ReportWarning("Super initializer not at end");
}
ASSERT(super_init_index >= 0);
ArgumentListNode* ctor_args = super_init_call->arguments();
LetNode* saved_args = new(Z) LetNode(super_init_call->token_pos());

View file

@ -5,6 +5,11 @@
[ ($compiler == none || $compiler == precompiler) && (($runtime == vm || $runtime == dart_precompiled) || $runtime == dartium || $runtime == ContentShellOnAndroid) ]
# Failures ok in tests below. VM moves super initializer to end of list.
Language/Classes/Constructors/Generative_Constructors/execution_t03: Fail, OK
Language/Expressions/Instance_Creation/New/execution_t04: Fail, OK
Language/Expressions/Instance_Creation/New/execution_t06: Fail, OK
LibTest/core/RegExp/Pattern_semantics/firstMatch_NonEmptyClassRanges_A01_t01: Fail # Issue 22200
LibTest/core/RegExp/Pattern_semantics/firstMatch_NonEmptyClassRanges_A01_t05: Fail # Issue 22200
LibTest/core/RegExp/Pattern_semantics/firstMatch_NonEmptyClassRanges_A01_t06: Fail # Issue 22200

View file

@ -10,10 +10,16 @@ built_in_identifier_prefix_test: Fail # Issue 6970
tearoff_constructor_basic_test: Skip # Crashes in checked mode -- hausner investigating
# These bugs refer currently ongoing language discussions.
constructor_initializer_test/none: Fail # Issue 12633
constructor5_test: Fail # Issue 6422
constructor6_test: Fail # Issue 6422
closure_in_initializer_test: Fail # Issue 6422
# Failures related to super call in ctor initializer list
super_test: Fail, OK
final_field_initialization_order_test: Fail, OK
field_initialization_order_test: Fail, OK
example_constructor_test: Fail, OK
constructor3_test: Fail, OK
constructor2_test: Fail, OK
# Regular bugs which should be fixed.
duplicate_export_negative_test: Fail # Issue 6134