OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/parsing/parser.h" | 5 #include "src/parsing/parser.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/ast/ast-expression-rewriter.h" | 9 #include "src/ast/ast-expression-rewriter.h" |
10 #include "src/ast/ast-expression-visitor.h" | 10 #include "src/ast/ast-expression-visitor.h" |
(...skipping 2013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2024 !IsLexicalVariableMode(mode)) { | 2024 !IsLexicalVariableMode(mode)) { |
2025 // In a var binding in a sloppy direct eval, pollute the enclosing scope | 2025 // In a var binding in a sloppy direct eval, pollute the enclosing scope |
2026 // with this new binding by doing the following: | 2026 // with this new binding by doing the following: |
2027 // The proxy is bound to a lookup variable to force a dynamic declaration | 2027 // The proxy is bound to a lookup variable to force a dynamic declaration |
2028 // using the DeclareLookupSlot runtime function. | 2028 // using the DeclareLookupSlot runtime function. |
2029 Variable::Kind kind = Variable::NORMAL; | 2029 Variable::Kind kind = Variable::NORMAL; |
2030 // TODO(sigurds) figure out if kNotAssigned is OK here | 2030 // TODO(sigurds) figure out if kNotAssigned is OK here |
2031 var = new (zone()) Variable(declaration_scope, name, mode, kind, | 2031 var = new (zone()) Variable(declaration_scope, name, mode, kind, |
2032 declaration->initialization(), kNotAssigned); | 2032 declaration->initialization(), kNotAssigned); |
2033 var->AllocateTo(VariableLocation::LOOKUP, -1); | 2033 var->AllocateTo(VariableLocation::LOOKUP, -1); |
2034 var->SetFromEval(); | |
2035 resolve = true; | 2034 resolve = true; |
2036 } | 2035 } |
2037 | 2036 |
2038 | 2037 |
2039 // We add a declaration node for every declaration. The compiler | 2038 // We add a declaration node for every declaration. The compiler |
2040 // will only generate code if necessary. In particular, declarations | 2039 // will only generate code if necessary. In particular, declarations |
2041 // for inner local variables that do not represent functions won't | 2040 // for inner local variables that do not represent functions won't |
2042 // result in any generated code. | 2041 // result in any generated code. |
2043 // | 2042 // |
2044 // Note that we always add an unresolved proxy even if it's not | 2043 // Note that we always add an unresolved proxy even if it's not |
(...skipping 4928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6973 try_block, target); | 6972 try_block, target); |
6974 final_loop = target; | 6973 final_loop = target; |
6975 } | 6974 } |
6976 | 6975 |
6977 return final_loop; | 6976 return final_loop; |
6978 } | 6977 } |
6979 | 6978 |
6980 | 6979 |
6981 } // namespace internal | 6980 } // namespace internal |
6982 } // namespace v8 | 6981 } // namespace v8 |
OLD | NEW |