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

Side by Side Diff: src/parser.cc

Issue 73072: Allow using with and eval in JS extensions in debug mode by... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 8 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/cctest/test-api.cc » ('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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 2074 matching lines...) Expand 10 before | Expand all | Expand 10 after
2085 2085
2086 2086
2087 Statement* Parser::ParseWithStatement(ZoneStringList* labels, bool* ok) { 2087 Statement* Parser::ParseWithStatement(ZoneStringList* labels, bool* ok) {
2088 // WithStatement :: 2088 // WithStatement ::
2089 // 'with' '(' Expression ')' Statement 2089 // 'with' '(' Expression ')' Statement
2090 2090
2091 // We do not allow the use of 'with' statements in the internal JS 2091 // We do not allow the use of 'with' statements in the internal JS
2092 // code. If 'with' statements were allowed, the simplified setup of 2092 // code. If 'with' statements were allowed, the simplified setup of
2093 // the runtime context chain would allow access to properties in the 2093 // the runtime context chain would allow access to properties in the
2094 // global object from within a 'with' statement. 2094 // global object from within a 'with' statement.
2095 ASSERT(!Bootstrapper::IsActive()); 2095 ASSERT(extension_ != NULL || !Bootstrapper::IsActive());
2096 2096
2097 Expect(Token::WITH, CHECK_OK); 2097 Expect(Token::WITH, CHECK_OK);
2098 Expect(Token::LPAREN, CHECK_OK); 2098 Expect(Token::LPAREN, CHECK_OK);
2099 Expression* expr = ParseExpression(true, CHECK_OK); 2099 Expression* expr = ParseExpression(true, CHECK_OK);
2100 Expect(Token::RPAREN, CHECK_OK); 2100 Expect(Token::RPAREN, CHECK_OK);
2101 2101
2102 return WithHelper(expr, labels, false, CHECK_OK); 2102 return WithHelper(expr, labels, false, CHECK_OK);
2103 } 2103 }
2104 2104
2105 2105
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
2754 2754
2755 bool is_potentially_direct_eval = false; 2755 bool is_potentially_direct_eval = false;
2756 if (!is_pre_parsing_) { 2756 if (!is_pre_parsing_) {
2757 VariableProxy* callee = result->AsVariableProxy(); 2757 VariableProxy* callee = result->AsVariableProxy();
2758 if (callee != NULL && callee->IsVariable(Factory::eval_symbol())) { 2758 if (callee != NULL && callee->IsVariable(Factory::eval_symbol())) {
2759 Handle<String> name = callee->name(); 2759 Handle<String> name = callee->name();
2760 Variable* var = top_scope_->Lookup(name); 2760 Variable* var = top_scope_->Lookup(name);
2761 if (var == NULL) { 2761 if (var == NULL) {
2762 // We do not allow direct calls to 'eval' in our internal 2762 // We do not allow direct calls to 'eval' in our internal
2763 // JS files. Use builtin functions instead. 2763 // JS files. Use builtin functions instead.
2764 ASSERT(!Bootstrapper::IsActive()); 2764 ASSERT(extension_ != NULL || !Bootstrapper::IsActive());
2765 top_scope_->RecordEvalCall(); 2765 top_scope_->RecordEvalCall();
2766 is_potentially_direct_eval = true; 2766 is_potentially_direct_eval = true;
2767 } 2767 }
2768 } 2768 }
2769 } 2769 }
2770 2770
2771 if (is_potentially_direct_eval) { 2771 if (is_potentially_direct_eval) {
2772 result = factory()->NewCallEval(result, args, pos); 2772 result = factory()->NewCallEval(result, args, pos);
2773 } else { 2773 } else {
2774 result = factory()->NewCall(result, args, pos); 2774 result = factory()->NewCall(result, args, pos);
(...skipping 1795 matching lines...) Expand 10 before | Expand all | Expand 10 after
4570 start_position, 4570 start_position,
4571 is_expression); 4571 is_expression);
4572 return result; 4572 return result;
4573 } 4573 }
4574 4574
4575 4575
4576 #undef NEW 4576 #undef NEW
4577 4577
4578 4578
4579 } } // namespace v8::internal 4579 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698