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

Unified Diff: src/parser.cc

Issue 6815006: [Arguments] Mark functions with duplicated parameters. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/arguments
Patch Set: Moved bit from scope to function literal. Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects-inl.h ('k') | src/scopes.h » ('j') | src/scopes.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index 22d4d3f1fe0ed9b101e2d666b1928f219f1c650d..06668a0a6234c99aa6f0f67967e27e583fca2138 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -1,4 +1,4 @@
-// Copyright 2010 the V8 project authors. All rights reserved.
+// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -665,7 +665,8 @@ FunctionLiteral* Parser::DoParseProgram(Handle<String> source,
0,
source->length(),
false,
- lexical_scope.ContainsLoops());
+ lexical_scope.ContainsLoops(),
+ false);
} else if (stack_overflow_) {
isolate()->StackOverflow();
}
@@ -3545,6 +3546,7 @@ FunctionLiteral* Parser::ParseFunctionLiteral(Handle<String> var_name,
Scanner::Location name_loc = Scanner::NoLocation();
Scanner::Location dupe_loc = Scanner::NoLocation();
Scanner::Location reserved_loc = Scanner::NoLocation();
+ bool has_duplicate_parameters = false;
bool done = (peek() == Token::RPAREN);
while (!done) {
@@ -3557,6 +3559,7 @@ FunctionLiteral* Parser::ParseFunctionLiteral(Handle<String> var_name,
name_loc = scanner().location();
}
if (!dupe_loc.IsValid() && top_scope_->IsDeclared(param_name)) {
+ has_duplicate_parameters = true;
dupe_loc = scanner().location();
}
if (!reserved_loc.IsValid() && is_reserved) {
@@ -3688,17 +3691,18 @@ FunctionLiteral* Parser::ParseFunctionLiteral(Handle<String> var_name,
FunctionLiteral* function_literal =
new(zone()) FunctionLiteral(name,
- top_scope_,
- body,
- materialized_literal_count,
- expected_property_count,
- only_simple_this_property_assignments,
- this_property_assignments,
- num_parameters,
- start_pos,
- end_pos,
- function_name->length() > 0,
- lexical_scope.ContainsLoops());
+ top_scope_,
+ body,
+ materialized_literal_count,
+ expected_property_count,
+ only_simple_this_property_assignments,
+ this_property_assignments,
+ num_parameters,
+ start_pos,
+ end_pos,
+ function_name->length() > 0,
+ lexical_scope.ContainsLoops(),
+ has_duplicate_parameters);
function_literal->set_function_token_position(function_token_position);
if (fni_ != NULL && !is_named) fni_->AddFunction(function_literal);
« no previous file with comments | « src/objects-inl.h ('k') | src/scopes.h » ('j') | src/scopes.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698