Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 3770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3781 | 3781 |
| 3782 Expect(Token::LBRACE, CHECK_OK); | 3782 Expect(Token::LBRACE, CHECK_OK); |
| 3783 | 3783 |
| 3784 // If we have a named function expression, we add a local variable | 3784 // If we have a named function expression, we add a local variable |
| 3785 // declaration to the body of the function with the name of the | 3785 // declaration to the body of the function with the name of the |
| 3786 // function and let it refer to the function itself (closure). | 3786 // function and let it refer to the function itself (closure). |
| 3787 // NOTE: We create a proxy and resolve it here so that in the | 3787 // NOTE: We create a proxy and resolve it here so that in the |
| 3788 // future we can change the AST to only refer to VariableProxies | 3788 // future we can change the AST to only refer to VariableProxies |
| 3789 // instead of Variables and Proxis as is the case now. | 3789 // instead of Variables and Proxis as is the case now. |
| 3790 if (type == FunctionLiteral::NAMED_EXPRESSION) { | 3790 if (type == FunctionLiteral::NAMED_EXPRESSION) { |
| 3791 Variable* fvar = top_scope_->DeclareFunctionVar(function_name); | 3791 Variable* fvar = top_scope_->DeclareFunctionVar(function_name)->var(); |
|
Kevin Millikin (Chromium)
2011/09/01 15:40:58
You could keep DeclareFunctionVar returning a Vari
fschneider
2011/09/01 16:28:21
Done.
| |
| 3792 VariableProxy* fproxy = | 3792 VariableProxy* fproxy = |
| 3793 top_scope_->NewUnresolved(function_name, inside_with()); | 3793 top_scope_->NewUnresolved(function_name, inside_with()); |
| 3794 fproxy->BindTo(fvar); | 3794 fproxy->BindTo(fvar); |
| 3795 body->Add(new(zone()) ExpressionStatement( | 3795 body->Add(new(zone()) ExpressionStatement( |
| 3796 new(zone()) Assignment(isolate(), | 3796 new(zone()) Assignment(isolate(), |
| 3797 Token::INIT_CONST, | 3797 Token::INIT_CONST, |
| 3798 fproxy, | 3798 fproxy, |
| 3799 new(zone()) ThisFunction(isolate()), | 3799 new(zone()) ThisFunction(isolate()), |
| 3800 RelocInfo::kNoPosition))); | 3800 RelocInfo::kNoPosition))); |
| 3801 } | 3801 } |
| (...skipping 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5236 result = parser.ParseProgram(source, | 5236 result = parser.ParseProgram(source, |
| 5237 info->is_global(), | 5237 info->is_global(), |
| 5238 info->StrictMode()); | 5238 info->StrictMode()); |
| 5239 } | 5239 } |
| 5240 } | 5240 } |
| 5241 info->SetFunction(result); | 5241 info->SetFunction(result); |
| 5242 return (result != NULL); | 5242 return (result != NULL); |
| 5243 } | 5243 } |
| 5244 | 5244 |
| 5245 } } // namespace v8::internal | 5245 } } // namespace v8::internal |
| OLD | NEW |