OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1575 // same variable if it is declared several times. This is not a | 1575 // same variable if it is declared several times. This is not a |
1576 // semantic issue as long as we keep the source order, but it may be | 1576 // semantic issue as long as we keep the source order, but it may be |
1577 // a performance issue since it may lead to repeated | 1577 // a performance issue since it may lead to repeated |
1578 // Runtime::DeclareContextSlot() calls. | 1578 // Runtime::DeclareContextSlot() calls. |
1579 VariableProxy* proxy = top_scope_->NewUnresolved(name, inside_with()); | 1579 VariableProxy* proxy = top_scope_->NewUnresolved(name, inside_with()); |
1580 top_scope_->AddDeclaration(NEW(Declaration(proxy, mode, fun))); | 1580 top_scope_->AddDeclaration(NEW(Declaration(proxy, mode, fun))); |
1581 | 1581 |
1582 // For global const variables we bind the proxy to a variable. | 1582 // For global const variables we bind the proxy to a variable. |
1583 if (mode == Variable::CONST && top_scope_->is_global_scope()) { | 1583 if (mode == Variable::CONST && top_scope_->is_global_scope()) { |
1584 ASSERT(resolve); // should be set by all callers | 1584 ASSERT(resolve); // should be set by all callers |
1585 var = NEW(Variable(top_scope_, name, Variable::CONST, true, false)); | 1585 Variable::Kind kind = Variable::NORMAL; |
| 1586 var = NEW(Variable(top_scope_, name, Variable::CONST, true, kind)); |
1586 } | 1587 } |
1587 | 1588 |
1588 // If requested and we have a local variable, bind the proxy to the variable | 1589 // If requested and we have a local variable, bind the proxy to the variable |
1589 // at parse-time. This is used for functions (and consts) declared inside | 1590 // at parse-time. This is used for functions (and consts) declared inside |
1590 // statements: the corresponding function (or const) variable must be in the | 1591 // statements: the corresponding function (or const) variable must be in the |
1591 // function scope and not a statement-local scope, e.g. as provided with a | 1592 // function scope and not a statement-local scope, e.g. as provided with a |
1592 // 'with' statement: | 1593 // 'with' statement: |
1593 // | 1594 // |
1594 // with (obj) { | 1595 // with (obj) { |
1595 // function f() {} | 1596 // function f() {} |
(...skipping 3049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4645 start_position, | 4646 start_position, |
4646 is_expression); | 4647 is_expression); |
4647 return result; | 4648 return result; |
4648 } | 4649 } |
4649 | 4650 |
4650 | 4651 |
4651 #undef NEW | 4652 #undef NEW |
4652 | 4653 |
4653 | 4654 |
4654 } } // namespace v8::internal | 4655 } } // namespace v8::internal |
OLD | NEW |