Chromium Code Reviews| 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 "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/compiler_stats.h" | 10 #include "vm/compiler_stats.h" |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 DEFINE_FLAG(bool, warning_as_error, false, "Treat warnings as errors."); | 30 DEFINE_FLAG(bool, warning_as_error, false, "Treat warnings as errors."); |
| 31 DEFINE_FLAG(bool, silent_warnings, false, "Silence warnings."); | 31 DEFINE_FLAG(bool, silent_warnings, false, "Silence warnings."); |
| 32 DEFINE_FLAG(bool, warn_legacy_map_literal, false, | 32 DEFINE_FLAG(bool, warn_legacy_map_literal, false, |
| 33 "Warning on legacy map literal syntax (single type argument)"); | 33 "Warning on legacy map literal syntax (single type argument)"); |
| 34 | 34 |
| 35 static void CheckedModeHandler(bool value) { | 35 static void CheckedModeHandler(bool value) { |
| 36 FLAG_enable_asserts = value; | 36 FLAG_enable_asserts = value; |
| 37 FLAG_enable_type_checks = value; | 37 FLAG_enable_type_checks = value; |
| 38 } | 38 } |
| 39 | 39 |
| 40 // --enable-checked-mode and --checked both enable checked mode which is | |
| 41 // equivalent to setting --enable-asserts and --enable-type-checks. | |
| 40 DEFINE_FLAG_HANDLER(CheckedModeHandler, | 42 DEFINE_FLAG_HANDLER(CheckedModeHandler, |
| 41 enable_checked_mode, | 43 enable_checked_mode, |
| 42 "Enable checked mode."); | 44 "Enable checked mode."); |
| 43 | 45 |
| 46 DEFINE_FLAG_HANDLER(CheckedModeHandler, | |
| 47 checked, | |
| 48 "Enabled checked mode."); | |
|
regis
2012/09/20 18:17:27
Enabled -> Enable
I fixed the same typo yesterday
Ivan Posva
2012/09/20 18:18:44
Done.
| |
| 49 | |
| 44 #if defined(DEBUG) | 50 #if defined(DEBUG) |
| 45 | |
| 46 class TraceParser : public ValueObject { | 51 class TraceParser : public ValueObject { |
| 47 public: | 52 public: |
| 48 TraceParser(intptr_t token_pos, const Script& script, const char* msg) { | 53 TraceParser(intptr_t token_pos, const Script& script, const char* msg) { |
| 49 if (FLAG_trace_parser) { | 54 if (FLAG_trace_parser) { |
| 50 // Skips tracing of bootstrap libraries. | 55 // Skips tracing of bootstrap libraries. |
| 51 if (script.HasSource()) { | 56 if (script.HasSource()) { |
| 52 intptr_t line, column; | 57 intptr_t line, column; |
| 53 script.GetTokenLocation(token_pos, &line, &column); | 58 script.GetTokenLocation(token_pos, &line, &column); |
| 54 PrintIndent(); | 59 PrintIndent(); |
| 55 OS::Print("%s (line %"Pd", col %"Pd", token %"Pd")\n", | 60 OS::Print("%s (line %"Pd", col %"Pd", token %"Pd")\n", |
| (...skipping 2764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2820 if ((member.type == NULL) && !member.has_factory) { | 2825 if ((member.type == NULL) && !member.has_factory) { |
| 2821 // We have not seen a member type yet, so we check if the next | 2826 // We have not seen a member type yet, so we check if the next |
| 2822 // identifier could represent a type before parsing it. | 2827 // identifier could represent a type before parsing it. |
| 2823 Token::Kind follower = LookaheadToken(1); | 2828 Token::Kind follower = LookaheadToken(1); |
| 2824 // We have an identifier followed by a 'follower' token. | 2829 // We have an identifier followed by a 'follower' token. |
| 2825 // We either parse a type or assume that no type is specified. | 2830 // We either parse a type or assume that no type is specified. |
| 2826 if ((follower == Token::kLT) || // Parameterized type. | 2831 if ((follower == Token::kLT) || // Parameterized type. |
| 2827 (follower == Token::kGET) || // Getter following a type. | 2832 (follower == Token::kGET) || // Getter following a type. |
| 2828 (follower == Token::kSET) || // Setter following a type. | 2833 (follower == Token::kSET) || // Setter following a type. |
| 2829 (follower == Token::kOPERATOR) || // Operator following a type. | 2834 (follower == Token::kOPERATOR) || // Operator following a type. |
| 2830 (Token::IsIdentifier(follower)) || // Member name following a type. | 2835 (Token::IsIdentifier(follower)) || // Member name following a type. |
| 2831 ((follower == Token::kPERIOD) && // Qualified class name of type, | 2836 ((follower == Token::kPERIOD) && // Qualified class name of type, |
| 2832 (LookaheadToken(3) != Token::kLPAREN))) { // but not a named constr. | 2837 (LookaheadToken(3) != Token::kLPAREN))) { // but not a named constr. |
| 2833 ASSERT(is_top_level_); | 2838 ASSERT(is_top_level_); |
| 2834 // The declared type of fields is never ignored, even in unchecked mode, | 2839 // The declared type of fields is never ignored, even in unchecked mode, |
| 2835 // because getters and setters could be closurized at some time (not | 2840 // because getters and setters could be closurized at some time (not |
| 2836 // supported yet). | 2841 // supported yet). |
| 2837 member.type = &AbstractType::ZoneHandle( | 2842 member.type = &AbstractType::ZoneHandle( |
| 2838 ParseType(ClassFinalizer::kTryResolve)); | 2843 ParseType(ClassFinalizer::kTryResolve)); |
| 2839 } | 2844 } |
| 2840 } | 2845 } |
| (...skipping 6669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9510 void Parser::SkipQualIdent() { | 9515 void Parser::SkipQualIdent() { |
| 9511 ASSERT(IsIdentifier()); | 9516 ASSERT(IsIdentifier()); |
| 9512 ConsumeToken(); | 9517 ConsumeToken(); |
| 9513 if (CurrentToken() == Token::kPERIOD) { | 9518 if (CurrentToken() == Token::kPERIOD) { |
| 9514 ConsumeToken(); // Consume the kPERIOD token. | 9519 ConsumeToken(); // Consume the kPERIOD token. |
| 9515 ExpectIdentifier("identifier expected after '.'"); | 9520 ExpectIdentifier("identifier expected after '.'"); |
| 9516 } | 9521 } |
| 9517 } | 9522 } |
| 9518 | 9523 |
| 9519 } // namespace dart | 9524 } // namespace dart |
| OLD | NEW |