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

in 1.8 comments are removed from empty blocks and unreachable places regardless of the unset --removeComments flag #6069

Closed
zpdDG4gta8XKpMCd opened this issue Dec 11, 2015 · 0 comments · Fixed by #22141
Assignees
Labels
Bug A bug in TypeScript Domain: Comment Emit The issue relates to the emission of comments when compiling Fixed A PR has been merged for this issue

Comments

@zpdDG4gta8XKpMCd
Copy link

Case 1

typescript

 try {
                // AB: might throw if a property is readonly
                data[key] = null;
            } catch(e) {
                // AB: Here we are swallowing the exception on the attempt to write to a read-only property.
                // An alternative for using try/catch would be to use Object.getOwnPropertyDescriptor
                // which, when called for every single enumerable property, is slow, compared to
                // a few failed attempts to write to read only.
            }

javascript

try {
                    // AB: might throw if a property is readonly
                    data[key] = null;
                }
                catch (e) {
                }

Case 2

typescript

    try {
        stack = undefined;
        /* tslint:disable:no-throw */
        throw new Error();
        /* tslint:enable:no-throw */
    } catch (e) {
        stack = e.stack.split('\n');
    }

javascript

try {
            stack = undefined;
            /* tslint:disable:no-throw */
            throw new Error();
        }
        catch (e) {
            stack = e.stack.split('\n');
        }
@zpdDG4gta8XKpMCd zpdDG4gta8XKpMCd changed the title comments are removed from empty blocks regardless of the unset --removeComments flag in 1.8 comments are removed from empty blocks and unreachable places regardless of the unset --removeComments flag Dec 11, 2015
@mhegazy mhegazy added Bug A bug in TypeScript Help Wanted You can do this labels Jan 8, 2016
@mhegazy mhegazy added this to the TypeScript 2.0 milestone Jan 8, 2016
AntonTolmachev pushed a commit to AntonTolmachev/TypeScript that referenced this issue Apr 7, 2016
AntonTolmachev pushed a commit to AntonTolmachev/TypeScript that referenced this issue Apr 7, 2016
@mhegazy mhegazy modified the milestones: TypeScript 2.1, TypeScript 2.0 Jun 8, 2016
@mhegazy mhegazy modified the milestones: TypeScript 2.1, Future Sep 29, 2016
@DanielRosenwasser DanielRosenwasser added the Domain: Comment Emit The issue relates to the emission of comments when compiling label Aug 3, 2017
@weswigham weswigham self-assigned this Mar 3, 2018
@weswigham weswigham modified the milestones: Future, TypeScript 2.8 Mar 3, 2018
@weswigham weswigham added Fixed A PR has been merged for this issue and removed Help Wanted You can do this labels Mar 3, 2018
@microsoft microsoft locked and limited conversation to collaborators Jul 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Domain: Comment Emit The issue relates to the emission of comments when compiling Fixed A PR has been merged for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants