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

Side by Side Diff: src/parser.cc

Issue 23098004: Add FINAL and OVERRIDE macros for C++11 final/override. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Autoconfied for Sven :-) Created 7 years, 4 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 | « src/mips/full-codegen-mips.cc ('k') | src/x64/full-codegen-x64.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 2301 matching lines...) Expand 10 before | Expand all | Expand 10 after
2312 tok == Token::EOS) { 2312 tok == Token::EOS) {
2313 return_value = GetLiteralUndefined(); 2313 return_value = GetLiteralUndefined();
2314 } else { 2314 } else {
2315 return_value = ParseExpression(true, CHECK_OK); 2315 return_value = ParseExpression(true, CHECK_OK);
2316 } 2316 }
2317 ExpectSemicolon(CHECK_OK); 2317 ExpectSemicolon(CHECK_OK);
2318 if (is_generator()) { 2318 if (is_generator()) {
2319 Expression* generator = factory()->NewVariableProxy( 2319 Expression* generator = factory()->NewVariableProxy(
2320 current_function_state_->generator_object_variable()); 2320 current_function_state_->generator_object_variable());
2321 Expression* yield = factory()->NewYield( 2321 Expression* yield = factory()->NewYield(
2322 generator, return_value, Yield::FINAL, RelocInfo::kNoPosition); 2322 generator, return_value, Yield::kFinal, RelocInfo::kNoPosition);
2323 result = factory()->NewExpressionStatement(yield); 2323 result = factory()->NewExpressionStatement(yield);
2324 } else { 2324 } else {
2325 result = factory()->NewReturnStatement(return_value); 2325 result = factory()->NewReturnStatement(return_value);
2326 } 2326 }
2327 2327
2328 // An ECMAScript program is considered syntactically incorrect if it 2328 // An ECMAScript program is considered syntactically incorrect if it
2329 // contains a return statement that is not within the body of a 2329 // contains a return statement that is not within the body of a
2330 // function. See ECMA-262, section 12.9, page 67. 2330 // function. See ECMA-262, section 12.9, page 67.
2331 // 2331 //
2332 // To be consistent with KJS we report the syntax error at runtime. 2332 // To be consistent with KJS we report the syntax error at runtime.
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
2990 return factory()->NewAssignment(op, expression, right, pos); 2990 return factory()->NewAssignment(op, expression, right, pos);
2991 } 2991 }
2992 2992
2993 2993
2994 Expression* Parser::ParseYieldExpression(bool* ok) { 2994 Expression* Parser::ParseYieldExpression(bool* ok) {
2995 // YieldExpression :: 2995 // YieldExpression ::
2996 // 'yield' '*'? AssignmentExpression 2996 // 'yield' '*'? AssignmentExpression
2997 int position = scanner().peek_location().beg_pos; 2997 int position = scanner().peek_location().beg_pos;
2998 Expect(Token::YIELD, CHECK_OK); 2998 Expect(Token::YIELD, CHECK_OK);
2999 Yield::Kind kind = 2999 Yield::Kind kind =
3000 Check(Token::MUL) ? Yield::DELEGATING : Yield::SUSPEND; 3000 Check(Token::MUL) ? Yield::kDelegating : Yield::kSuspend;
3001 Expression* generator_object = factory()->NewVariableProxy( 3001 Expression* generator_object = factory()->NewVariableProxy(
3002 current_function_state_->generator_object_variable()); 3002 current_function_state_->generator_object_variable());
3003 Expression* expression = ParseAssignmentExpression(false, CHECK_OK); 3003 Expression* expression = ParseAssignmentExpression(false, CHECK_OK);
3004 Yield* yield = 3004 Yield* yield =
3005 factory()->NewYield(generator_object, expression, kind, position); 3005 factory()->NewYield(generator_object, expression, kind, position);
3006 if (kind == Yield::DELEGATING) { 3006 if (kind == Yield::kDelegating) {
3007 yield->set_index(current_function_state_->NextHandlerIndex()); 3007 yield->set_index(current_function_state_->NextHandlerIndex());
3008 } 3008 }
3009 return yield; 3009 return yield;
3010 } 3010 }
3011 3011
3012 3012
3013 // Precedence = 3 3013 // Precedence = 3
3014 Expression* Parser::ParseConditionalExpression(bool accept_IN, bool* ok) { 3014 Expression* Parser::ParseConditionalExpression(bool accept_IN, bool* ok) {
3015 // ConditionalExpression :: 3015 // ConditionalExpression ::
3016 // LogicalOrExpression 3016 // LogicalOrExpression
(...skipping 1460 matching lines...) Expand 10 before | Expand all | Expand 10 after
4477 isolate()->factory()->empty_string(), 4477 isolate()->factory()->empty_string(),
4478 Runtime::FunctionForId(Runtime::kCreateJSGeneratorObject), 4478 Runtime::FunctionForId(Runtime::kCreateJSGeneratorObject),
4479 arguments); 4479 arguments);
4480 VariableProxy* init_proxy = factory()->NewVariableProxy( 4480 VariableProxy* init_proxy = factory()->NewVariableProxy(
4481 current_function_state_->generator_object_variable()); 4481 current_function_state_->generator_object_variable());
4482 Assignment* assignment = factory()->NewAssignment( 4482 Assignment* assignment = factory()->NewAssignment(
4483 Token::INIT_VAR, init_proxy, allocation, RelocInfo::kNoPosition); 4483 Token::INIT_VAR, init_proxy, allocation, RelocInfo::kNoPosition);
4484 VariableProxy* get_proxy = factory()->NewVariableProxy( 4484 VariableProxy* get_proxy = factory()->NewVariableProxy(
4485 current_function_state_->generator_object_variable()); 4485 current_function_state_->generator_object_variable());
4486 Yield* yield = factory()->NewYield( 4486 Yield* yield = factory()->NewYield(
4487 get_proxy, assignment, Yield::INITIAL, RelocInfo::kNoPosition); 4487 get_proxy, assignment, Yield::kInitial, RelocInfo::kNoPosition);
4488 body->Add(factory()->NewExpressionStatement(yield), zone()); 4488 body->Add(factory()->NewExpressionStatement(yield), zone());
4489 } 4489 }
4490 4490
4491 ParseSourceElements(body, Token::RBRACE, false, false, CHECK_OK); 4491 ParseSourceElements(body, Token::RBRACE, false, false, CHECK_OK);
4492 4492
4493 if (is_generator) { 4493 if (is_generator) {
4494 VariableProxy* get_proxy = factory()->NewVariableProxy( 4494 VariableProxy* get_proxy = factory()->NewVariableProxy(
4495 current_function_state_->generator_object_variable()); 4495 current_function_state_->generator_object_variable());
4496 Expression *undefined = factory()->NewLiteral( 4496 Expression *undefined = factory()->NewLiteral(
4497 isolate()->factory()->undefined_value()); 4497 isolate()->factory()->undefined_value());
4498 Yield* yield = factory()->NewYield( 4498 Yield* yield = factory()->NewYield(
4499 get_proxy, undefined, Yield::FINAL, RelocInfo::kNoPosition); 4499 get_proxy, undefined, Yield::kFinal, RelocInfo::kNoPosition);
4500 body->Add(factory()->NewExpressionStatement(yield), zone()); 4500 body->Add(factory()->NewExpressionStatement(yield), zone());
4501 } 4501 }
4502 4502
4503 materialized_literal_count = function_state.materialized_literal_count(); 4503 materialized_literal_count = function_state.materialized_literal_count();
4504 expected_property_count = function_state.expected_property_count(); 4504 expected_property_count = function_state.expected_property_count();
4505 handler_count = function_state.handler_count(); 4505 handler_count = function_state.handler_count();
4506 4506
4507 Expect(Token::RBRACE, CHECK_OK); 4507 Expect(Token::RBRACE, CHECK_OK);
4508 scope->set_end_position(scanner().location().end_pos); 4508 scope->set_end_position(scanner().location().end_pos);
4509 } 4509 }
(...skipping 1423 matching lines...) Expand 10 before | Expand all | Expand 10 after
5933 ASSERT(info()->isolate()->has_pending_exception()); 5933 ASSERT(info()->isolate()->has_pending_exception());
5934 } else { 5934 } else {
5935 result = ParseProgram(); 5935 result = ParseProgram();
5936 } 5936 }
5937 } 5937 }
5938 info()->SetFunction(result); 5938 info()->SetFunction(result);
5939 return (result != NULL); 5939 return (result != NULL);
5940 } 5940 }
5941 5941
5942 } } // namespace v8::internal 5942 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips/full-codegen-mips.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698