OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1460 matching lines...) Loading... | |
1471 // Block :: | 1471 // Block :: |
1472 // '{' Statement* '}' | 1472 // '{' Statement* '}' |
1473 | 1473 |
1474 // Note that a Block does not introduce a new execution scope! | 1474 // Note that a Block does not introduce a new execution scope! |
1475 // (ECMA-262, 3rd, 12.2) | 1475 // (ECMA-262, 3rd, 12.2) |
1476 // | 1476 // |
1477 // Construct block expecting 16 statements. | 1477 // Construct block expecting 16 statements. |
1478 Block* result = new(zone()) Block(labels, 16, false); | 1478 Block* result = new(zone()) Block(labels, 16, false); |
1479 Target target(&this->target_stack_, result); | 1479 Target target(&this->target_stack_, result); |
1480 Expect(Token::LBRACE, CHECK_OK); | 1480 Expect(Token::LBRACE, CHECK_OK); |
1481 InitializationBlockFinder block_finder; | |
1481 while (peek() != Token::RBRACE) { | 1482 while (peek() != Token::RBRACE) { |
1482 Statement* stat = ParseStatement(NULL, CHECK_OK); | 1483 Statement* stat = ParseStatement(NULL, CHECK_OK); |
1483 if (stat && !stat->IsEmpty()) result->AddStatement(stat); | 1484 if (stat && !stat->IsEmpty()) { |
1485 result->AddStatement(stat); | |
1486 if (top_scope_->is_global_scope()) { | |
Vyacheslav Egorov (Chromium)
2011/07/06 13:07:51
I think this if needs the same kind of comment it
Kevin Millikin (Chromium)
2011/07/06 13:15:03
I think it needs to be top_scope_->DeclarationScop
| |
1487 block_finder.Update(stat); | |
1488 } | |
1489 } | |
1484 } | 1490 } |
1485 Expect(Token::RBRACE, CHECK_OK); | 1491 Expect(Token::RBRACE, CHECK_OK); |
1486 return result; | 1492 return result; |
1487 } | 1493 } |
1488 | 1494 |
1489 | 1495 |
1490 Block* Parser::ParseVariableStatement(bool* ok) { | 1496 Block* Parser::ParseVariableStatement(bool* ok) { |
1491 // VariableStatement :: | 1497 // VariableStatement :: |
1492 // VariableDeclarations ';' | 1498 // VariableDeclarations ';' |
1493 | 1499 |
(...skipping 3573 matching lines...) Loading... | |
5067 info->is_global(), | 5073 info->is_global(), |
5068 info->StrictMode()); | 5074 info->StrictMode()); |
5069 } | 5075 } |
5070 } | 5076 } |
5071 | 5077 |
5072 info->SetFunction(result); | 5078 info->SetFunction(result); |
5073 return (result != NULL); | 5079 return (result != NULL); |
5074 } | 5080 } |
5075 | 5081 |
5076 } } // namespace v8::internal | 5082 } } // namespace v8::internal |
OLD | NEW |