-
Notifications
You must be signed in to change notification settings - Fork 63
method parameter type may contain "params " and cannot be used by fields. #263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
tools/generator/CodeGenerator.cs
Outdated
| return "void"; | ||
| if (s.StartsWith ("params ")) | ||
| return "params " + GetOutputName (s.Substring (6)); | ||
| return "params " + GetOutputName (s.Substring (7)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is 7 coming from? Presumably it's "params ".Length.
Assuming that 7 is coming from a string length, could you lease replace 7 with e.g. "params ".Length, so that the source value is obvious?
tools/generator/InterfaceGen.cs
Outdated
| continue; | ||
| sw.WriteLine (); | ||
| sw.WriteLine ("{0}\t{1} {2};", indent, opt.GetOutputName (p.Type), opt.GetSafeIdentifier (p.Name)); | ||
| var safeTypeName = p.Type.StartsWith ("params ", StringComparison.Ordinal) ? p.Type.Substring (7) : p.Type; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This usage makes the 7 a bit more obvious, as "params " is on the same line/nearby (unlike the previous spot), but I would still prefer use of "params ".Length over a hardcoded 7.
|
If you think your suggested changes are REALLY important, then make another PR to achieve them. |
| string args_name = GetArgsName (m); | ||
| if (m.RetVal.IsVoid || m.IsEventHandlerWithHandledProperty) { | ||
| if (!m.IsSimpleEventHandler || m.IsEventHandlerWithHandledProperty) { | ||
| sw.WriteLine ("{0}// event args for {1}.{2}", indent, this.JavaName, m.JavaName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is causing the unit tests to fail, as the expected file contents don't contain it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
…lds. This fixes dotnet/android#1138 It is quite corner case, where ... arguments are used in interfaces that can be converted to events. Parameter types cannot be simply used for fields and parameters because they cannot take "params" as their modifiers. The real code fix should be in Parameter.cs, but that would require a lot of changes unlike this tiny fix.
425738f to
7ff8d10
Compare
This fixes dotnet/android#1138
It is quite corner case, where ... arguments are used in interfaces that
can be converted to events.
Parameter types cannot be simply used for fields and parameters because
they cannot take "params" as their modifiers.
The real code fix should be in Parameter.cs, but that would require
a lot of changes unlike this tiny fix.