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

Unified Diff: src/preparser.h

Issue 994043003: [strong] More scoping related errors: object literal methods. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: moar code reviews Created 5 years, 9 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
Index: src/preparser.h
diff --git a/src/preparser.h b/src/preparser.h
index 1b9af9e732600c75d36b9f3e14d8919e0f3e7bae..054a33c640bd7b6b8f503d631f117e9427a5510e 100644
--- a/src/preparser.h
+++ b/src/preparser.h
@@ -2148,6 +2148,8 @@ ParserBase<Traits>::ParsePropertyDefinition(ObjectLiteralCheckerBase* checker,
: FunctionKind::kBaseConstructor;
}
+ if (!in_class) kind = WithObjectLiteralBit(kind);
+
value = this->ParseFunctionLiteral(
name, scanner()->location(),
false, // reserved words are allowed here
@@ -2179,11 +2181,12 @@ ParserBase<Traits>::ParsePropertyDefinition(ObjectLiteralCheckerBase* checker,
CHECK_OK_CUSTOM(EmptyObjectLiteralProperty));
}
+ FunctionKind kind = FunctionKind::kAccessorFunction;
+ if (!in_class) kind = WithObjectLiteralBit(kind);
arv (Not doing code reviews) 2015/03/10 16:49:06 It is not clear to me that we need this extra bit.
marja 2015/03/10 17:08:13 Scope-wise, a method (or an accessor) of an object
typename Traits::Type::FunctionLiteral value = this->ParseFunctionLiteral(
name, scanner()->location(),
false, // reserved words are allowed here
- FunctionKind::kAccessorFunction, RelocInfo::kNoPosition,
- FunctionLiteral::ANONYMOUS_EXPRESSION,
+ kind, RelocInfo::kNoPosition, FunctionLiteral::ANONYMOUS_EXPRESSION,
is_get ? FunctionLiteral::GETTER_ARITY : FunctionLiteral::SETTER_ARITY,
CHECK_OK_CUSTOM(EmptyObjectLiteralProperty));

Powered by Google App Engine
This is Rietveld 408576698