HELP ! - with syntax and lines etc.
Posted: Tue Feb 14, 2017 3:31 pm
Jack,
I added Johans code to my test program and this:
is translated to (I am showing the PPO output)
The PPO output still needs some cleaning (some unnecessary spaces are in there) but you can see that it works.
And of course the code generation works as well. This is the (C#) output from IL Spy:
Robert
Although the preprocessor is not finished (and not included in the current build) I am pleased to say that with my current development build this is already working.Jack wrote: Not sure it is possible in X# yet, but Robert said he is working on the pre-processor.
If the #command was supported, you can use something that Johan posted a while ago, e.g.:
PROPERTY Abc AS STRING GETSET _abc
Which would correctly translate with the following #command as he shared:
I added Johans code to my test program and this:
Code: Select all
#command PROPERTY <n> AS <t> GETSET <v> =>;
PROPERTY <n> AS <t>;;
GET;;
RETURN SELF:<v>;;
END GET;;
SET;;
SELF:<v> := VALUE;;
SELF:NotifyPropertyChanged(<"n">);;
END SET;;
END PROPERTY
CLASS Foo
protected _abc as STRING
PROPERTY Abc AS STRING GETSET _abc
METHOD NotifyPropertyChanged(cProp as STRING) AS VOID
? cProp, "has changed"
RETURN
END CLASS
Code: Select all
CLASS Foo
protected _abc as STRING
PROPERTY Abc AS STRING ; GET ; RETURN SELF : _abc ; END GET ; SET ; SELF : _abc := VALUE ; SELF : NotifyPropertyChanged ( "Abc" ) ; END SET ; END PROPERTY
METHOD NotifyPropertyChanged ( cProp as STRING ) AS VOID
? cProp , "has changed"
RETURN
END CLASS
And of course the code generation works as well. This is the (C#) output from IL Spy:
Code: Select all
public class Foo
{
protected string _abc;
public string Abc
{
get
{
return this._abc;
}
set
{
this._abc = value;
this.NotifyPropertyChanged("Abc");
}
}
public void NotifyPropertyChanged(string cProp)
{
Console.Write("rn{0} {1}", cProp, "has changed");
}
}