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

Side by Side Diff: src/parser.cc

Issue 8306025: Disallow function declarations in statement positions in harmony mode. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 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/harmony/block-let-declaration.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 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after
1327 } 1327 }
1328 1328
1329 case Token::FUNCTION: { 1329 case Token::FUNCTION: {
1330 // FunctionDeclaration is only allowed in the context of SourceElements 1330 // FunctionDeclaration is only allowed in the context of SourceElements
1331 // (Ecma 262 5th Edition, clause 14): 1331 // (Ecma 262 5th Edition, clause 14):
1332 // SourceElement: 1332 // SourceElement:
1333 // Statement 1333 // Statement
1334 // FunctionDeclaration 1334 // FunctionDeclaration
1335 // Common language extension is to allow function declaration in place 1335 // Common language extension is to allow function declaration in place
1336 // of any statement. This language extension is disabled in strict mode. 1336 // of any statement. This language extension is disabled in strict mode.
1337 if (top_scope_->is_strict_mode()) { 1337 if (top_scope_->is_strict_mode() || harmony_scoping_) {
Lasse Reichstein 2011/10/17 11:31:45 Ditto for the preparser?
Steven 2011/10/17 11:57:22 Oops, indeed. Done. On 2011/10/17 11:31:45, Lasse
1338 ReportMessageAt(scanner().peek_location(), "strict_function", 1338 ReportMessageAt(scanner().peek_location(), "strict_function",
1339 Vector<const char*>::empty()); 1339 Vector<const char*>::empty());
1340 *ok = false; 1340 *ok = false;
1341 return NULL; 1341 return NULL;
1342 } 1342 }
1343 return ParseFunctionDeclaration(ok); 1343 return ParseFunctionDeclaration(ok);
1344 } 1344 }
1345 1345
1346 case Token::DEBUGGER: 1346 case Token::DEBUGGER:
1347 stmt = ParseDebuggerStatement(ok); 1347 stmt = ParseDebuggerStatement(ok);
(...skipping 3882 matching lines...) Expand 10 before | Expand all | Expand 10 after
5230 result = parser.ParseProgram(source, 5230 result = parser.ParseProgram(source,
5231 info->is_global(), 5231 info->is_global(),
5232 info->StrictMode()); 5232 info->StrictMode());
5233 } 5233 }
5234 } 5234 }
5235 info->SetFunction(result); 5235 info->SetFunction(result);
5236 return (result != NULL); 5236 return (result != NULL);
5237 } 5237 }
5238 5238
5239 } } // namespace v8::internal 5239 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/harmony/block-let-declaration.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698