Bug 384193 - JSGen should be able to create correct code when moving to ANY and Number without the need for a AS expression
Summary: JSGen should be able to create correct code when moving to ANY and Number wit...
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: EDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-03 14:20 EDT by Paul Harmon CLA
Modified: 2017-02-23 14:07 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Harmon CLA 2012-07-03 14:20:29 EDT
Bug 382296 was opened because we were generating an AS expression when making type1 compatible with type2, and type1 is already a subclass of type2 (assuming both types are reference types).

I was able to remove the AS expression, except when making a type compatible with ANY or NUMBER in javascript. This is because JS is coded to require the resulting type to contain the type signature of the source. This does not happen if the AS expression is not coded.

However, this is an implementation detail. According to our .egl definitions, ANY is the superclass of all types, and NUMBER is the superclass of DECIMAL. So, assigning any reference type to an ANY, or assignigning a DECIMAL to a NUMBER should not require an AS expression. Java does not require the AS expression, but JS does.

I think the JS generator should be changed to insert the AS expression for these cases, so we do not have to add the AS expression in IRUtils and force all generators to generate an AS expression.

If this is implemented in the JS generator, org.eclipse.edt.mof.egl.utils.IRUtils.makeExprCompatibleToType() should be changed to remove the AS expression for these cases.

There is a comment just above the line that creates the AS expression with the following text:

//For now, must make special case for Any and Number to support JS
Comment 1 Matt Heitz CLA 2013-01-03 14:01:44 EST
Deferring to Future.  This won't be done in 0.8.2.