-
Notifications
You must be signed in to change notification settings - Fork 513
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
Directly move functions instead of making methods #1261
base: main
Are you sure you want to change the base?
Conversation
{ | ||
if (!function.IsGenerated) continue; | ||
|
||
foreach (var function in from function in context.Functions |
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.
Overkill usage of query LINQ
@@ -443,7 +445,10 @@ public override bool VisitClassDecl(Class @class) | |||
} | |||
|
|||
GenerateClassConstructors(@class); | |||
|
|||
foreach (var function in from function in @class.Functions |
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.
Same
function.Parameters[0].Name, function.Parameters[1].Name); | ||
Type retType = function.OriginalReturnType.Type.Desugar(); | ||
bool regular = retType.IsPrimitiveType(PrimitiveType.Bool); | ||
WriteLineIndent($@"return {(regular ? string.Empty : "global::System.Convert.ToInt32(")}{ |
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.
Could use some refactoring, and comments
List<Method> methods = HandleMissingOperatorOverloadPair( | ||
@class, @class.Operators, op1, op2); | ||
foreach (Method @operator in methods) | ||
{ |
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.
Add some space between statements in this method
This keeps the original functions instead of ignoring them which helps when rearranging passes - in particular when the pass for symbols is involved. Signed-off-by: Dimitar Dobrev <[email protected]>
e94ae29
to
f6f52ac
Compare
@@ -443,7 +443,8 @@ public override bool VisitClassDecl(Class @class) | |||
} | |||
|
|||
GenerateClassConstructors(@class); | |||
|
|||
foreach (Function function in @class.Functions.Where(f => f.IsGenerated)) | |||
GenerateFunction(function, @class.Name); | |||
GenerateClassMethods(@class.Methods); |
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.
Add newline here.
|
||
Write("{0} {1}::{2}(", function.ReturnType, classSig, | ||
function.Name); | ||
Write($@"{function.ReturnType} {QualifiedIdentifier(@namespace)}::{ |
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.
The previous version was easier to read.
c8e9f62
to
be54a8b
Compare
1610aa5
to
64b1efd
Compare
c930b78
to
c38556a
Compare
4c1e9b8
to
2fdd082
Compare
bcf41e4
to
851ec5e
Compare
97610ec
to
a2aeaed
Compare
This keeps the original functions instead of ignoring them which helps when rearranging passes - in particular when the pass for symbols is involved.