perf(semantic): reduce calls to span() (#1851)

This commit is contained in:
Dunqing 2023-12-29 11:40:53 +08:00 committed by GitHub
parent 19577709db
commit 0e0f25872f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -430,7 +430,8 @@ fn check_module_declaration<'a>(
| ModuleDeclaration::TSExportAssignment(_) | ModuleDeclaration::TSExportAssignment(_)
| ModuleDeclaration::TSNamespaceExportDeclaration(_) => "export statement", | ModuleDeclaration::TSNamespaceExportDeclaration(_) => "export statement",
}; };
let span = Span::new(decl.span().start, decl.span().start + 6); let start = decl.span().start;
let span = Span::new(start, start + 6);
match ctx.source_type.module_kind() { match ctx.source_type.module_kind() {
ModuleKind::Script => { ModuleKind::Script => {
ctx.error(ModuleCode(text, span)); ctx.error(ModuleCode(text, span));