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 2956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2967 // <let x' be a temporary variable> | 2967 // <let x' be a temporary variable> |
2968 // for (x' in e) { | 2968 // for (x' in e) { |
2969 // let x; | 2969 // let x; |
2970 // x = x'; | 2970 // x = x'; |
2971 // b; | 2971 // b; |
2972 // } | 2972 // } |
2973 | 2973 |
2974 // TODO(keuchel): Move the temporary variable to the block scope, after | 2974 // TODO(keuchel): Move the temporary variable to the block scope, after |
2975 // implementing stack allocated block scoped variables. | 2975 // implementing stack allocated block scoped variables. |
2976 Factory* heap_factory = isolate()->factory(); | 2976 Factory* heap_factory = isolate()->factory(); |
2977 Handle<String> tempstr = | 2977 Handle<String> tempstr; |
2978 heap_factory->NewConsString(heap_factory->dot_for_string(), name); | 2978 ASSIGN_RETURN_ON_EXCEPTION_VALUE( |
2979 RETURN_IF_EMPTY_HANDLE_VALUE(isolate(), tempstr, 0); | 2979 isolate(), tempstr, |
| 2980 heap_factory->NewConsString(heap_factory->dot_for_string(), name), |
| 2981 0); |
2980 Handle<String> tempname = heap_factory->InternalizeString(tempstr); | 2982 Handle<String> tempname = heap_factory->InternalizeString(tempstr); |
2981 Variable* temp = scope_->DeclarationScope()->NewTemporary(tempname); | 2983 Variable* temp = scope_->DeclarationScope()->NewTemporary(tempname); |
2982 VariableProxy* temp_proxy = factory()->NewVariableProxy(temp); | 2984 VariableProxy* temp_proxy = factory()->NewVariableProxy(temp); |
2983 ForEachStatement* loop = | 2985 ForEachStatement* loop = |
2984 factory()->NewForEachStatement(mode, labels, pos); | 2986 factory()->NewForEachStatement(mode, labels, pos); |
2985 Target target(&this->target_stack_, loop); | 2987 Target target(&this->target_stack_, loop); |
2986 | 2988 |
2987 // The expression does not see the loop variable. | 2989 // The expression does not see the loop variable. |
2988 scope_ = saved_scope; | 2990 scope_ = saved_scope; |
2989 Expression* enumerable = ParseExpression(true, CHECK_OK); | 2991 Expression* enumerable = ParseExpression(true, CHECK_OK); |
(...skipping 1686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4676 ASSERT(info()->isolate()->has_pending_exception()); | 4678 ASSERT(info()->isolate()->has_pending_exception()); |
4677 } else { | 4679 } else { |
4678 result = ParseProgram(); | 4680 result = ParseProgram(); |
4679 } | 4681 } |
4680 } | 4682 } |
4681 info()->SetFunction(result); | 4683 info()->SetFunction(result); |
4682 return (result != NULL); | 4684 return (result != NULL); |
4683 } | 4685 } |
4684 | 4686 |
4685 } } // namespace v8::internal | 4687 } } // namespace v8::internal |
OLD | NEW |