Граф коммитов

5 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 8ad9df8523
[autoformat] Add generator tests. (#16800) 2022-11-17 17:04:21 -05:00
Rolf Bjarne Kvinge 2972e1b715
Fix some whitespace issues in various files. (#12399)
* Remove BOM
* Add EOL at end of file.
2021-08-11 10:06:46 +02:00
Alex Soto 81e1340865 [generator] Persist BindAs attribute information in generated code.
Persisting BindAs attributes is required for the registrars to be able to
handle methods with BindAs attributes correctly.

Generator diff: https://gist.github.com/rolfbjarne/0fafbce9373ff1f407839a20ea5e72e9
2017-07-04 07:31:13 +02:00
Rolf Bjarne Kvinge 88c276e0aa [tests][generator] Port XI/Classic tests to XI/Unified. (#1745)
* [tests][generator] Port XI/Classic tests to XI/Unified.

* [tests][generator] Comment out code triggering previously unknown bugs.

These tests makes the generator fail:

    error BI0000: Unexpected error - Please file a bug report at http://bugzilla.xamarin.com
    System.NullReferenceException: Object reference not set to an instance of an object
      at Generator.GetSetterExportAttribute (System.Reflection.PropertyInfo pinfo) [0x0002e] in /work/maccore/master/xamarin-macios/src/generator.cs:1981
      at Generator.Go () [0x007e3] in /work/maccore/master/xamarin-macios/src/generator.cs:2162
      at BindingTouch.Main2 (System.String[] args) [0x010b2] in /work/maccore/master/xamarin-macios/src/btouch.cs:435
      at BindingTouch.Main (System.String[] args) [0x0001d] in /work/maccore/master/xamarin-macios/src/btouch.cs:77
      at System.Environment.get_StackTrace () [0x00000] in /work/maccore/master/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/corlib/System/Environment.cs:321
      at ErrorHelper.ShowInternal (System.Exception e) [0x000dc] in /work/maccore/master/xamarin-macios/src/error.cs:200
      at ErrorHelper.Show (System.Exception e) [0x00027] in /work/maccore/master/xamarin-macios/src/error.cs:151
      at BindingTouch.Main (System.String[] args) [0x0002b] in /work/maccore/master/xamarin-macios/src/btouch.cs:79

This has been filed as https://bugzilla.xamarin.com/show_bug.cgi?id=52664.

* [tests][generator] Comment out code triggering previously unknown bugs.

This has been filed as https://bugzilla.xamarin.com/show_bug.cgi?id=52665.
2017-02-22 16:47:11 +01:00
Alex Soto 1799c2f489 [generator] Add BindAs support (#1476)
* [generator] Add BindAs support for NSValue and NSNumber
https://trello.com/c/RYCPEnkh

The intent of BindAs attribute is to have a binding definition as

	[return: BindAs (typeof (bool?))]
	[Export ("boolMethod:")]
	NSNumber BoolMethod (int arg1);

and our generator outputs

	[Export ("boolMethod:")]
	public virtual global::System.Nullable<bool> BoolMethod (int arg1) { ...  }

So we internally do the NSNumber <-> bool conversion, this also
applies to properties, parameters and methods.

* [generator] Fix a small formating issue

* [tests] Add BindAsAttribute generator tests

* [generator] Implement @spouliot's feedback

* [tests] Add BI1048 and BI1049 error tests for [BindAs]

* [generator] Implement Rolf's suggestion to avoid almost all string comparisons in [BindAs] for types

* [generator] Add BindAs support for smart enums and arrays with tests

* [generator] Some code clean up and implementation of PR feedback

* [generator] Add Protocol|Model checks and tests also a NRE check in NSArray creator

BindAs attribute cannot be used in Protocol|Model interfaces

* [generator] Add NSNumber <-> Enum support

* [docs] add BindAs documentation

* [docs] Implement documentation feedback for BindAs
2017-01-25 07:14:55 +01:00