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

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

Issue 10910060: Disable all support for legacy try-catch in the VM. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
« 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 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"
11 #include "vm/dart_api_impl.h" 11 #include "vm/dart_api_impl.h"
12 #include "vm/dart_entry.h" 12 #include "vm/dart_entry.h"
13 #include "vm/flags.h" 13 #include "vm/flags.h"
14 #include "vm/growable_array.h" 14 #include "vm/growable_array.h"
15 #include "vm/longjump.h" 15 #include "vm/longjump.h"
16 #include "vm/native_entry.h" 16 #include "vm/native_entry.h"
17 #include "vm/object.h" 17 #include "vm/object.h"
18 #include "vm/object_store.h" 18 #include "vm/object_store.h"
19 #include "vm/resolver.h" 19 #include "vm/resolver.h"
20 #include "vm/scopes.h" 20 #include "vm/scopes.h"
21 #include "vm/symbols.h" 21 #include "vm/symbols.h"
22 22
23 namespace dart { 23 namespace dart {
24 24
25 DEFINE_FLAG(bool, enable_asserts, false, "Enable assert statements."); 25 DEFINE_FLAG(bool, enable_asserts, false, "Enable assert statements.");
26 DEFINE_FLAG(bool, enable_type_checks, false, "Enable type checks."); 26 DEFINE_FLAG(bool, enable_type_checks, false, "Enable type checks.");
27 DEFINE_FLAG(bool, trace_parser, false, "Trace parser operations."); 27 DEFINE_FLAG(bool, trace_parser, false, "Trace parser operations.");
28 DEFINE_FLAG(bool, warning_as_error, false, "Treat warnings as errors."); 28 DEFINE_FLAG(bool, warning_as_error, false, "Treat warnings as errors.");
29 DEFINE_FLAG(bool, silent_warnings, false, "Silence warnings."); 29 DEFINE_FLAG(bool, silent_warnings, false, "Silence warnings.");
30 DEFINE_FLAG(bool, warn_legacy_catch, false, "Warning on legacy catch syntax");
31 DEFINE_FLAG(bool, warn_legacy_map_literal, false, 30 DEFINE_FLAG(bool, warn_legacy_map_literal, false,
32 "Warning on legacy map literal syntax (single type argument)"); 31 "Warning on legacy map literal syntax (single type argument)");
33 32
34 static void CheckedModeHandler(bool value) { 33 static void CheckedModeHandler(bool value) {
35 FLAG_enable_asserts = value; 34 FLAG_enable_asserts = value;
36 FLAG_enable_type_checks = value; 35 FLAG_enable_type_checks = value;
37 } 36 }
38 37
39 DEFINE_FLAG_HANDLER(CheckedModeHandler, 38 DEFINE_FLAG_HANDLER(CheckedModeHandler,
40 enable_checked_mode, 39 enable_checked_mode,
(...skipping 5711 matching lines...) Expand 10 before | Expand all | Expand 10 after
5752 // New catch syntax for untyped exception variable: 5751 // New catch syntax for untyped exception variable:
5753 // catch(e) or catch (e,s). 5752 // catch(e) or catch (e,s).
5754 exception_param.is_final = true; 5753 exception_param.is_final = true;
5755 exception_param.type = 5754 exception_param.type =
5756 &AbstractType::ZoneHandle(Type::DynamicType()); 5755 &AbstractType::ZoneHandle(Type::DynamicType());
5757 exception_param.token_pos = TokenPos(); 5756 exception_param.token_pos = TokenPos();
5758 exception_param.var = ExpectIdentifier("identifier expected"); 5757 exception_param.var = ExpectIdentifier("identifier expected");
5759 if (CurrentToken() == Token::kCOMMA) { 5758 if (CurrentToken() == Token::kCOMMA) {
5760 ConsumeToken(); 5759 ConsumeToken();
5761 stack_trace_param.is_final = true; 5760 stack_trace_param.is_final = true;
5762 // TODO(hausner): Make imlicit type be StackTrace, not Dynamic. 5761 // TODO(hausner): Make implicit type be StackTrace, not Dynamic.
5763 stack_trace_param.type = 5762 stack_trace_param.type =
5764 &AbstractType::ZoneHandle(Type::DynamicType()); 5763 &AbstractType::ZoneHandle(Type::DynamicType());
5765 stack_trace_param.token_pos = TokenPos(); 5764 stack_trace_param.token_pos = TokenPos();
5766 stack_trace_param.var = ExpectIdentifier("identifier expected"); 5765 stack_trace_param.var = ExpectIdentifier("identifier expected");
5767 } 5766 }
5768 } else { 5767 } else {
5769 // TODO(hausner): Remove legacy syntax support. 5768 // TODO(hausner): Improve error message and maybe also the
5770 if (FLAG_warn_legacy_catch) { 5769 // structure of the code. Maybe you can get away with simply
5771 Warning("legacy catch syntax"); 5770 // expecting an identifier followed by a comma or a right
5772 } 5771 // parenthesis?
5773 ParseCatchParameter(&exception_param); 5772 ErrorMsg("identifier expected here, not type, final, or var");
5774 if (CurrentToken() == Token::kCOMMA) {
5775 ConsumeToken();
5776 ParseCatchParameter(&stack_trace_param);
5777 }
5778 } 5773 }
5779 } else { 5774 } else {
5780 // on T catch(e) { ... 5775 // on T catch(e) { ...
5781 ConsumeToken(); // on 5776 ConsumeToken(); // on
5782 exception_param.is_final = true; 5777 exception_param.is_final = true;
5783 exception_param.type = &AbstractType::ZoneHandle( 5778 exception_param.type = &AbstractType::ZoneHandle(
5784 ParseType(ClassFinalizer::kCanonicalizeWellFormed)); 5779 ParseType(ClassFinalizer::kCanonicalizeWellFormed));
5785 ExpectToken(Token::kCATCH); 5780 ExpectToken(Token::kCATCH);
5786 ExpectToken(Token::kLPAREN); 5781 ExpectToken(Token::kLPAREN);
5787 exception_param.token_pos = TokenPos(); 5782 exception_param.token_pos = TokenPos();
(...skipping 3594 matching lines...) Expand 10 before | Expand all | Expand 10 after
9382 void Parser::SkipQualIdent() { 9377 void Parser::SkipQualIdent() {
9383 ASSERT(IsIdentifier()); 9378 ASSERT(IsIdentifier());
9384 ConsumeToken(); 9379 ConsumeToken();
9385 if (CurrentToken() == Token::kPERIOD) { 9380 if (CurrentToken() == Token::kPERIOD) {
9386 ConsumeToken(); // Consume the kPERIOD token. 9381 ConsumeToken(); // Consume the kPERIOD token.
9387 ExpectIdentifier("identifier expected after '.'"); 9382 ExpectIdentifier("identifier expected after '.'");
9388 } 9383 }
9389 } 9384 }
9390 9385
9391 } // namespace dart 9386 } // namespace dart
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