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

Unified Diff: src/preparser.h

Issue 943543002: [strong] Declaration-after-use errors. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: computed prop names comment fix Created 5 years, 10 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/parser.cc ('k') | src/scopes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/preparser.h
diff --git a/src/preparser.h b/src/preparser.h
index 41b3a31f0e1169068eaf2968fe55b67fc3904ee4..fde66bb318936c9b29abe116ee7255af1133b32e 100644
--- a/src/preparser.h
+++ b/src/preparser.h
@@ -1414,8 +1414,8 @@ class PreParserTraits {
}
static PreParserExpression ExpressionFromIdentifier(
- PreParserIdentifier name, int pos, Scope* scope,
- PreParserFactory* factory) {
+ PreParserIdentifier name, int start_position, int end_position,
+ Scope* scope, PreParserFactory* factory) {
return PreParserExpression::FromIdentifier(name);
}
@@ -1865,14 +1865,15 @@ ParserBase<Traits>::ParsePrimaryExpression(bool* ok) {
// '(' Expression ')'
// TemplateLiteral
- int pos = peek_position();
+ int beg_pos = scanner()->peek_location().beg_pos;
+ int end_pos = scanner()->peek_location().end_pos;
ExpressionT result = this->EmptyExpression();
Token::Value token = peek();
switch (token) {
case Token::THIS: {
Consume(Token::THIS);
scope_->RecordThisUsage();
- result = this->ThisExpression(scope_, factory(), pos);
+ result = this->ThisExpression(scope_, factory(), beg_pos);
break;
}
@@ -1881,7 +1882,8 @@ ParserBase<Traits>::ParsePrimaryExpression(bool* ok) {
case Token::FALSE_LITERAL:
case Token::NUMBER:
Next();
- result = this->ExpressionFromLiteral(token, pos, scanner(), factory());
+ result =
+ this->ExpressionFromLiteral(token, beg_pos, scanner(), factory());
break;
case Token::IDENTIFIER:
@@ -1891,13 +1893,14 @@ ParserBase<Traits>::ParsePrimaryExpression(bool* ok) {
case Token::FUTURE_STRICT_RESERVED_WORD: {
// Using eval or arguments in this context is OK even in strict mode.
IdentifierT name = ParseIdentifier(kAllowEvalOrArguments, CHECK_OK);
- result = this->ExpressionFromIdentifier(name, pos, scope_, factory());
+ result = this->ExpressionFromIdentifier(name, beg_pos, end_pos, scope_,
+ factory());
break;
}
case Token::STRING: {
Consume(Token::STRING);
- result = this->ExpressionFromString(pos, scanner(), factory());
+ result = this->ExpressionFromString(beg_pos, scanner(), factory());
break;
}
@@ -1924,7 +1927,7 @@ ParserBase<Traits>::ParsePrimaryExpression(bool* ok) {
// for which an empty parameter list "()" is valid input.
Consume(Token::RPAREN);
result = this->ParseArrowFunctionLiteral(
- pos, this->EmptyArrowParamList(), CHECK_OK);
+ beg_pos, this->EmptyArrowParamList(), CHECK_OK);
} else {
// Heuristically try to detect immediately called functions before
// seeing the call parentheses.
@@ -1959,8 +1962,8 @@ ParserBase<Traits>::ParsePrimaryExpression(bool* ok) {
case Token::TEMPLATE_SPAN:
case Token::TEMPLATE_TAIL:
- result =
- this->ParseTemplateLiteral(Traits::NoTemplateTag(), pos, CHECK_OK);
+ result = this->ParseTemplateLiteral(Traits::NoTemplateTag(), beg_pos,
+ CHECK_OK);
break;
case Token::MOD:
@@ -2106,7 +2109,8 @@ ParserBase<Traits>::ParsePropertyDefinition(ObjectLiteralCheckerBase* checker,
bool is_generator = allow_harmony_object_literals_ && Check(Token::MUL);
Token::Value name_token = peek();
- int next_pos = peek_position();
+ int next_beg_pos = scanner()->peek_location().beg_pos;
+ int next_end_pos = scanner()->peek_location().end_pos;
ExpressionT name_expression = ParsePropertyName(
&name, &is_get, &is_set, &name_is_static, is_computed_name,
CHECK_OK_CUSTOM(EmptyObjectLiteralProperty));
@@ -2201,7 +2205,8 @@ ParserBase<Traits>::ParsePropertyDefinition(ObjectLiteralCheckerBase* checker,
this->is_generator())) {
DCHECK(!*is_computed_name);
DCHECK(!is_static);
- value = this->ExpressionFromIdentifier(name, next_pos, scope_, factory());
+ value = this->ExpressionFromIdentifier(name, next_beg_pos, next_end_pos,
+ scope_, factory());
return factory()->NewObjectLiteralProperty(
name_expression, value, ObjectLiteralProperty::COMPUTED, false, false);
« no previous file with comments | « src/parser.cc ('k') | src/scopes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698