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

Side by Side Diff: runtime/vm/parser.cc

Issue 1540673002: Move super initializer to end of list (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Review comments Created 5 years 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
« no previous file with comments | « no previous file | tests/co19/co19-runtime.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 #include "vm/parser.h" 5 #include "vm/parser.h"
6 #include "vm/flags.h" 6 #include "vm/flags.h"
7 7
8 #ifndef DART_PRECOMPILED 8 #ifndef DART_PRECOMPILED
9 9
10 #include "lib/invocation_mirror.h" 10 #include "lib/invocation_mirror.h"
(...skipping 30 matching lines...) Expand all
41 namespace dart { 41 namespace dart {
42 42
43 DEFINE_FLAG(bool, enable_debug_break, false, "Allow use of break \"message\"."); 43 DEFINE_FLAG(bool, enable_debug_break, false, "Allow use of break \"message\".");
44 DEFINE_FLAG(bool, enable_mirrors, true, 44 DEFINE_FLAG(bool, enable_mirrors, true,
45 "Disable to make importing dart:mirrors an error."); 45 "Disable to make importing dart:mirrors an error.");
46 DEFINE_FLAG(bool, load_deferred_eagerly, false, 46 DEFINE_FLAG(bool, load_deferred_eagerly, false,
47 "Load deferred libraries eagerly."); 47 "Load deferred libraries eagerly.");
48 DEFINE_FLAG(bool, trace_parser, false, "Trace parser operations."); 48 DEFINE_FLAG(bool, trace_parser, false, "Trace parser operations.");
49 DEFINE_FLAG(bool, warn_mixin_typedef, true, "Warning on legacy mixin typedef."); 49 DEFINE_FLAG(bool, warn_mixin_typedef, true, "Warning on legacy mixin typedef.");
50 DEFINE_FLAG(bool, link_natives_lazily, false, "Link native calls lazily"); 50 DEFINE_FLAG(bool, link_natives_lazily, false, "Link native calls lazily");
51 DEFINE_FLAG(bool, move_super, false, "Move super initializer to end of list"); 51 DEFINE_FLAG(bool, move_super, true, "Move super initializer to end of list.");
52 DEFINE_FLAG(bool, warn_super, false,
53 "Warning if super initializer not last in initializer list.");
52 54
53 DECLARE_FLAG(bool, lazy_dispatchers); 55 DECLARE_FLAG(bool, lazy_dispatchers);
54 DECLARE_FLAG(bool, load_deferred_eagerly); 56 DECLARE_FLAG(bool, load_deferred_eagerly);
55 DECLARE_FLAG(bool, profile_vm); 57 DECLARE_FLAG(bool, profile_vm);
56 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); 58 DECLARE_FLAG(bool, throw_on_javascript_int_overflow);
57 DECLARE_FLAG(bool, warn_on_javascript_compatibility); 59 DECLARE_FLAG(bool, warn_on_javascript_compatibility);
58 60
59 // Quick access to the current thread, isolate and zone. 61 // Quick access to the current thread, isolate and zone.
60 #define T (thread()) 62 #define T (thread())
61 #define I (isolate()) 63 #define I (isolate())
(...skipping 2747 matching lines...) Expand 10 before | Expand all | Expand 10 after
2809 if (FLAG_move_super && (super_init_call != NULL) && !super_init_is_last) { 2811 if (FLAG_move_super && (super_init_call != NULL) && !super_init_is_last) {
2810 // If the super initializer call is not at the end of the initializer 2812 // If the super initializer call is not at the end of the initializer
2811 // list, implicitly move it to the end. The actual parameter values 2813 // list, implicitly move it to the end. The actual parameter values
2812 // are evaluated at the original position in the list and preserved 2814 // are evaluated at the original position in the list and preserved
2813 // in temporary variables. (The following initializer expressions 2815 // in temporary variables. (The following initializer expressions
2814 // could have side effects that alter the arguments to the super 2816 // could have side effects that alter the arguments to the super
2815 // initializer.) E.g: 2817 // initializer.) E.g:
2816 // A(x) : super(x), f = x++ { ... } 2818 // A(x) : super(x), f = x++ { ... }
2817 // is transformed to: 2819 // is transformed to:
2818 // A(x) : temp = x, f = x++, super(temp) { ... } 2820 // A(x) : temp = x, f = x++, super(temp) { ... }
2819 ReportWarning("Super initizlizer not at end"); 2821 if (FLAG_warn_super) {
2822 ReportWarning("Super initializer not at end");
2823 }
2820 ASSERT(super_init_index >= 0); 2824 ASSERT(super_init_index >= 0);
2821 ArgumentListNode* ctor_args = super_init_call->arguments(); 2825 ArgumentListNode* ctor_args = super_init_call->arguments();
2822 LetNode* saved_args = new(Z) LetNode(super_init_call->token_pos()); 2826 LetNode* saved_args = new(Z) LetNode(super_init_call->token_pos());
2823 // The super initializer call has at least 2 arguments: the 2827 // The super initializer call has at least 2 arguments: the
2824 // implicit receiver, and the hidden construction phase. 2828 // implicit receiver, and the hidden construction phase.
2825 ASSERT(ctor_args->length() >= 2); 2829 ASSERT(ctor_args->length() >= 2);
2826 for (int i = 2; i < ctor_args->length(); i++) { 2830 for (int i = 2; i < ctor_args->length(); i++) {
2827 AstNode* arg = ctor_args->NodeAt(i); 2831 AstNode* arg = ctor_args->NodeAt(i);
2828 LocalVariable* temp = CreateTempConstVariable(arg->token_pos(), "sca"); 2832 LocalVariable* temp = CreateTempConstVariable(arg->token_pos(), "sca");
2829 AstNode* save_temp = new(Z) StoreLocalNode(arg->token_pos(), temp, arg); 2833 AstNode* save_temp = new(Z) StoreLocalNode(arg->token_pos(), temp, arg);
(...skipping 11650 matching lines...) Expand 10 before | Expand all | Expand 10 after
14480 const ArgumentListNode& function_args, 14484 const ArgumentListNode& function_args,
14481 const LocalVariable* temp_for_last_arg, 14485 const LocalVariable* temp_for_last_arg,
14482 bool is_super_invocation) { 14486 bool is_super_invocation) {
14483 UNREACHABLE(); 14487 UNREACHABLE();
14484 return NULL; 14488 return NULL;
14485 } 14489 }
14486 14490
14487 } // namespace dart 14491 } // namespace dart
14488 14492
14489 #endif // DART_PRECOMPILED 14493 #endif // DART_PRECOMPILED
OLDNEW
« no previous file with comments | « no previous file | tests/co19/co19-runtime.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698