| 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 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1399 // below. | 1399 // below. |
| 1400 // | 1400 // |
| 1401 // WARNING: This will lead to multiple declaration nodes for the | 1401 // WARNING: This will lead to multiple declaration nodes for the |
| 1402 // same variable if it is declared several times. This is not a | 1402 // same variable if it is declared several times. This is not a |
| 1403 // semantic issue as long as we keep the source order, but it may be | 1403 // semantic issue as long as we keep the source order, but it may be |
| 1404 // a performance issue since it may lead to repeated | 1404 // a performance issue since it may lead to repeated |
| 1405 // Runtime::DeclareContextSlot() calls. | 1405 // Runtime::DeclareContextSlot() calls. |
| 1406 VariableProxy* proxy = declaration_scope->NewUnresolved( | 1406 VariableProxy* proxy = declaration_scope->NewUnresolved( |
| 1407 factory(), name, scanner().location().beg_pos); | 1407 factory(), name, scanner().location().beg_pos); |
| 1408 declaration_scope->AddDeclaration( | 1408 declaration_scope->AddDeclaration( |
| 1409 factory()->NewDeclaration(proxy, mode, fun, top_scope_)); | 1409 factory()->NewVariableDeclaration(proxy, mode, fun, top_scope_)); |
| 1410 | 1410 |
| 1411 if ((mode == CONST || mode == CONST_HARMONY) && | 1411 if ((mode == CONST || mode == CONST_HARMONY) && |
| 1412 declaration_scope->is_global_scope()) { | 1412 declaration_scope->is_global_scope()) { |
| 1413 // For global const variables we bind the proxy to a variable. | 1413 // For global const variables we bind the proxy to a variable. |
| 1414 ASSERT(resolve); // should be set by all callers | 1414 ASSERT(resolve); // should be set by all callers |
| 1415 Variable::Kind kind = Variable::NORMAL; | 1415 Variable::Kind kind = Variable::NORMAL; |
| 1416 var = new(zone()) Variable(declaration_scope, | 1416 var = new(zone()) Variable(declaration_scope, |
| 1417 name, | 1417 name, |
| 1418 mode, | 1418 mode, |
| 1419 true, | 1419 true, |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1620 } | 1620 } |
| 1621 | 1621 |
| 1622 | 1622 |
| 1623 bool Parser::IsEvalOrArguments(Handle<String> string) { | 1623 bool Parser::IsEvalOrArguments(Handle<String> string) { |
| 1624 return string.is_identical_to(isolate()->factory()->eval_symbol()) || | 1624 return string.is_identical_to(isolate()->factory()->eval_symbol()) || |
| 1625 string.is_identical_to(isolate()->factory()->arguments_symbol()); | 1625 string.is_identical_to(isolate()->factory()->arguments_symbol()); |
| 1626 } | 1626 } |
| 1627 | 1627 |
| 1628 | 1628 |
| 1629 // If the variable declaration declares exactly one non-const | 1629 // If the variable declaration declares exactly one non-const |
| 1630 // variable, then *var is set to that variable. In all other cases, | 1630 // variable, then *out is set to that variable. In all other cases, |
| 1631 // *var is untouched; in particular, it is the caller's responsibility | 1631 // *out is untouched; in particular, it is the caller's responsibility |
| 1632 // to initialize it properly. This mechanism is used for the parsing | 1632 // to initialize it properly. This mechanism is used for the parsing |
| 1633 // of 'for-in' loops. | 1633 // of 'for-in' loops. |
| 1634 Block* Parser::ParseVariableDeclarations( | 1634 Block* Parser::ParseVariableDeclarations( |
| 1635 VariableDeclarationContext var_context, | 1635 VariableDeclarationContext var_context, |
| 1636 VariableDeclarationProperties* decl_props, | 1636 VariableDeclarationProperties* decl_props, |
| 1637 Handle<String>* out, | 1637 Handle<String>* out, |
| 1638 bool* ok) { | 1638 bool* ok) { |
| 1639 // VariableDeclarations :: | 1639 // VariableDeclarations :: |
| 1640 // ('var' | 'const' | 'let') (Identifier ('=' AssignmentExpression)?)+[','] | 1640 // ('var' | 'const' | 'let') (Identifier ('=' AssignmentExpression)?)+[','] |
| 1641 // | 1641 // |
| (...skipping 3969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5611 ASSERT(info->isolate()->has_pending_exception()); | 5611 ASSERT(info->isolate()->has_pending_exception()); |
| 5612 } else { | 5612 } else { |
| 5613 result = parser.ParseProgram(info); | 5613 result = parser.ParseProgram(info); |
| 5614 } | 5614 } |
| 5615 } | 5615 } |
| 5616 info->SetFunction(result); | 5616 info->SetFunction(result); |
| 5617 return (result != NULL); | 5617 return (result != NULL); |
| 5618 } | 5618 } |
| 5619 | 5619 |
| 5620 } } // namespace v8::internal | 5620 } } // namespace v8::internal |
| OLD | NEW |