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

Bug 342108

Summary: [Xtend] [Compiler] Remove private _this field
Product: [Modeling] TMF Reporter: Sven Efftinge <sven.efftinge>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 Flags: sven.efftinge: indigo+
Version: 2.0.0   
Target Milestone: M7   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Sven Efftinge CLA 2011-04-07 03:51:54 EDT
Currently the compiler generates a private field pointing to _this in order to point to that this also from within closures. We can instead generate "ClassName.this" when referencing 'this' and can remove the local variable.

Note, that this applies for 'super' as well.

To enhance the generated code we could check whether we are in a closure and only then use the qualified name to 'this'.
Comment 1 Sven Efftinge CLA 2011-04-07 04:28:22 EDT
pushed to master.

(In reply to comment #0)
> To enhance the generated code we could check whether we are in a closure and
> only then use the qualified name to 'this'.

Considered unimportant, since Bug 342116 will make use of 'this' (bound to XtendClass) very rare.
Comment 2 Sven Efftinge CLA 2011-04-07 10:55:18 EDT
Because the solution of Bug 342116 isn't improving the situation the compiler now uses the short 'this' and 'super' if possible.
Comment 3 Karsten Thoms CLA 2017-09-19 17:09:54 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 4 Karsten Thoms CLA 2017-09-19 17:21:42 EDT
Closing all bugs that were set to RESOLVED before Neon.0