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

Unified Diff: src/globals.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/globals.h
diff --git a/src/globals.h b/src/globals.h
index 8cccefe50b073fac85f98dc3c85478088231edca..9547ea2323a77064f3e2e13a4e43f2821530b832 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -840,8 +840,13 @@ enum FunctionKind {
kDefaultConstructor = 1 << 4,
kSubclassConstructor = 1 << 5,
kBaseConstructor = 1 << 6,
+ kInObjectLiteral = 1 << 7,
kDefaultBaseConstructor = kDefaultConstructor | kBaseConstructor,
- kDefaultSubclassConstructor = kDefaultConstructor | kSubclassConstructor
+ kDefaultSubclassConstructor = kDefaultConstructor | kSubclassConstructor,
+ kConciseMethodInObjectLiteral = kConciseMethod | kInObjectLiteral,
+ kConciseGeneratorMethodInObjectLiteral =
+ kConciseGeneratorMethod | kInObjectLiteral,
+ kAccessorFunctionInObjectLiteral = kAccessorFunction | kInObjectLiteral,
};
@@ -855,7 +860,10 @@ inline bool IsValidFunctionKind(FunctionKind kind) {
kind == FunctionKind::kDefaultBaseConstructor ||
kind == FunctionKind::kDefaultSubclassConstructor ||
kind == FunctionKind::kBaseConstructor ||
- kind == FunctionKind::kSubclassConstructor;
+ kind == FunctionKind::kSubclassConstructor ||
+ kind == FunctionKind::kConciseMethodInObjectLiteral ||
+ kind == FunctionKind::kConciseGeneratorMethodInObjectLiteral ||
+ kind == FunctionKind::kAccessorFunctionInObjectLiteral;
}
@@ -907,6 +915,19 @@ inline bool IsConstructor(FunctionKind kind) {
(FunctionKind::kBaseConstructor | FunctionKind::kSubclassConstructor |
FunctionKind::kDefaultConstructor);
}
+
+
+inline bool IsInObjectLiteral(FunctionKind kind) {
+ DCHECK(IsValidFunctionKind(kind));
+ return kind & FunctionKind::kInObjectLiteral;
+}
+
+
+inline FunctionKind WithObjectLiteralBit(FunctionKind kind) {
+ kind = static_cast<FunctionKind>(kind | FunctionKind::kInObjectLiteral);
+ DCHECK(IsValidFunctionKind(kind));
+ return kind;
+}
} } // namespace v8::internal
namespace i = v8::internal;
« no previous file with comments | « src/code-stubs.h ('k') | src/hydrogen-instructions.h » ('j') | src/hydrogen-instructions.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698