- removed milestone
-
assigned issue to
Don't generate 'this' for static operations
Issue #429
resolved
Consider the operation getInstance
of Singleton, which is defined as follows (in pseudocode):
if (instance == null) then
instance = create new instance
end if
return instance
However, the code generator generates the following, which doesn't compile:
static WorkflowUtility getWorkflowUtility() {
if (this.instance == null) {
this.instance = new WorkflowUtility();
}
return this.instance;
}
Since this cannot be used in a static context, it should never be generated automatically.
However, we have to ensure that something like the following still works (which is the reason that this is always added):
class Foo {
int foo;
static setFoo(int foo) {
foo = foo;
}
}
Comments (3)
-
reporter -
reporter References
#429: Removes generation of this for static fields.Adds the class name in front of static fields to avoid ambiguous calls.
→ <<cset f6e8f9204007>>
-
reporter - changed status to resolved
Merged in Issues/fixes-mv-codegen (pull request #83)
- Log in to comment
The last example needs to look like this to work: