CGNestedTypeDefinition
, it’s a CGMemberDefinition so you can just add it to a type’s members.
In the constructor pf the CGAttribute class, I have to include a CGTypeReference.
I do not see what I have to supply here …
Edit: Do you have some documentation; I am really working in the dark here.
Some example code (doesn’t matter what source language) and an inheritance list would be nice to have.
CGAttribute is like a C# attribute:
[MyClass(arguments)]
Myclass would be the type reference you’d need.
Note the source is available here https://github.com/remobjects/codegen4
I’ll try and see if I can fnd some sample of this.
Next problem.
The VB syntax:
Function Test(testvalue As String, ParamArray values() As Object) As String
How do I do the parameters?
so something like ~
var x = new CGMethodDefinition("Test");
x.Parameters.Add(
new CGParameterDefintion('testValue', new CGNamedTypeReference('String'));
x.Parameters.Add(
new CGParameterDefintion('values',
new CGArrayTypeReference(new CGNamedTypeReference('Object')), // () as Object
Modifier := CGParameterModifierKind.Params); // ParamArray
Thanks!
I was thinking too complex.
Somehow the CC does not show the constructor(s) of the CGParameterDefintion. Also not in VB …
Edit: Something strange; a few minutes later it works …
And optional parameters?
When I skip an optional parameter in a call, do I use the CGNilExpression?
set DefaultValue on the parameter, CGDefaultExpression(paramtype) is a good default (nil for references, 0/false, etc for value types
)
Since this is mostly an internal library, we dont have any docs, but really, the source is pretty self-explanatory. I posted a second link in my original thread to a GitHub repo that does use CG4, so that should give you some examples (though you’re probably beyond that level, by now).
It is getting on speed now - unit structure is almost done, next week the implementation.
I expect the Lambda’s to be the most difficult.
So if you have an example of that, it would be very nice.
Hmm, good q. not sure of CG4 supports those, I’ll have to check, and maybe add that.
You should make an IL -> CG4; then you have a decompiler
Wanna table that next, once VB works?
No, because I know almost nothing about IL.
After the Z80 Assembly, I never played low level stuff anymore.
Marc, I miss the parameters at the Property Definition.
The property definition also lacks attributes.
How do I create a RemObjects.Elements.Rtl.platformString from a string?
They’re the same thing. It’s a mapped type (and assignment compatible); You do have to make sure you reference elements.dll in your project.