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

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

Issue 1232613005: Allow super calls in mixins (for now behind a --supermixin flag). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comments Created 5 years, 5 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
« no previous file with comments | « runtime/vm/object.cc ('k') | tests/language/language_analyzer.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 6
7 #include "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/ast_transformer.h" 9 #include "vm/ast_transformer.h"
10 #include "vm/bootstrap.h" 10 #include "vm/bootstrap.h"
(...skipping 25 matching lines...) Expand all
36 #include "vm/zone.h" 36 #include "vm/zone.h"
37 37
38 namespace dart { 38 namespace dart {
39 39
40 DEFINE_FLAG(bool, enable_debug_break, false, "Allow use of break \"message\"."); 40 DEFINE_FLAG(bool, enable_debug_break, false, "Allow use of break \"message\".");
41 DEFINE_FLAG(bool, enable_mirrors, true, 41 DEFINE_FLAG(bool, enable_mirrors, true,
42 "Disable to make importing dart:mirrors an error."); 42 "Disable to make importing dart:mirrors an error.");
43 DEFINE_FLAG(bool, load_deferred_eagerly, false, 43 DEFINE_FLAG(bool, load_deferred_eagerly, false,
44 "Load deferred libraries eagerly."); 44 "Load deferred libraries eagerly.");
45 DEFINE_FLAG(bool, trace_parser, false, "Trace parser operations."); 45 DEFINE_FLAG(bool, trace_parser, false, "Trace parser operations.");
46 DEFINE_FLAG(bool, supermixin, false, "Allow super calls in mixins.");
46 DEFINE_FLAG(bool, warn_mixin_typedef, true, "Warning on legacy mixin typedef."); 47 DEFINE_FLAG(bool, warn_mixin_typedef, true, "Warning on legacy mixin typedef.");
47 48
48 DECLARE_FLAG(bool, lazy_dispatchers); 49 DECLARE_FLAG(bool, lazy_dispatchers);
49 DECLARE_FLAG(bool, load_deferred_eagerly); 50 DECLARE_FLAG(bool, load_deferred_eagerly);
50 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); 51 DECLARE_FLAG(bool, throw_on_javascript_int_overflow);
51 DECLARE_FLAG(bool, warn_on_javascript_compatibility); 52 DECLARE_FLAG(bool, warn_on_javascript_compatibility);
52 53
53 // Quick access to the current isolate and zone. 54 // Quick access to the current isolate and zone.
54 #define I (isolate()) 55 #define I (isolate())
55 #define Z (zone()) 56 #define Z (zone())
(...skipping 13155 matching lines...) Expand 10 before | Expand all | Expand 10 after
13211 } else if (token == Token::kHASH) { 13212 } else if (token == Token::kHASH) {
13212 primary = ParseSymbolLiteral(); 13213 primary = ParseSymbolLiteral();
13213 } else if (token == Token::kSUPER) { 13214 } else if (token == Token::kSUPER) {
13214 if (current_function().is_static()) { 13215 if (current_function().is_static()) {
13215 ReportError("cannot access superclass from static method"); 13216 ReportError("cannot access superclass from static method");
13216 } 13217 }
13217 if (current_class().SuperClass() == Class::null()) { 13218 if (current_class().SuperClass() == Class::null()) {
13218 ReportError("class '%s' does not have a superclass", 13219 ReportError("class '%s' does not have a superclass",
13219 String::Handle(Z, current_class().Name()).ToCString()); 13220 String::Handle(Z, current_class().Name()).ToCString());
13220 } 13221 }
13221 if (current_class().IsMixinApplication()) { 13222 if (!FLAG_supermixin) {
13222 const Type& mixin_type = Type::Handle(Z, current_class().mixin()); 13223 if (current_class().IsMixinApplication()) {
13223 if (mixin_type.type_class() == current_function().origin()) { 13224 const Type& mixin_type = Type::Handle(Z, current_class().mixin());
13224 ReportError("method of mixin class '%s' may not refer to 'super'", 13225 if (mixin_type.type_class() == current_function().origin()) {
13225 String::Handle(Z, Class::Handle(Z, 13226 ReportError("method of mixin class '%s' may not refer to 'super'",
13226 current_function().origin()).Name()).ToCString()); 13227 String::Handle(Z, Class::Handle(Z,
13228 current_function().origin()).Name()).ToCString());
13229 }
13227 } 13230 }
13228 } 13231 }
13229 const intptr_t super_pos = TokenPos(); 13232 const intptr_t super_pos = TokenPos();
13230 ConsumeToken(); 13233 ConsumeToken();
13231 if (CurrentToken() == Token::kPERIOD) { 13234 if (CurrentToken() == Token::kPERIOD) {
13232 ConsumeToken(); 13235 ConsumeToken();
13233 const intptr_t ident_pos = TokenPos(); 13236 const intptr_t ident_pos = TokenPos();
13234 const String& ident = *ExpectIdentifier("identifier expected"); 13237 const String& ident = *ExpectIdentifier("identifier expected");
13235 if (CurrentToken() == Token::kLPAREN) { 13238 if (CurrentToken() == Token::kLPAREN) {
13236 primary = ParseSuperCall(ident); 13239 primary = ParseSuperCall(ident);
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
13625 void Parser::SkipQualIdent() { 13628 void Parser::SkipQualIdent() {
13626 ASSERT(IsIdentifier()); 13629 ASSERT(IsIdentifier());
13627 ConsumeToken(); 13630 ConsumeToken();
13628 if (CurrentToken() == Token::kPERIOD) { 13631 if (CurrentToken() == Token::kPERIOD) {
13629 ConsumeToken(); // Consume the kPERIOD token. 13632 ConsumeToken(); // Consume the kPERIOD token.
13630 ExpectIdentifier("identifier expected after '.'"); 13633 ExpectIdentifier("identifier expected after '.'");
13631 } 13634 }
13632 } 13635 }
13633 13636
13634 } // namespace dart 13637 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | tests/language/language_analyzer.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698