11cb0ef41Sopenharmony_ci// Copyright 2019 the V8 project authors. All rights reserved. 21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be 31cb0ef41Sopenharmony_ci// found in the LICENSE file. 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ci#ifndef V8_OBJECTS_FUNCTION_SYNTAX_KIND_H_ 61cb0ef41Sopenharmony_ci#define V8_OBJECTS_FUNCTION_SYNTAX_KIND_H_ 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ci#include "src/utils/utils.h" 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_cinamespace v8 { 111cb0ef41Sopenharmony_cinamespace internal { 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_cienum class FunctionSyntaxKind : uint8_t { 141cb0ef41Sopenharmony_ci kAnonymousExpression, 151cb0ef41Sopenharmony_ci kNamedExpression, 161cb0ef41Sopenharmony_ci kDeclaration, 171cb0ef41Sopenharmony_ci kAccessorOrMethod, 181cb0ef41Sopenharmony_ci kWrapped, 191cb0ef41Sopenharmony_ci 201cb0ef41Sopenharmony_ci kLastFunctionSyntaxKind = kWrapped, 211cb0ef41Sopenharmony_ci}; 221cb0ef41Sopenharmony_ci 231cb0ef41Sopenharmony_ciinline const char* FunctionSyntaxKind2String(FunctionSyntaxKind kind) { 241cb0ef41Sopenharmony_ci switch (kind) { 251cb0ef41Sopenharmony_ci case FunctionSyntaxKind::kAnonymousExpression: 261cb0ef41Sopenharmony_ci return "AnonymousExpression"; 271cb0ef41Sopenharmony_ci case FunctionSyntaxKind::kNamedExpression: 281cb0ef41Sopenharmony_ci return "NamedExpression"; 291cb0ef41Sopenharmony_ci case FunctionSyntaxKind::kDeclaration: 301cb0ef41Sopenharmony_ci return "Declaration"; 311cb0ef41Sopenharmony_ci case FunctionSyntaxKind::kAccessorOrMethod: 321cb0ef41Sopenharmony_ci return "AccessorOrMethod"; 331cb0ef41Sopenharmony_ci case FunctionSyntaxKind::kWrapped: 341cb0ef41Sopenharmony_ci return "Wrapped"; 351cb0ef41Sopenharmony_ci } 361cb0ef41Sopenharmony_ci UNREACHABLE(); 371cb0ef41Sopenharmony_ci} 381cb0ef41Sopenharmony_ci 391cb0ef41Sopenharmony_ciinline std::ostream& operator<<(std::ostream& os, FunctionSyntaxKind kind) { 401cb0ef41Sopenharmony_ci return os << FunctionSyntaxKind2String(kind); 411cb0ef41Sopenharmony_ci} 421cb0ef41Sopenharmony_ci 431cb0ef41Sopenharmony_ci} // namespace internal 441cb0ef41Sopenharmony_ci} // namespace v8 451cb0ef41Sopenharmony_ci 461cb0ef41Sopenharmony_ci#endif // V8_OBJECTS_FUNCTION_SYNTAX_KIND_H_ 47