XSharpPublic icon indicating copy to clipboard operation
XSharpPublic copied to clipboard

Add an option that enforces usage of self: also for fields and properties

Open cpyrgas opened this issue 1 year ago • 3 comments

Following code does not produce any compiler error about the missing SELF keywords:

#pragma options (enforceself, on)

CLASS TestClass
	PROTECT n AS INT
	EXPORT o AS OBJECT
	CONSTRUCTOR()
		? o == NULL
	RETURN
	
	METHOD Test() AS VOID
		n := 1
		? n
		? TestProperty
	RETURN
	PROPERTY TestProperty AS INT GET n
END CLASS

cpyrgas avatar Jun 30 '24 09:06 cpyrgas

Confirmed fixed

cpyrgas avatar Jul 09 '24 11:07 cpyrgas

I have rolled back this changes in 2.21.0.1 because it generated way too much noise with the beta testers.

RobertvanderHulst avatar Oct 05 '24 06:10 RobertvanderHulst

I think we should still implement this, one way or the other. Maybe by using another compiler option, or when using the /modernsyntax option or one of the others.

Will convert this into an enhancement request.

cpyrgas avatar Nov 04 '24 22:11 cpyrgas