Last Comment Bug 700802 - Make JSLinearString::ensureLinear (mutatis mutandis for JSFlatString and other subtypes, and for is* and as* methods) a compile error
: Make JSLinearString::ensureLinear (mutatis mutandis for JSFlatString and othe...
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: Trunk
: All All
-- normal (vote)
: mozilla11
Assigned To: Jeff Walden [:Waldo] (remove +bmo to email)
: Jason Orendorff [:jorendorff]
Depends on:
  Show dependency treegraph
Reported: 2011-11-08 14:12 PST by Jeff Walden [:Waldo] (remove +bmo to email)
Modified: 2011-11-09 05:33 PST (History)
3 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

Patch (6.30 KB, patch)
2011-11-08 14:12 PST, Jeff Walden [:Waldo] (remove +bmo to email)
luke: review+
Details | Diff | Splinter Review

Description User image Jeff Walden [:Waldo] (remove +bmo to email) 2011-11-08 14:12:07 PST
Created attachment 573001 [details] [diff] [review]

It's perfectly legal to call ensureLinear on a linear string right now.  It's also completely pointless.  We can make it a compile error so that this can't be done.  This sort of mistake is most likely to bite changes that improve typing of a class member (say, from JSString to JSLinearString), although I could imagine it happening if someone suffered a brief memory lapse when writing some other patch.
Comment 1 User image Jeff Walden [:Waldo] (remove +bmo to email) 2011-11-08 19:38:08 PST

Earlier this year C++11 had a declaration modifier, "new", which could be used to require that a declarator in a class hide an identically-typed declarator in a superclass.  It got taken out because the ISO people were running out of places to shoehorn it, for non-method declarator syntax.  Le sigh; that would have been perfect for these uses.

Oh well, this will likely work well enough.
Comment 2 User image Marco Bonardo [::mak] 2011-11-09 05:33:17 PST

Note You need to log in before you can comment on or make changes to this bug.