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

fix: enable use_define_for_class_fields #38

Merged
merged 1 commit into from
Nov 3, 2021

Conversation

dsherret
Copy link
Member

@dsherret dsherret commented Nov 3, 2021

It was previously incorrectly emitting like so:

export class EventEmitter {
    static  #init() {
    }
}

EventEmitter.call = function call(thisArg) {
    EventEmitter.#init(thisArg);
};

Fixes:

Uncaught SyntaxError: Private field '#init' must be declared in an enclosing class
    at https://deno.land/[email protected]/node/events.ts:493:16

fn_bind: false,
import_assertions: true,
static_blocks: true,
private_in_object: true,
Copy link
Member Author

Choose a reason for hiding this comment

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

This is copying what's done in deno_ast. We will have to reuse that code later.

pragma_frag: Some(options.jsx_fragment_factory.clone()),
import_not_used_as_values:
typescript::strip::ImportsNotUsedAsValues::Remove,
use_define_for_class_fields: true,
Copy link
Member Author

Choose a reason for hiding this comment

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

Fix is here.

@@ -44,7 +44,7 @@ pub fn get_deps_and_transpile(
.new_source_file(FileName::Custom(url.to_string()), source.to_string());
let input = StringInput::from(&*source_file);
let syntax = get_syntax(url, content_type);
let lexer = Lexer::new(syntax, JscTarget::Es2020, input, Some(&comments));
let lexer = Lexer::new(syntax, JscTarget::Es2021, input, Some(&comments));
Copy link
Member Author

Choose a reason for hiding this comment

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

This is what we use in deno_ast.

@dsherret dsherret merged commit e5aa7f9 into denoland:main Nov 3, 2021
@dsherret dsherret deleted the fix_use_define_for_class_fields branch November 3, 2021 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants