• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2019 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef V8_OBJECTS_FUNCTION_SYNTAX_KIND_H_
6 #define V8_OBJECTS_FUNCTION_SYNTAX_KIND_H_
7 
8 #include "src/utils/utils.h"
9 
10 namespace v8 {
11 namespace internal {
12 
13 enum class FunctionSyntaxKind : uint8_t {
14   kAnonymousExpression,
15   kNamedExpression,
16   kDeclaration,
17   kAccessorOrMethod,
18   kWrapped,
19 
20   kLastFunctionSyntaxKind = kWrapped,
21 };
22 
FunctionSyntaxKind2String(FunctionSyntaxKind kind)23 inline const char* FunctionSyntaxKind2String(FunctionSyntaxKind kind) {
24   switch (kind) {
25     case FunctionSyntaxKind::kAnonymousExpression:
26       return "AnonymousExpression";
27     case FunctionSyntaxKind::kNamedExpression:
28       return "NamedExpression";
29     case FunctionSyntaxKind::kDeclaration:
30       return "Declaration";
31     case FunctionSyntaxKind::kAccessorOrMethod:
32       return "AccessorOrMethod";
33     case FunctionSyntaxKind::kWrapped:
34       return "Wrapped";
35   }
36   UNREACHABLE();
37 }
38 
39 inline std::ostream& operator<<(std::ostream& os, FunctionSyntaxKind kind) {
40   return os << FunctionSyntaxKind2String(kind);
41 }
42 
43 }  // namespace internal
44 }  // namespace v8
45 
46 #endif  // V8_OBJECTS_FUNCTION_SYNTAX_KIND_H_
47