blob: 00d45bd930004546c3eea72a3f6fa1b397d62a40 [file] [log] [blame] [edit]
// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#ifndef RUNTIME_VM_REPORT_H_
#define RUNTIME_VM_REPORT_H_
#include "vm/allocation.h"
#include "vm/token_position.h"
namespace dart {
// Forward declarations.
class Error;
class ICData;
class RawString;
class Script;
class StackFrame;
class String;
class Report : AllStatic {
public:
enum Kind {
kWarning,
kError,
kMalformedType,
kMalboundedType,
kBailout,
};
static const bool AtLocation = false;
static const bool AfterLocation = true;
// Report an already formatted error via a long jump.
static void LongJump(const Error& error);
// Concatenate and report an already formatted error and a new error message.
static void LongJumpF(const Error& prev_error,
const Script& script,
TokenPosition token_pos,
const char* format,
...) PRINTF_ATTRIBUTE(4, 5);
static void LongJumpV(const Error& prev_error,
const Script& script,
TokenPosition token_pos,
const char* format,
va_list args);
// Report a warning/jswarning/error/bailout message.
static void MessageF(Kind kind,
const Script& script,
TokenPosition token_pos,
bool report_after_token,
const char* format,
...) PRINTF_ATTRIBUTE(5, 6);
static void MessageV(Kind kind,
const Script& script,
TokenPosition token_pos,
bool report_after_token,
const char* format,
va_list args);
// Prepend a source snippet to the message.
// A null script means no source and a negative token_pos means no position.
static RawString* PrependSnippet(Kind kind,
const Script& script,
TokenPosition token_pos,
bool report_after_token,
const String& message);
private:
DISALLOW_COPY_AND_ASSIGN(Report);
};
} // namespace dart
#endif // RUNTIME_VM_REPORT_H_