Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 353223

Summary: Fix implicit "this" for fields and functions
Product: z_Archived Reporter: Scott Greer <greer>
Component: EDTAssignee: Project Inbox <edt.javascriptgen-inbox>
Status: CLOSED FIXED QA Contact:
Severity: blocker    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 352125    

Description Scott Greer CLA 2011-07-27 11:25:42 EDT
JavaScript requires "this." to qualify access to fields and functions within the same object in which they are defined.   (In EGL, this can be implicit or explicit.)   

The JavaScript generator has very primitive logic for adding "this." but there are problems:

* ...results in duplicate "this." when the EGL source has an explicit "this."

* ...fails to determine whether the field or function is in fact local to the part from which they are being accessed.
Comment 1 Scott Greer CLA 2011-07-27 11:30:37 EDT
Reworked JS gen as follows

* For fields, MemberNameTemplate looks to see if the field access was unqualified and if so, invokes genQualifier on that field.  (That logic is left as it was -- it simply looks to see if the container is a type and if so it forwards the genQualifier on to the container.)

* genQualifier was removed from the existing container classes and a new implementation was created on EGLClassTemplate.  This has simple logic that takes a field or function and looks to see if its associated with this particular part;  if so, then it emits "this.".   

Verified the changes by generating and executing the existing FVT testcases.
Comment 2 Scott Greer CLA 2011-07-30 14:19:30 EDT
Verified fix.