OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 2110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2121 Expect(Token::BREAK, CHECK_OK); | 2121 Expect(Token::BREAK, CHECK_OK); |
2122 Handle<String> label; | 2122 Handle<String> label; |
2123 Token::Value tok = peek(); | 2123 Token::Value tok = peek(); |
2124 if (!scanner().HasAnyLineTerminatorBeforeNext() && | 2124 if (!scanner().HasAnyLineTerminatorBeforeNext() && |
2125 tok != Token::SEMICOLON && tok != Token::RBRACE && tok != Token::EOS) { | 2125 tok != Token::SEMICOLON && tok != Token::RBRACE && tok != Token::EOS) { |
2126 label = ParseIdentifier(CHECK_OK); | 2126 label = ParseIdentifier(CHECK_OK); |
2127 } | 2127 } |
2128 // Parse labeled break statements that target themselves into | 2128 // Parse labeled break statements that target themselves into |
2129 // empty statements, e.g. 'l1: l2: l3: break l2;' | 2129 // empty statements, e.g. 'l1: l2: l3: break l2;' |
2130 if (!label.is_null() && ContainsLabel(labels, label)) { | 2130 if (!label.is_null() && ContainsLabel(labels, label)) { |
2131 // Consume the 'break' SEMICOLON if present | |
2132 if (peek() == Token::SEMICOLON) { | |
2133 scanner().Next(); | |
2134 } | |
Lasse Reichstein Nielsen
2012/02/02 10:05:19
The semicolon *must* be there (or be inserted by a
| |
2131 return EmptyStatement(); | 2135 return EmptyStatement(); |
2132 } | 2136 } |
2133 BreakableStatement* target = NULL; | 2137 BreakableStatement* target = NULL; |
2134 target = LookupBreakTarget(label, CHECK_OK); | 2138 target = LookupBreakTarget(label, CHECK_OK); |
2135 if (target == NULL) { | 2139 if (target == NULL) { |
2136 // Illegal break statement. | 2140 // Illegal break statement. |
2137 const char* message = "illegal_break"; | 2141 const char* message = "illegal_break"; |
2138 Vector<Handle<String> > args; | 2142 Vector<Handle<String> > args; |
2139 if (!label.is_null()) { | 2143 if (!label.is_null()) { |
2140 message = "unknown_label"; | 2144 message = "unknown_label"; |
(...skipping 3548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5689 ASSERT(info->isolate()->has_pending_exception()); | 5693 ASSERT(info->isolate()->has_pending_exception()); |
5690 } else { | 5694 } else { |
5691 result = parser.ParseProgram(info); | 5695 result = parser.ParseProgram(info); |
5692 } | 5696 } |
5693 } | 5697 } |
5694 info->SetFunction(result); | 5698 info->SetFunction(result); |
5695 return (result != NULL); | 5699 return (result != NULL); |
5696 } | 5700 } |
5697 | 5701 |
5698 } } // namespace v8::internal | 5702 } } // namespace v8::internal |
OLD | NEW |