Skip to content

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

@zpdDG4gta8XKpMCd

Description

@zpdDG4gta8XKpMCd

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');
        }

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: Comment EmitThe issue relates to the emission of comments when compilingFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions