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 2825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2836 // <let x' be a temporary variable> | 2836 // <let x' be a temporary variable> |
2837 // for (x' in e) { | 2837 // for (x' in e) { |
2838 // let x; | 2838 // let x; |
2839 // x = x'; | 2839 // x = x'; |
2840 // b; | 2840 // b; |
2841 // } | 2841 // } |
2842 | 2842 |
2843 // TODO(keuchel): Move the temporary variable to the block scope, after | 2843 // TODO(keuchel): Move the temporary variable to the block scope, after |
2844 // implementing stack allocated block scoped variables. | 2844 // implementing stack allocated block scoped variables. |
2845 Factory* heap_factory = isolate()->factory(); | 2845 Factory* heap_factory = isolate()->factory(); |
2846 Handle<String> dot = | 2846 Handle<String> tempstr = |
2847 heap_factory->NewStringFromAscii(CStrVector(".for.")); | 2847 heap_factory->NewConsString(heap_factory->dot_for_symbol(), name); |
2848 Handle<String> tempstr = heap_factory->NewConsString(dot, name); | |
2849 Handle<String> tempname = heap_factory->LookupSymbol(tempstr); | 2848 Handle<String> tempname = heap_factory->LookupSymbol(tempstr); |
2850 Variable* temp = top_scope_->DeclarationScope()->NewTemporary(tempname); | 2849 Variable* temp = top_scope_->DeclarationScope()->NewTemporary(tempname); |
2851 VariableProxy* temp_proxy = factory()->NewVariableProxy(temp); | 2850 VariableProxy* temp_proxy = factory()->NewVariableProxy(temp); |
2852 ForInStatement* loop = factory()->NewForInStatement(labels); | 2851 ForInStatement* loop = factory()->NewForInStatement(labels); |
2853 Target target(&this->target_stack_, loop); | 2852 Target target(&this->target_stack_, loop); |
2854 | 2853 |
2855 // The expression does not see the loop variable. | 2854 // The expression does not see the loop variable. |
2856 Expect(Token::IN, CHECK_OK); | 2855 Expect(Token::IN, CHECK_OK); |
2857 top_scope_ = saved_scope; | 2856 top_scope_ = saved_scope; |
2858 Expression* enumerable = ParseExpression(true, CHECK_OK); | 2857 Expression* enumerable = ParseExpression(true, CHECK_OK); |
(...skipping 3122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5981 ASSERT(info->isolate()->has_pending_exception()); | 5980 ASSERT(info->isolate()->has_pending_exception()); |
5982 } else { | 5981 } else { |
5983 result = parser.ParseProgram(); | 5982 result = parser.ParseProgram(); |
5984 } | 5983 } |
5985 } | 5984 } |
5986 info->SetFunction(result); | 5985 info->SetFunction(result); |
5987 return (result != NULL); | 5986 return (result != NULL); |
5988 } | 5987 } |
5989 | 5988 |
5990 } } // namespace v8::internal | 5989 } } // namespace v8::internal |
OLD | NEW |