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; |