Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Remove TODO comment
  • Loading branch information
weswigham committed Aug 17, 2016
commit 720cf54547b848e1d75501095dd1f61f2cdbf41b
1 change: 0 additions & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13916,7 +13916,6 @@ namespace ts {

checkDecorators(node);
checkSignatureDeclaration(node);
// TODO (weswig): Consolidate the below into checkAllCodePathsInNonVoidFunctionReturnOrThrow
if (node.kind === SyntaxKind.GetAccessor) {
Copy link
Member

Choose a reason for hiding this comment

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

Does this imply there's more work to do?

Copy link
Member Author

Choose a reason for hiding this comment

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

Mmmm... Maybe. I wanted a second opinion on that. The remaining code below
is getter-specific, so I'm unsure of weather or not it should be merged
into checkAllCodePathsInNonVoidFunction.

On Mon, Aug 8, 2016, 11:01 AM Anders Hejlsberg [email protected]
wrote:

In src/compiler/checker.ts
#10102 (comment):

@@ -13916,14 +13916,10 @@ namespace ts {

             checkDecorators(node);
             checkSignatureDeclaration(node);
  •            // TODO (weswig): Consolidate the below into checkAllCodePathsInNonVoidFunctionReturnOrThrow
    

Does this imply there's more work to do?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/TypeScript/pull/10102/files/89419511803e3c3e8cae0ccad4a9678d272b199e#r73922852,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACzAMihmhfYNeSrrNmgI6Y63i2Cf1cZWks5qd27jgaJpZM4JbGAe
.

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 the remaining code is just cherry picking the case where the accessor has an implicit return and no explicit returns. Not sure why that case needs special treatmeant if it is already handled in the checkAllCodePathsEtcEtc function. What happens to the baselines if you remove it?

Copy link
Member Author

Choose a reason for hiding this comment

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

The checkAllCodePathsInNonVoidFunction actually doesn't handle that case, because for a normal function it is allowed. Removing the below block literally just removes that error (that a get accessor must contain an explicit return value) from every baseline.

if (!isInAmbientContext(node) && nodeIsPresent(node.body) && (node.flags & NodeFlags.HasImplicitReturn)) {
if (!(node.flags & NodeFlags.HasExplicitReturn)) {
Expand Down