GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Don't emit __extends if one is already in scope by RyanCavanaugh · Pull Request #1356 · microsoft/TypeScript

Conversation

@RyanCavanaugh

@RyanCavanaugh Ryan Cavanaugh (RyanCavanaugh) commented Dec 3, 2014

Copy link
Copy Markdown
Member

Addresses #1350 and probably some other suggestions as well.

This changes the "do we need to emit __extends" logic to see if a symbol named __extends is already in visible scope at the site of the class declaration.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@RyanCavanaugh
Don't emit __extends if one is already in scope
af228b5
mhegazy
mhegazy reviewed Dec 4, 2014
View reviewed changes
Comment thread src/compiler/checker.ts

@mhegazy Mohamed Hegazy (mhegazy) Dec 4, 2014

Copy link
Copy Markdown
Contributor

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.

would this work:

module M {
  export var __extends = () =>{};

  class A { }
  class B extends A { }
}

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@RyanCavanaugh Ryan Cavanaugh (RyanCavanaugh) Dec 4, 2014

Copy link
Copy Markdown
Member Author

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.

Good point. Should we have the emitter handle this, or just say that only a global __extends is valid?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@mhegazy Mohamed Hegazy (mhegazy) Dec 4, 2014

Copy link
Copy Markdown
Contributor

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.

I can go either ways. limiting it to global __extends seems simple to implement and handles common scenarios.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@CyrusNajmabadi Cyrus Najmabadi (CyrusNajmabadi) Dec 8, 2014

Copy link
Copy Markdown
Contributor

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.

please break this into multiple lines. Or provide a helper function for it.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@yortus Troy Gerwien (yortus) mentioned this pull request Dec 18, 2014
Expected behaviour of __extends with static accessors? #1520
Closed
@mhegazy Mohamed Hegazy (mhegazy) closed this Jan 8, 2015
@danquirk Dan Quirk (danquirk) mentioned this pull request Feb 11, 2015
Add ability to specify the external __extends function #2009
Closed
@DickvdBrink Dick van den Brink (DickvdBrink) mentioned this pull request Mar 25, 2015
How to overwrite __extends emitter? #2487
Closed
@whitneyit James Whitney (whitneyit) mentioned this pull request Apr 24, 2015
Add support for --noEmitHelpers flag #2901
Merged
@CyrusNajmabadi
Cyrus Najmabadi (CyrusNajmabadi) deleted the noExtendsEmit branch June 4, 2015 00:14
@microsoft Microsoft (microsoft) locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@RyanCavanaugh @CyrusNajmabadi @mhegazy @sheetalkamat
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.