Dimitar Dobrev
d986132743
Split generation from addition of properties
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
9ea4289f15
Simplify overrides of overrides of secondary bases
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
65b17fc958
Optimize calls to base getters in properties
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
499ecc3b89
Simplify searching for base properties
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
b12acfcce7
Upgrade ANSI marshalling to UTF-8 marshalling
...
UTF-8 is backwards-compatible with i.e. a strict superset of, ANSI, so we can safely marshal any ANSI as UTF-8 and thus we gain UTF-8 support for free.
Also fixed leaking memory when passing strings to native code as nobody ever freed the previously used Marshal.StringToPtr.
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
1792f529ff
Fix the getting of references to pointers in C#
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
62fc6f90d9
Fix the passing of references to pointers in C#
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
e430f6f8dc
Fix regressed indexers in templates with non-trivial ctors
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
fac861ad8d
Make indexers use non-trivial copy ctors if any
...
Fixes #1229 .
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
d90d3283e4
Generate with no hacks correctly sized layouts
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
3cd7fdee25
Generate valid C# for implicit conversion to const char*
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
2919dfddbd
Generate valid C# when a method from a secondary base has no native symbol
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
6b744458b4
Flatten anonymous types to avoid empty names
...
This improves our generated API as we no longer need "_0"-like names and also prevents conflicts between an anonymous type and a property of this type.
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
fce2841a21
Generate valid C# when a field with an anon type starts with '$'
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
39d5828b64
Fix a regression with headers named after keywords
...
Fixes https://github.com/mono/CppSharp/issues/1212 .
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
6b3cdaffb7
Optimize renaming of declarations named after keywords
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
9bc39c44ab
Generate valid C# for template indexers taking const char*
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Dimitar Dobrev
3caa8c5da2
Restore removed specializations
...
All specializations which only use pointers as their type arguments need at most one internal representation since pointers are mapped to IntPtr. This was achieved by removing the unneeded specializations from their containing list. This was, however, a bug because specializations were thus removed not only as internal structures but in their entirety.
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
6 years ago
Joao Matos
0b825e1124
Changed more overloads in `CSharpSources` to be overridable.
7 years ago
Joao Matos
2a7f36fb2f
Extract C# base type printing in `CSharpSources.GetBaseClassTypeName`.
7 years ago
Joao Matos
863566ef43
Added `CSharpSources.IsReservedKeyword` static helper method.
7 years ago
Joao Matos
850dcfaf67
Changed `CSharpTypePrinter.IntPtrType` to be a getter property.
7 years ago
Joao Matos
405f3ba92b
Only generate `unsafe` and `IDisposable` for bindings generation.
7 years ago
Joao Matos
d30909dfbd
Skip generation of ignored bases in `CSharpSources.GenerateClassSpecifier`.
7 years ago
Joao Matos
9a71598d52
Add constructor overload `CSharpSources(BindingContext context)`.
7 years ago
Dimitar Dobrev
bc7f20a10a
Fixed the generated C# when an instance method has a parameter named "instance".
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
7 years ago
Dimitar Dobrev
d97016fe3c
Fixed the generated C# for indexers in templates specialized with void*.
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
7 years ago
Dimitar Dobrev
1ea19d5a1e
Made an exception serializable and removed another.
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
7 years ago
Dimitar Dobrev
5e0e19ea18
Fixed the generation of dependent virtual methods.
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
7 years ago
Dimitar Dobrev
a430d19870
Simplified the generation of virtual calls.
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
7 years ago
Dimitar Dobrev
efa11ab745
Simplified type maps by unlinking them from declarations.
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
7 years ago
Dimitar Dobrev
a4913509eb
Added type maps for primitive strings (pointers to char).
...
const char*, const char16_t* and const wchar_t* in particular.
This enables comparison of types when resolving ambiguity.
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
7 years ago
Dimitar Dobrev
41b22762a4
Fixed the marshalling of std::string with GCC 6+ on Linux.
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
7 years ago
Dimitar Dobrev
e10fc01bff
Changed type maps to only return types - no strings.
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
7 years ago
Dimitar Dobrev
76d8182fe6
Simplified type maps by using static objects to disable as needed.
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
7 years ago
Dimitar Dobrev
b7d3d36ff1
Renamed members related to indentation for more clarity.
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
7 years ago
Dimitar Dobrev
d243780e67
Optimized the generation of C# by not splitting any strings.
...
Our indention of lines in blocks was inadequate so we used to split strings by new lines, indent each line and put it back together. Creation of new strings is incredibly slow so this bogged our code generation down. I have now fixed indention properly and we no longer need to split already written blocks to indent them.
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
7 years ago
Dimitar Dobrev
34ad79529d
Optimized the generation of C# by avoiding splitting.
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
7 years ago
Dimitar Dobrev
eec05041a3
Fixed the generated C# for templates with > 1 ctor taking a pointer to a class.
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
7 years ago
Dimitar Dobrev
637018f4d6
Fixed the generated C# for setters with default parameters.
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
7 years ago
Dimitar Dobrev
1420bd9216
Fixed the generated C# for public fields with types mapped to primitive.
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
7 years ago
Dimitar Dobrev
fcb3b93f55
Fixed the generated C# for destructors of abstract classes.
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
7 years ago
Dimitar Dobrev
695a7538d1
Made the checking if a type is const char* universally accessible.
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
7 years ago
Rokas Kupstys
d8b53721ef
Fix for #1043 ( #1044 )
...
Field property getter returns non-value types by reference instead of by copy.
Fixes #1043
* Minor code clarity cleanup in GenerateFieldSetter. No behavior changed.
* Fix incorrect code generated in some cases.
* Test for fields getters returning references.
8 years ago
Dimitar Dobrev
10c8211a7c
Fixed the generated C# when a template interface specialised with another specialisation returns a template parameter.
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
8 years ago
Dimitar Dobrev
08bebbb5eb
Fixed the generated C# when a default arg is assigned a specialisation also used as a secondary base.
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
8 years ago
Dimitar Dobrev
ae9eede6f1
Fixed a crash when a constructor takes a template or specialisation.
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
8 years ago
Dimitar Dobrev
6dec97fd99
Fixed the generated C# for public fields with type a dependent pointer.
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
8 years ago
Dimitar Dobrev
4b310875d3
Enabled classes having specializations for secondary bases to call their extensions.
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
8 years ago
Dimitar Dobrev
a119bdb3f0
Fixed the generated C# for subclasses of specialisations used as secondary bases.
...
Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
8 years ago