chromium/v8/src/ast/prettyprinter.cc

// Copyright 2012 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "src/ast/prettyprinter.h"

#include <stdarg.h>

#include "src/ast/ast-value-factory.h"
#include "src/ast/scopes.h"
#include "src/base/strings.h"
#include "src/base/vector.h"
#include "src/common/globals.h"
#include "src/objects/objects-inl.h"
#include "src/regexp/regexp-flags.h"
#include "src/strings/string-builder-inl.h"

namespace v8 {
namespace internal {

CallPrinter::CallPrinter(Isolate* isolate, bool is_user_js,
                         SpreadErrorInArgsHint error_in_spread_args)
    :{}

CallPrinter::~CallPrinter() = default;

CallPrinter::ErrorHint CallPrinter::GetErrorHint() const {}

Handle<String> CallPrinter::Print(FunctionLiteral* program, int position) {}


void CallPrinter::Find(AstNode* node, bool print) {}

void CallPrinter::Print(char c) {}

void CallPrinter::Print(const char* str) {}

void CallPrinter::Print(DirectHandle<String> str) {}

void CallPrinter::VisitBlock(Block* node) {}


void CallPrinter::VisitVariableDeclaration(VariableDeclaration* node) {}


void CallPrinter::VisitFunctionDeclaration(FunctionDeclaration* node) {}


void CallPrinter::VisitExpressionStatement(ExpressionStatement* node) {}


void CallPrinter::VisitEmptyStatement(EmptyStatement* node) {}


void CallPrinter::VisitSloppyBlockFunctionStatement(
    SloppyBlockFunctionStatement* node) {}


void CallPrinter::VisitIfStatement(IfStatement* node) {}


void CallPrinter::VisitContinueStatement(ContinueStatement* node) {}


void CallPrinter::VisitBreakStatement(BreakStatement* node) {}


void CallPrinter::VisitReturnStatement(ReturnStatement* node) {}


void CallPrinter::VisitWithStatement(WithStatement* node) {}


void CallPrinter::VisitSwitchStatement(SwitchStatement* node) {}


void CallPrinter::VisitDoWhileStatement(DoWhileStatement* node) {}


void CallPrinter::VisitWhileStatement(WhileStatement* node) {}


void CallPrinter::VisitForStatement(ForStatement* node) {}


void CallPrinter::VisitForInStatement(ForInStatement* node) {}


void CallPrinter::VisitForOfStatement(ForOfStatement* node) {}


void CallPrinter::VisitTryCatchStatement(TryCatchStatement* node) {}


void CallPrinter::VisitTryFinallyStatement(TryFinallyStatement* node) {}


void CallPrinter::VisitDebuggerStatement(DebuggerStatement* node) {}


void CallPrinter::VisitFunctionLiteral(FunctionLiteral* node) {}


void CallPrinter::VisitClassLiteral(ClassLiteral* node) {}

void CallPrinter::VisitInitializeClassMembersStatement(
    InitializeClassMembersStatement* node) {}

void CallPrinter::VisitInitializeClassStaticElementsStatement(
    InitializeClassStaticElementsStatement* node) {}

void CallPrinter::VisitAutoAccessorGetterBody(AutoAccessorGetterBody* node) {}

void CallPrinter::VisitAutoAccessorSetterBody(AutoAccessorSetterBody* node) {}

void CallPrinter::VisitNativeFunctionLiteral(NativeFunctionLiteral* node) {}

void CallPrinter::VisitConditionalChain(ConditionalChain* node) {}

void CallPrinter::VisitConditional(Conditional* node) {}


void CallPrinter::VisitLiteral(Literal* node) {}


void CallPrinter::VisitRegExpLiteral(RegExpLiteral* node) {}


void CallPrinter::VisitObjectLiteral(ObjectLiteral* node) {}


void CallPrinter::VisitArrayLiteral(ArrayLiteral* node) {}


void CallPrinter::VisitVariableProxy(VariableProxy* node) {}


void CallPrinter::VisitAssignment(Assignment* node) {}

void CallPrinter::VisitCompoundAssignment(CompoundAssignment* node) {}

void CallPrinter::VisitYield(Yield* node) {}

void CallPrinter::VisitYieldStar(YieldStar* node) {}

void CallPrinter::VisitAwait(Await* node) {}

void CallPrinter::VisitThrow(Throw* node) {}

void CallPrinter::VisitOptionalChain(OptionalChain* node) {}

void CallPrinter::VisitProperty(Property* node) {}

void CallPrinter::VisitCall(Call* node) {}


void CallPrinter::VisitCallNew(CallNew* node) {}


void CallPrinter::VisitCallRuntime(CallRuntime* node) {}

void CallPrinter::VisitSuperCallForwardArgs(SuperCallForwardArgs* node) {}

void CallPrinter::VisitUnaryOperation(UnaryOperation* node) {}


void CallPrinter::VisitCountOperation(CountOperation* node) {}


void CallPrinter::VisitBinaryOperation(BinaryOperation* node) {}

void CallPrinter::VisitNaryOperation(NaryOperation* node) {}

void CallPrinter::VisitCompareOperation(CompareOperation* node) {}


void CallPrinter::VisitSpread(Spread* node) {}

void CallPrinter::VisitEmptyParentheses(EmptyParentheses* node) {}

void CallPrinter::VisitGetTemplateObject(GetTemplateObject* node) {}

void CallPrinter::VisitTemplateLiteral(TemplateLiteral* node) {}

void CallPrinter::VisitImportCallExpression(ImportCallExpression* node) {}

void CallPrinter::VisitThisExpression(ThisExpression* node) {}

void CallPrinter::VisitSuperPropertyReference(SuperPropertyReference* node) {}


void CallPrinter::VisitSuperCallReference(SuperCallReference* node) {}


void CallPrinter::FindStatements(const ZonePtrList<Statement>* statements) {}

void CallPrinter::FindArguments(const ZonePtrList<Expression>* arguments) {}

void CallPrinter::PrintLiteral(Handle<Object> value, bool quote) {}


void CallPrinter::PrintLiteral(const AstRawString* value, bool quote) {}

//-----------------------------------------------------------------------------


#ifdef DEBUG

const char* AstPrinter::Print(AstNode* node) {}

void AstPrinter::Init() {}

void AstPrinter::Print(const char* format, ...) {}

void AstPrinter::PrintLiteral(Literal* literal, bool quote) {}

void AstPrinter::PrintLiteral(const AstRawString* value, bool quote) {}

void AstPrinter::PrintLiteral(const AstConsString* value, bool quote) {}

//-----------------------------------------------------------------------------

class V8_NODISCARD IndentedScope {};

//-----------------------------------------------------------------------------

AstPrinter::AstPrinter(uintptr_t stack_limit)
    :{}

AstPrinter::~AstPrinter() {}


void AstPrinter::PrintIndented(const char* txt) {}

void AstPrinter::PrintLiteralIndented(const char* info, Literal* literal,
                                      bool quote) {}

void AstPrinter::PrintLiteralIndented(const char* info,
                                      const AstRawString* value, bool quote) {}

void AstPrinter::PrintLiteralIndented(const char* info,
                                      const AstConsString* value, bool quote) {}

void AstPrinter::PrintLiteralWithModeIndented(const char* info, Variable* var,
                                              const AstRawString* value) {}

void AstPrinter::PrintIndentedVisit(const char* s, AstNode* node) {}


const char* AstPrinter::PrintProgram(FunctionLiteral* program) {}


void AstPrinter::PrintOut(Isolate* isolate, AstNode* node) {}

void AstPrinter::PrintDeclarations(Declaration::List* declarations) {}

void AstPrinter::PrintParameters(DeclarationScope* scope) {}

void AstPrinter::PrintStatements(const ZonePtrList<Statement>* statements) {}

void AstPrinter::PrintArguments(const ZonePtrList<Expression>* arguments) {}


void AstPrinter::VisitBlock(Block* node) {}


// TODO(svenpanne) Start with IndentedScope.
void AstPrinter::VisitVariableDeclaration(VariableDeclaration* node) {}


// TODO(svenpanne) Start with IndentedScope.
void AstPrinter::VisitFunctionDeclaration(FunctionDeclaration* node) {}


void AstPrinter::VisitExpressionStatement(ExpressionStatement* node) {}


void AstPrinter::VisitEmptyStatement(EmptyStatement* node) {}


void AstPrinter::VisitSloppyBlockFunctionStatement(
    SloppyBlockFunctionStatement* node) {}


void AstPrinter::VisitIfStatement(IfStatement* node) {}


void AstPrinter::VisitContinueStatement(ContinueStatement* node) {}


void AstPrinter::VisitBreakStatement(BreakStatement* node) {}


void AstPrinter::VisitReturnStatement(ReturnStatement* node) {}


void AstPrinter::VisitWithStatement(WithStatement* node) {}


void AstPrinter::VisitSwitchStatement(SwitchStatement* node) {}


void AstPrinter::VisitDoWhileStatement(DoWhileStatement* node) {}


void AstPrinter::VisitWhileStatement(WhileStatement* node) {}


void AstPrinter::VisitForStatement(ForStatement* node) {}


void AstPrinter::VisitForInStatement(ForInStatement* node) {}


void AstPrinter::VisitForOfStatement(ForOfStatement* node) {}


void AstPrinter::VisitTryCatchStatement(TryCatchStatement* node) {}

void AstPrinter::VisitTryFinallyStatement(TryFinallyStatement* node) {}

void AstPrinter::VisitDebuggerStatement(DebuggerStatement* node) {}


void AstPrinter::VisitFunctionLiteral(FunctionLiteral* node) {}


void AstPrinter::VisitClassLiteral(ClassLiteral* node) {}

void AstPrinter::VisitInitializeClassMembersStatement(
    InitializeClassMembersStatement* node) {}

void AstPrinter::VisitInitializeClassStaticElementsStatement(
    InitializeClassStaticElementsStatement* node) {}

void AstPrinter::VisitAutoAccessorGetterBody(AutoAccessorGetterBody* node) {}

void AstPrinter::VisitAutoAccessorSetterBody(AutoAccessorSetterBody* node) {}

void AstPrinter::PrintClassProperty(ClassLiteral::Property* property) {}

void AstPrinter::PrintClassProperties(
    const ZonePtrList<ClassLiteral::Property>* properties) {}

void AstPrinter::PrintClassStaticElements(
    const ZonePtrList<ClassLiteral::StaticElement>* static_elements) {}

void AstPrinter::VisitNativeFunctionLiteral(NativeFunctionLiteral* node) {}

void AstPrinter::VisitConditionalChain(ConditionalChain* node) {}

void AstPrinter::VisitConditional(Conditional* node) {}


void AstPrinter::VisitLiteral(Literal* node) {}


void AstPrinter::VisitRegExpLiteral(RegExpLiteral* node) {}


void AstPrinter::VisitObjectLiteral(ObjectLiteral* node) {}

void AstPrinter::PrintObjectProperties(
    const ZonePtrList<ObjectLiteral::Property>* properties) {}


void AstPrinter::VisitArrayLiteral(ArrayLiteral* node) {}


void AstPrinter::VisitVariableProxy(VariableProxy* node) {}


void AstPrinter::VisitAssignment(Assignment* node) {}

void AstPrinter::VisitCompoundAssignment(CompoundAssignment* node) {}

void AstPrinter::VisitYield(Yield* node) {}

void AstPrinter::VisitYieldStar(YieldStar* node) {}

void AstPrinter::VisitAwait(Await* node) {}

void AstPrinter::VisitThrow(Throw* node) {}

void AstPrinter::VisitOptionalChain(OptionalChain* node) {}

void AstPrinter::VisitProperty(Property* node) {}

void AstPrinter::VisitCall(Call* node) {}


void AstPrinter::VisitCallNew(CallNew* node) {}


void AstPrinter::VisitCallRuntime(CallRuntime* node) {}


void AstPrinter::VisitUnaryOperation(UnaryOperation* node) {}


void AstPrinter::VisitCountOperation(CountOperation* node) {}


void AstPrinter::VisitBinaryOperation(BinaryOperation* node) {}

void AstPrinter::VisitNaryOperation(NaryOperation* node) {}

void AstPrinter::VisitCompareOperation(CompareOperation* node) {}


void AstPrinter::VisitSpread(Spread* node) {}

void AstPrinter::VisitEmptyParentheses(EmptyParentheses* node) {}

void AstPrinter::VisitGetTemplateObject(GetTemplateObject* node) {}

void AstPrinter::VisitTemplateLiteral(TemplateLiteral* node) {}

void AstPrinter::VisitImportCallExpression(ImportCallExpression* node) {}

void AstPrinter::VisitThisExpression(ThisExpression* node) {}

void AstPrinter::VisitSuperPropertyReference(SuperPropertyReference* node) {}

void AstPrinter::VisitSuperCallReference(SuperCallReference* node) {}

void AstPrinter::VisitSuperCallForwardArgs(SuperCallForwardArgs* node) {}

#endif  // DEBUG

}  // namespace internal
}  // namespace v8