Closed Bug 745361 Opened 13 years ago Closed 13 years ago

Handle conversion rules totally break static typing

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla14

People

(Reporter: luke, Assigned: bhackett1024)

Details

Attachments

(1 file)

This type checks but I don't think it should RootedVarString r(...); HandleObject h = r; I think the solution is to remove this constructor and fix other things with explicit (restrict) casts. template <class T> template <class U> Handle<T>::Handle(const RootedVar<U> &); and the analogous one for Root<U>. Also, can we move Handle out of jsprvtd.h?
Attached patch patchSplinter Review
Oops, this constructor was missing a testAssign, which is supposed to only allow handle assignments that follow normal C++ assignment rules for the wrapped type. See the other Handle constructors, which are also templated on a type other than the handle. Requiring casts whenever converting between handles of different but compatible types would be a mess I think, with all the subclassing we do for objects and strings.
Assignee: general → bhackett1024
Attachment #615047 - Flags: review?(luke)
Comment on attachment 615047 [details] [diff] [review] patch Ahh, I didn't see testAssign. Cool.
Attachment #615047 - Flags: review?(luke) → review+
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla14
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: