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 2395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2406 int pos = position(); | 2406 int pos = position(); |
2407 ZoneList<Statement*>* statements = | 2407 ZoneList<Statement*>* statements = |
2408 new(zone()) ZoneList<Statement*>(5, zone()); | 2408 new(zone()) ZoneList<Statement*>(5, zone()); |
2409 while (peek() != Token::CASE && | 2409 while (peek() != Token::CASE && |
2410 peek() != Token::DEFAULT && | 2410 peek() != Token::DEFAULT && |
2411 peek() != Token::RBRACE) { | 2411 peek() != Token::RBRACE) { |
2412 Statement* stat = ParseStatement(NULL, CHECK_OK); | 2412 Statement* stat = ParseStatement(NULL, CHECK_OK); |
2413 statements->Add(stat, zone()); | 2413 statements->Add(stat, zone()); |
2414 } | 2414 } |
2415 | 2415 |
2416 return new(zone()) CaseClause(isolate(), label, statements, pos); | 2416 return factory()->NewCaseClause(label, statements, pos); |
2417 } | 2417 } |
2418 | 2418 |
2419 | 2419 |
2420 SwitchStatement* Parser::ParseSwitchStatement(ZoneStringList* labels, | 2420 SwitchStatement* Parser::ParseSwitchStatement(ZoneStringList* labels, |
2421 bool* ok) { | 2421 bool* ok) { |
2422 // SwitchStatement :: | 2422 // SwitchStatement :: |
2423 // 'switch' '(' Expression ')' '{' CaseClause* '}' | 2423 // 'switch' '(' Expression ')' '{' CaseClause* '}' |
2424 | 2424 |
2425 SwitchStatement* statement = | 2425 SwitchStatement* statement = |
2426 factory()->NewSwitchStatement(labels, peek_position()); | 2426 factory()->NewSwitchStatement(labels, peek_position()); |
(...skipping 3567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5994 ASSERT(info()->isolate()->has_pending_exception()); | 5994 ASSERT(info()->isolate()->has_pending_exception()); |
5995 } else { | 5995 } else { |
5996 result = ParseProgram(); | 5996 result = ParseProgram(); |
5997 } | 5997 } |
5998 } | 5998 } |
5999 info()->SetFunction(result); | 5999 info()->SetFunction(result); |
6000 return (result != NULL); | 6000 return (result != NULL); |
6001 } | 6001 } |
6002 | 6002 |
6003 } } // namespace v8::internal | 6003 } } // namespace v8::internal |
OLD | NEW |