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

Side by Side Diff: src/parser.cc

Issue 7904008: Introduce with scope and rework variable resolution. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 3 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 | src/scopes.h » ('j') | src/scopes.h » ('J')
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 2062 matching lines...) Expand 10 before | Expand all | Expand 10 after
2073 *ok = false; 2073 *ok = false;
2074 return NULL; 2074 return NULL;
2075 } 2075 }
2076 2076
2077 Expect(Token::LPAREN, CHECK_OK); 2077 Expect(Token::LPAREN, CHECK_OK);
2078 Expression* expr = ParseExpression(true, CHECK_OK); 2078 Expression* expr = ParseExpression(true, CHECK_OK);
2079 Expect(Token::RPAREN, CHECK_OK); 2079 Expect(Token::RPAREN, CHECK_OK);
2080 2080
2081 ++with_nesting_level_; 2081 ++with_nesting_level_;
2082 top_scope_->DeclarationScope()->RecordWithStatement(); 2082 top_scope_->DeclarationScope()->RecordWithStatement();
2083 Scope* saved_scope = top_scope_;
Kevin Millikin (Chromium) 2011/09/15 09:38:13 Now that we have three or four places using this p
Steven 2011/09/15 19:54:06 Done.
2084 Scope* with_scope = NewScope(top_scope_, Scope::WITH_SCOPE, true);
2085 top_scope_ = with_scope;
2083 Statement* stmt = ParseStatement(labels, CHECK_OK); 2086 Statement* stmt = ParseStatement(labels, CHECK_OK);
2087 top_scope_ = saved_scope;
2084 --with_nesting_level_; 2088 --with_nesting_level_;
2085 return new(zone()) WithStatement(expr, stmt); 2089 return new(zone()) WithStatement(expr, stmt);
2086 } 2090 }
2087 2091
2088 2092
2089 CaseClause* Parser::ParseCaseClause(bool* default_seen_ptr, bool* ok) { 2093 CaseClause* Parser::ParseCaseClause(bool* default_seen_ptr, bool* ok) {
2090 // CaseClause :: 2094 // CaseClause ::
2091 // 'case' Expression ':' Statement* 2095 // 'case' Expression ':' Statement*
2092 // 'default' ':' Statement* 2096 // 'default' ':' Statement*
2093 2097
(...skipping 3129 matching lines...) Expand 10 before | Expand all | Expand 10 after
5223 result = parser.ParseProgram(source, 5227 result = parser.ParseProgram(source,
5224 info->is_global(), 5228 info->is_global(),
5225 info->StrictMode()); 5229 info->StrictMode());
5226 } 5230 }
5227 } 5231 }
5228 info->SetFunction(result); 5232 info->SetFunction(result);
5229 return (result != NULL); 5233 return (result != NULL);
5230 } 5234 }
5231 5235
5232 } } // namespace v8::internal 5236 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/scopes.h » ('j') | src/scopes.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698