Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(743)

Unified Diff: runtime/vm/object.h

Issue 68113028: Lazily format LanguageError messages (fix issue 15069). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/flow_graph_compiler.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.h
===================================================================
--- runtime/vm/object.h (revision 30304)
+++ runtime/vm/object.h (working copy)
@@ -3760,9 +3760,6 @@
class ApiError : public Error {
public:
RawString* message() const { return raw_ptr()->message_; }
- static intptr_t message_offset() {
- return OFFSET_OF(RawApiError, message_);
- }
static intptr_t InstanceSize() {
return RoundedAllocationSize(sizeof(RawApiError));
@@ -3785,23 +3782,62 @@
class LanguageError : public Error {
public:
- RawString* message() const { return raw_ptr()->message_; }
- static intptr_t message_offset() {
- return OFFSET_OF(RawLanguageError, message_);
- }
+ enum Kind {
+ kWarning,
+ kError,
+ kMalformedType,
+ kMalboundedType,
+ };
+ // Build, cache, and return formatted message.
+ RawString* FormatMessage() const;
+
static intptr_t InstanceSize() {
return RoundedAllocationSize(sizeof(RawLanguageError));
}
- static RawLanguageError* New(const String& message,
+ // A null script means no source and a negative token_pos means no position.
+ static RawLanguageError* NewFormatted(const Error& prev_error,
+ const Script& script,
+ intptr_t token_pos,
+ Kind kind,
+ Heap::Space space,
+ const char* format, ...)
+ PRINTF_ATTRIBUTE(6, 7);
+
+ static RawLanguageError* NewFormattedV(const Error& prev_error,
+ const Script& script,
+ intptr_t token_pos,
+ Kind kind,
+ Heap::Space space,
+ const char* format, va_list args);
+
+ static RawLanguageError* New(const String& formatted_message,
Heap::Space space = Heap::kNew);
virtual const char* ToErrorCString() const;
private:
- void set_message(const String& message) const;
+ RawError* previous_error() const {
+ return raw_ptr()->previous_error_;
+ }
+ void set_previous_error(const Error& value) const;
+ RawScript* script() const { return raw_ptr()->script_; }
+ void set_script(const Script& value) const;
+
+ intptr_t token_pos() const { return raw_ptr()->token_pos_; }
+ void set_token_pos(intptr_t value) const;
+
+ Kind kind() const { return static_cast<Kind>(raw_ptr()->kind_); }
+ void set_kind(uint8_t value) const;
+
+ RawString* message() const { return raw_ptr()->message_; }
+ void set_message(const String& value) const;
+
+ RawString* formatted_message() const { return raw_ptr()->formatted_message_; }
+ void set_formatted_message(const String& value) const;
+
static RawLanguageError* New();
FINAL_HEAP_OBJECT_IMPLEMENTATION(LanguageError, Error);
@@ -3843,9 +3879,6 @@
class UnwindError : public Error {
public:
RawString* message() const { return raw_ptr()->message_; }
- static intptr_t message_offset() {
- return OFFSET_OF(RawUnwindError, message_);
- }
static intptr_t InstanceSize() {
return RoundedAllocationSize(sizeof(RawUnwindError));
« no previous file with comments | « runtime/vm/flow_graph_compiler.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698