Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(431)

Side by Side Diff: src/parser.cc

Issue 7548011: Fix a bug in scope analysis. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix syntax error :( Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-91120.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3623 matching lines...) Expand 10 before | Expand all | Expand 10 after
3634 // that case, we don't have a function name (it's empty). 3634 // that case, we don't have a function name (it's empty).
3635 Handle<String> name = 3635 Handle<String> name =
3636 is_named ? var_name : isolate()->factory()->empty_symbol(); 3636 is_named ? var_name : isolate()->factory()->empty_symbol();
3637 // The function name, if any. 3637 // The function name, if any.
3638 Handle<String> function_name = isolate()->factory()->empty_symbol(); 3638 Handle<String> function_name = isolate()->factory()->empty_symbol();
3639 if (is_named && (type == EXPRESSION || type == NESTED)) { 3639 if (is_named && (type == EXPRESSION || type == NESTED)) {
3640 function_name = name; 3640 function_name = name;
3641 } 3641 }
3642 3642
3643 int num_parameters = 0; 3643 int num_parameters = 0;
3644 Scope* scope = NewScope(top_scope_, Scope::FUNCTION_SCOPE, inside_with()); 3644 // Function declarations are hoisted.
3645 Scope* scope = (type == DECLARATION)
3646 ? NewScope(top_scope_->DeclarationScope(), Scope::FUNCTION_SCOPE, false)
3647 : NewScope(top_scope_, Scope::FUNCTION_SCOPE, inside_with());
3645 ZoneList<Statement*>* body = new(zone()) ZoneList<Statement*>(8); 3648 ZoneList<Statement*>* body = new(zone()) ZoneList<Statement*>(8);
3646 int materialized_literal_count; 3649 int materialized_literal_count;
3647 int expected_property_count; 3650 int expected_property_count;
3648 int start_pos; 3651 int start_pos;
3649 int end_pos; 3652 int end_pos;
3650 bool only_simple_this_property_assignments; 3653 bool only_simple_this_property_assignments;
3651 Handle<FixedArray> this_property_assignments; 3654 Handle<FixedArray> this_property_assignments;
3652 bool has_duplicate_parameters = false; 3655 bool has_duplicate_parameters = false;
3653 // Parse function body. 3656 // Parse function body.
3654 { LexicalScope lexical_scope(this, scope, isolate()); 3657 { LexicalScope lexical_scope(this, scope, isolate());
(...skipping 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after
5111 info->is_global(), 5114 info->is_global(),
5112 info->StrictMode()); 5115 info->StrictMode());
5113 } 5116 }
5114 } 5117 }
5115 5118
5116 info->SetFunction(result); 5119 info->SetFunction(result);
5117 return (result != NULL); 5120 return (result != NULL);
5118 } 5121 }
5119 5122
5120 } } // namespace v8::internal 5123 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-91120.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698