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

Local functions update: Use detection, expression trees, inferred multiple returns #3849

Merged
merged 4 commits into from
Jul 8, 2015

Conversation

khyperia
Copy link
Contributor

@khyperia khyperia commented Jul 7, 2015

Things in this PR:

  • The type BoundBlock now contains an ImmutableArray<LocalFunctionSymbol> alongside its ImmutableArray<LocalSymbol>. This generates lots of noise in this PR, as a lot of construction sites had to be updated. Note that this was planned from the start, in the original local functions discussion BoundBlock having a list was mentioned, but I just never got around to adding it (as it was never needed).
  • Data flow analysis now reports unused local functions. This is the reason why BoundBlock suddenly needs a symbol list only now, this far in.
  • References to local functions are now disallowed in expression trees, which may or may not change in the future (Previously they were generated as a reference to a mangled method name, which seemed wrong). Added a new error for this.
  • Multiple return statements in an inferred return type local function must all have exactly the same type. This may change later, but for this prototype it's an acceptable restriction. Added a new error for this.

FYI @jaredpar @VSadov @agocke Theoretically these PRs will get smaller and more frequent compared to the first three, but this one is rather noisy due to the BoundBlock change.


internal override ImmutableArray<LocalFunctionSymbol> GetDeclaredLocalFunctionsForScope(CSharpSyntaxNode node)
{
if (node.Kind() == SyntaxKind.Block)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this logic is the same as the above function. Move into a helper?

@khyperia
Copy link
Contributor Author

khyperia commented Jul 8, 2015

@dotnet-bot test this please

1 similar comment
@khyperia
Copy link
Contributor Author

khyperia commented Jul 8, 2015

@dotnet-bot test this please

khyperia added a commit that referenced this pull request Jul 8, 2015
Local functions update: Use detection, expression trees, inferred multiple returns
@khyperia khyperia merged commit 831890a into dotnet:features/local-functions Jul 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants