Skip to content
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

Modify help links to choose a more specific factory method #76

Open
zspitz opened this issue Jun 26, 2019 · 1 comment
Open

Modify help links to choose a more specific factory method #76

zspitz opened this issue Jun 26, 2019 · 1 comment
Labels
enhancement New feature or request

Comments

@zspitz
Copy link
Owner

zspitz commented Jun 26, 2019

Currently, (except for BinaryExpression and UnaryExpression which return the method based on the expression's NodeType) all factory methods which return the same object type as the node are displayed. For example, MemberExpression displays:

  • Field
  • MakeMemberAccess
  • Property
  • PropertyOrField

It might be better to show only the specific method that applies to this node, duplicating the logic of the factory methods formatter.

OTOH, as long as there aren't too many, it might be better to show all these possibilities.

@zspitz zspitz added enhancement New feature or request visualizer ui labels Jun 26, 2019
@zspitz zspitz changed the title Help link to more specific factory method Modify help links to choose a more specific factory method Jun 26, 2019
@zspitz
Copy link
Owner Author

zspitz commented Jul 6, 2021

Useful LINQPad query:

var groups = typeof(System.Linq.Expressions.Expression).GetMethods()
    .Where(x => x.IsStatic)
    .GroupBy(
        x => x.ReturnType.Name,
        (key, grp) => grp.GroupBy(
            x => x.Name, 
            (name, innerGrp) => (key, name, string.Join(", ", innerGrp.Select(mthd => mthd.GetParameters().Length).OrderBy(x => x)))
        ).OrderBy(x => x.Item1)
    );
foreach (var grp in groups.Where(x => x.First().Item1 is not "BinaryExpression" and not "UnaryExpression")) {
    grp.Dump();
}
NewExpression New 1, 1, 2, 2, 3, 3
ParameterExpression Parameter 1, 2
ParameterExpression Variable 1, 2
RuntimeVariablesExpression RuntimeVariables 1, 1
SwitchCase SwitchCase 2, 2
SwitchExpression Switch 2, 3, 4, 4, 5, 5
SymbolDocumentInfo SymbolDocument 1, 2, 3, 4
TryExpression TryFault 2
TryExpression TryFinally 2
TryExpression TryCatch 2
TryExpression TryCatchFinally 3
TryExpression MakeTry 5
TypeBinaryExpression TypeIs 2
TypeBinaryExpression TypeEqual 2
LoopExpression Loop 1, 2, 3
MemberAssignment Bind 2, 2
MemberExpression Field 2, 2, 3
MemberExpression Property 2, 2, 2, 3
MemberExpression PropertyOrField 2
MemberExpression MakeMemberAccess 2
MemberInitExpression MemberInit 2, 2
MemberListBinding ListBind 2, 2, 2, 2
MemberMemberBinding MemberBind 2, 2, 2, 2
MethodCallExpression Call 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 6
MethodCallExpression ArrayIndex 2, 2
NewArrayExpression NewArrayInit 2, 2
NewArrayExpression NewArrayBounds 2, 2
IndexExpression MakeIndex 3
IndexExpression ArrayAccess 2, 2
IndexExpression Property 3, 3, 3
InvocationExpression Invoke 2, 2
LabelExpression Label 1, 2
LabelTarget Label 0, 1, 1, 2
Expression`1 Lambda 2, 2, 3, 3, 3, 4
LambdaExpression Lambda 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5
Type GetFuncType 1
Type GetActionType 1
Type GetDelegateType 1
Boolean TryGetFuncType 2
Boolean TryGetActionType 2
ListInitExpression ListInit 2, 2, 2, 2, 3, 3
BlockExpression Block 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 4, 5
CatchBlock Catch 2, 2, 3, 3
CatchBlock MakeCatchBlock 4
ConditionalExpression Condition 3, 4
ConditionalExpression IfThen 2
ConditionalExpression IfThenElse 3
ConstantExpression Constant 1, 2
DebugInfoExpression DebugInfo 5
DebugInfoExpression ClearDebugInfo 1
DefaultExpression Empty 0
DefaultExpression Default 1
IOrderedEnumerable<ValueTuple<String,String,String>> (1 item)
ElementInit ElementInit 2, 2
DynamicExpression Dynamic 3, 3, 3, 4, 5, 6
DynamicExpression MakeDynamic 3, 3, 3, 4, 5, 6
GotoExpression Break 1, 2, 2, 3
GotoExpression Continue 1, 2
GotoExpression Return 1, 2, 2, 3
GotoExpression Goto 1, 2, 2, 3
GotoExpression MakeGoto 4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant