OLD | NEW |
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 26 matching lines...) Expand all Loading... |
37 #include "vm/zone.h" | 37 #include "vm/zone.h" |
38 | 38 |
39 namespace dart { | 39 namespace dart { |
40 | 40 |
41 DEFINE_FLAG(bool, enable_debug_break, false, "Allow use of break \"message\"."); | 41 DEFINE_FLAG(bool, enable_debug_break, false, "Allow use of break \"message\"."); |
42 DEFINE_FLAG(bool, enable_mirrors, true, | 42 DEFINE_FLAG(bool, enable_mirrors, true, |
43 "Disable to make importing dart:mirrors an error."); | 43 "Disable to make importing dart:mirrors an error."); |
44 DEFINE_FLAG(bool, load_deferred_eagerly, false, | 44 DEFINE_FLAG(bool, load_deferred_eagerly, false, |
45 "Load deferred libraries eagerly."); | 45 "Load deferred libraries eagerly."); |
46 DEFINE_FLAG(bool, trace_parser, false, "Trace parser operations."); | 46 DEFINE_FLAG(bool, trace_parser, false, "Trace parser operations."); |
47 DEFINE_FLAG(bool, supermixin, false, "Allow super calls in mixins."); | |
48 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."); |
49 DEFINE_FLAG(bool, link_natives_lazily, false, "Link native calls lazily"); | 48 DEFINE_FLAG(bool, link_natives_lazily, false, "Link native calls lazily"); |
50 | 49 |
51 DECLARE_FLAG(bool, lazy_dispatchers); | 50 DECLARE_FLAG(bool, lazy_dispatchers); |
52 DECLARE_FLAG(bool, load_deferred_eagerly); | 51 DECLARE_FLAG(bool, load_deferred_eagerly); |
53 DECLARE_FLAG(bool, profile_vm); | 52 DECLARE_FLAG(bool, profile_vm); |
54 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); | 53 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); |
55 DECLARE_FLAG(bool, warn_on_javascript_compatibility); | 54 DECLARE_FLAG(bool, warn_on_javascript_compatibility); |
56 | 55 |
57 // Quick access to the current thread, isolate and zone. | 56 // Quick access to the current thread, isolate and zone. |
(...skipping 13778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13836 } else if (token == Token::kHASH) { | 13835 } else if (token == Token::kHASH) { |
13837 primary = ParseSymbolLiteral(); | 13836 primary = ParseSymbolLiteral(); |
13838 } else if (token == Token::kSUPER) { | 13837 } else if (token == Token::kSUPER) { |
13839 if (current_function().is_static()) { | 13838 if (current_function().is_static()) { |
13840 ReportError("cannot access superclass from static method"); | 13839 ReportError("cannot access superclass from static method"); |
13841 } | 13840 } |
13842 if (current_class().SuperClass() == Class::null()) { | 13841 if (current_class().SuperClass() == Class::null()) { |
13843 ReportError("class '%s' does not have a superclass", | 13842 ReportError("class '%s' does not have a superclass", |
13844 String::Handle(Z, current_class().Name()).ToCString()); | 13843 String::Handle(Z, current_class().Name()).ToCString()); |
13845 } | 13844 } |
13846 if (!FLAG_supermixin) { | |
13847 if (current_class().IsMixinApplication()) { | |
13848 const Type& mixin_type = Type::Handle(Z, current_class().mixin()); | |
13849 if (mixin_type.type_class() == current_function().origin()) { | |
13850 ReportError("method of mixin class '%s' may not refer to 'super'", | |
13851 String::Handle(Z, Class::Handle(Z, | |
13852 current_function().origin()).Name()).ToCString()); | |
13853 } | |
13854 } | |
13855 } | |
13856 const intptr_t super_pos = TokenPos(); | 13845 const intptr_t super_pos = TokenPos(); |
13857 ConsumeToken(); | 13846 ConsumeToken(); |
13858 if (CurrentToken() == Token::kPERIOD) { | 13847 if (CurrentToken() == Token::kPERIOD) { |
13859 ConsumeToken(); | 13848 ConsumeToken(); |
13860 const intptr_t ident_pos = TokenPos(); | 13849 const intptr_t ident_pos = TokenPos(); |
13861 const String& ident = *ExpectIdentifier("identifier expected"); | 13850 const String& ident = *ExpectIdentifier("identifier expected"); |
13862 if (CurrentToken() == Token::kLPAREN) { | 13851 if (CurrentToken() == Token::kLPAREN) { |
13863 primary = ParseSuperCall(ident); | 13852 primary = ParseSuperCall(ident); |
13864 } else { | 13853 } else { |
13865 primary = ParseSuperFieldAccess(ident, ident_pos); | 13854 primary = ParseSuperFieldAccess(ident, ident_pos); |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14272 void Parser::SkipQualIdent() { | 14261 void Parser::SkipQualIdent() { |
14273 ASSERT(IsIdentifier()); | 14262 ASSERT(IsIdentifier()); |
14274 ConsumeToken(); | 14263 ConsumeToken(); |
14275 if (CurrentToken() == Token::kPERIOD) { | 14264 if (CurrentToken() == Token::kPERIOD) { |
14276 ConsumeToken(); // Consume the kPERIOD token. | 14265 ConsumeToken(); // Consume the kPERIOD token. |
14277 ExpectIdentifier("identifier expected after '.'"); | 14266 ExpectIdentifier("identifier expected after '.'"); |
14278 } | 14267 } |
14279 } | 14268 } |
14280 | 14269 |
14281 } // namespace dart | 14270 } // namespace dart |
OLD | NEW |