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

Unified Diff: src/globals.h

Issue 477263002: ES6: Add support for method shorthand in object literals (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: merge Created 6 years, 3 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/full-codegen.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/globals.h
diff --git a/src/globals.h b/src/globals.h
index cc31be148751020bde24818b425ea3fb99097a22..55bb57289d9018f35d9bf78037230556bae7ea50 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -756,6 +756,41 @@ enum MinusZeroMode {
FAIL_ON_MINUS_ZERO
};
+
+enum FunctionKind {
+ kNormalFunction = 0,
+ kArrowFunction = 1,
+ kGeneratorFunction = 2,
+ kConciseMethod = 4
+};
+
+
+inline bool IsValidFunctionKind(FunctionKind kind) {
+ // At the moment these are mutually exclusive but in the future that wont be
+ // the case since ES6 allows concise generator methods.
+ return kind == FunctionKind::kNormalFunction ||
+ kind == FunctionKind::kArrowFunction ||
+ kind == FunctionKind::kGeneratorFunction ||
+ kind == FunctionKind::kConciseMethod;
+}
+
+
+inline bool IsArrowFunction(FunctionKind kind) {
+ DCHECK(IsValidFunctionKind(kind));
+ return kind & FunctionKind::kArrowFunction;
+}
+
+
+inline bool IsGeneratorFunction(FunctionKind kind) {
+ DCHECK(IsValidFunctionKind(kind));
+ return kind & FunctionKind::kGeneratorFunction;
+}
+
+
+inline bool IsConciseMethod(FunctionKind kind) {
+ DCHECK(IsValidFunctionKind(kind));
+ return kind & FunctionKind::kConciseMethod;
+}
} } // namespace v8::internal
namespace i = v8::internal;
« no previous file with comments | « src/full-codegen.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698