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

Side by Side Diff: src/preparser.h

Issue 1059273004: [strong] Implement static restrictions on direct eval (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: cr feedback Created 5 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_PREPARSER_H 5 #ifndef V8_PREPARSER_H
6 #define V8_PREPARSER_H 6 #define V8_PREPARSER_H
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/bailout-reason.h" 10 #include "src/bailout-reason.h"
(...skipping 2786 matching lines...) Expand 10 before | Expand all | Expand 10 after
2797 case Token::LBRACK: { 2797 case Token::LBRACK: {
2798 Consume(Token::LBRACK); 2798 Consume(Token::LBRACK);
2799 int pos = position(); 2799 int pos = position();
2800 ExpressionT index = ParseExpression(true, CHECK_OK); 2800 ExpressionT index = ParseExpression(true, CHECK_OK);
2801 result = factory()->NewProperty(result, index, pos); 2801 result = factory()->NewProperty(result, index, pos);
2802 Expect(Token::RBRACK, CHECK_OK); 2802 Expect(Token::RBRACK, CHECK_OK);
2803 break; 2803 break;
2804 } 2804 }
2805 2805
2806 case Token::LPAREN: { 2806 case Token::LPAREN: {
2807 if (is_strong(language_mode()) && this->IsIdentifier(result) &&
2808 this->IsEval(this->AsIdentifier(result))) {
2809 ReportMessage("strong_direct_eval");
2810 *ok = false;
2811 return this->EmptyExpression();
2812 }
2807 int pos; 2813 int pos;
2808 if (scanner()->current_token() == Token::IDENTIFIER) { 2814 if (scanner()->current_token() == Token::IDENTIFIER) {
2809 // For call of an identifier we want to report position of 2815 // For call of an identifier we want to report position of
2810 // the identifier as position of the call in the stack trace. 2816 // the identifier as position of the call in the stack trace.
2811 pos = position(); 2817 pos = position();
2812 } else { 2818 } else {
2813 // For other kinds of calls we record position of the parenthesis as 2819 // For other kinds of calls we record position of the parenthesis as
2814 // position of the call. Note that this is extremely important for 2820 // position of the call. Note that this is extremely important for
2815 // expressions of the form function(){...}() for which call position 2821 // expressions of the form function(){...}() for which call position
2816 // should not point to the closing brace otherwise it will intersect 2822 // should not point to the closing brace otherwise it will intersect
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
3461 *ok = false; 3467 *ok = false;
3462 return; 3468 return;
3463 } 3469 }
3464 has_seen_constructor_ = true; 3470 has_seen_constructor_ = true;
3465 return; 3471 return;
3466 } 3472 }
3467 } 3473 }
3468 } } // v8::internal 3474 } } // v8::internal
3469 3475
3470 #endif // V8_PREPARSER_H 3476 #endif // V8_PREPARSER_H
OLDNEW
« no previous file with comments | « src/messages.js ('k') | test/cctest/test-parsing.cc » ('j') | test/cctest/test-parsing.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698