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

Side by Side Diff: src/parser.cc

Issue 9125001: Adjust position recorded for call expressions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 11 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.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 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 2985 matching lines...) Expand 10 before | Expand all | Expand 10 after
2996 case Token::LBRACK: { 2996 case Token::LBRACK: {
2997 Consume(Token::LBRACK); 2997 Consume(Token::LBRACK);
2998 int pos = scanner().location().beg_pos; 2998 int pos = scanner().location().beg_pos;
2999 Expression* index = ParseExpression(true, CHECK_OK); 2999 Expression* index = ParseExpression(true, CHECK_OK);
3000 result = new(zone()) Property(isolate(), result, index, pos); 3000 result = new(zone()) Property(isolate(), result, index, pos);
3001 Expect(Token::RBRACK, CHECK_OK); 3001 Expect(Token::RBRACK, CHECK_OK);
3002 break; 3002 break;
3003 } 3003 }
3004 3004
3005 case Token::LPAREN: { 3005 case Token::LPAREN: {
3006 int pos = scanner().location().beg_pos; 3006 int pos;
3007 if (scanner().current_token() == Token::IDENTIFIER) {
3008 // For call of an identifier we want to report position of
3009 // the identifier as position of the call in the stack trace.
3010 pos = scanner().location().beg_pos;
3011 } else {
3012 // For other kinds of calls we record position of the parenthesis as
3013 // position of the call. Note that this is extremely important for
3014 // expressions of the form function(){...}() for which call position
3015 // should not point to the closing brace otherwise it will intersect
3016 // with positions recorded for function literal and confuse debugger.
3017 pos = scanner().peek_location().beg_pos;
3018 }
3007 ZoneList<Expression*>* args = ParseArguments(CHECK_OK); 3019 ZoneList<Expression*>* args = ParseArguments(CHECK_OK);
3008 3020
3009 // Keep track of eval() calls since they disable all local variable 3021 // Keep track of eval() calls since they disable all local variable
3010 // optimizations. 3022 // optimizations.
3011 // The calls that need special treatment are the 3023 // The calls that need special treatment are the
3012 // direct eval calls. These calls are all of the form eval(...), with 3024 // direct eval calls. These calls are all of the form eval(...), with
3013 // no explicit receiver. 3025 // no explicit receiver.
3014 // These calls are marked as potentially direct eval calls. Whether 3026 // These calls are marked as potentially direct eval calls. Whether
3015 // they are actually direct calls to eval is determined at run time. 3027 // they are actually direct calls to eval is determined at run time.
3016 VariableProxy* callee = result->AsVariableProxy(); 3028 VariableProxy* callee = result->AsVariableProxy();
(...skipping 2660 matching lines...) Expand 10 before | Expand all | Expand 10 after
5677 ASSERT(info->isolate()->has_pending_exception()); 5689 ASSERT(info->isolate()->has_pending_exception());
5678 } else { 5690 } else {
5679 result = parser.ParseProgram(info); 5691 result = parser.ParseProgram(info);
5680 } 5692 }
5681 } 5693 }
5682 info->SetFunction(result); 5694 info->SetFunction(result);
5683 return (result != NULL); 5695 return (result != NULL);
5684 } 5696 }
5685 5697
5686 } } // namespace v8::internal 5698 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698