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

Issue 100833005: Add Instance::ToUserCString. (Closed)

Created:
7 years ago by turnidge
Modified:
7 years ago
Reviewers:
Cutch, hausner
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Visibility:
Public.

Description

Add Instance::ToUserCString. ----- Often ToCString returns a representation which would be weighty or unsightly to users. Instance::ToUserCString tries to return a representation that will be more familiar to end users. ToUserCString will be used in the vmservice to produce interesting instance preview strings w/o calling toString. No doubt we will find other uses for it too. For example, strings are represented more as they would be in a user program, with quotes and escapes: ("this\nis\ta\n\ntest") instead of (this is a test). I intend to add better representations for short lists and maps later, e.g. ([1,2]) instead of (Instance(length:2) of '_GrowableList'). I've added some tests to track current behavior. Fix a problem where the vm internal names for private classes were leaking out through ToCString. This is problematic because Dart's default toString relies on ToCString (which surprised me). This fix will be user-visible and, darn it, it's the right thing to do. For example, before toString (in Dart) might yield: Instance of '_MyPrivateClass@43df89GARBAGE4389' Now it will yield: Instance of '_MyPrivateClass' (as an aside, do those single-quotes around the class name add any meaning here?) Massage the output of ToString for GrowableObjectArray to be more consistent with other instance ToString output. This should not be user visible, as lists define a reasonable toString. R=johnmccutchan@google.com Committed: https://code.google.com/p/dart/source/detail?r=30996

Patch Set 1 #

Patch Set 2 : #

Total comments: 2

Patch Set 3 : #

Patch Set 4 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+210 lines, -2 lines) Patch
runtime/vm/object.h View 1 2 3 chunks +10 lines, -0 lines 0 comments Download
runtime/vm/object.cc View 1 2 4 chunks +105 lines, -2 lines 0 comments Download
runtime/vm/object_test.cc View 1 2 1 chunk +95 lines, -0 lines 0 comments Download

Messages

Total messages: 5 (0 generated)
turnidge
7 years ago (2013-12-07 06:35:36 UTC) #1
Cutch
lgtm. I'm glad to see the maximum length string truncation in, I already hit that.
7 years ago (2013-12-09 16:27:08 UTC) #2
hausner
DBC https://codereview.chromium.org/100833005/diff/20001/runtime/vm/object.h File runtime/vm/object.h (right): https://codereview.chromium.org/100833005/diff/20001/runtime/vm/object.h#newcode3967 runtime/vm/object.h:3967: virtual const char* ToUserCString() const; DBC: should ToUserCString() ...
7 years ago (2013-12-09 16:53:38 UTC) #3
turnidge
https://codereview.chromium.org/100833005/diff/20001/runtime/vm/object.h File runtime/vm/object.h (right): https://codereview.chromium.org/100833005/diff/20001/runtime/vm/object.h#newcode3967 runtime/vm/object.h:3967: virtual const char* ToUserCString() const; On 2013/12/09 16:53:38, hausner ...
7 years ago (2013-12-09 19:44:13 UTC) #4
turnidge
7 years ago (2013-12-09 19:47:28 UTC) #5
Message was sent while issue was closed.
Committed patchset #4 manually as r30996 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698