mirror of
https://github.com/swc-project/swc.git
synced 2024-12-28 08:04:43 +03:00
perf(es/transform): Use SingleThreadedComments
for transform (#3847)
This commit is contained in:
parent
126785681b
commit
73ec0b3dd7
@ -9,7 +9,7 @@ use napi::{
|
||||
Env, Task,
|
||||
};
|
||||
use swc::{config::ParseOptions, Compiler};
|
||||
use swc_common::FileName;
|
||||
use swc_common::{comments::Comments, FileName};
|
||||
|
||||
use crate::{
|
||||
get_compiler,
|
||||
@ -43,6 +43,12 @@ impl Task for ParseTask {
|
||||
.cm
|
||||
.new_source_file(self.filename.clone(), self.src.clone());
|
||||
|
||||
let comments = if options.comments {
|
||||
Some(self.c.comments() as &dyn Comments)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let program = try_with(self.c.cm.clone(), false, |handler| {
|
||||
self.c.parse_js(
|
||||
fm,
|
||||
@ -50,7 +56,7 @@ impl Task for ParseTask {
|
||||
options.target,
|
||||
options.syntax,
|
||||
options.is_module,
|
||||
options.comments,
|
||||
comments,
|
||||
)
|
||||
})
|
||||
.convert_err()?;
|
||||
@ -81,13 +87,20 @@ impl Task for ParseFileTask {
|
||||
.load_file(&self.path)
|
||||
.context("failed to read module")?;
|
||||
|
||||
let c = self.c.comments().clone();
|
||||
let comments = if options.comments {
|
||||
Some(&c as &dyn Comments)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
self.c.parse_js(
|
||||
fm,
|
||||
handler,
|
||||
options.target,
|
||||
options.syntax,
|
||||
options.is_module,
|
||||
options.comments,
|
||||
comments,
|
||||
)
|
||||
})
|
||||
})
|
||||
@ -146,13 +159,20 @@ pub fn parse_sync(src: String, opts: Buffer, filename: Option<String>) -> napi::
|
||||
let program = try_with(c.cm.clone(), false, |handler| {
|
||||
c.run(|| {
|
||||
let fm = c.cm.new_source_file(filename, src);
|
||||
|
||||
let comments = if options.comments {
|
||||
Some(c.comments() as &dyn Comments)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
c.parse_js(
|
||||
fm,
|
||||
handler,
|
||||
options.target,
|
||||
options.syntax,
|
||||
options.is_module,
|
||||
options.comments,
|
||||
comments,
|
||||
)
|
||||
})
|
||||
})
|
||||
@ -173,13 +193,19 @@ pub fn parse_file_sync(path: String, opts: Buffer) -> napi::Result<String> {
|
||||
c.cm.load_file(Path::new(path.as_str()))
|
||||
.expect("failed to read program file");
|
||||
|
||||
let comments = if options.comments {
|
||||
Some(c.comments() as &dyn Comments)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
c.parse_js(
|
||||
fm,
|
||||
handler,
|
||||
options.target,
|
||||
options.syntax,
|
||||
options.is_module,
|
||||
options.comments,
|
||||
comments,
|
||||
)
|
||||
})
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ fn parse(c: &swc::Compiler) -> (Arc<SourceFile>, Program) {
|
||||
);
|
||||
let handler = Handler::with_emitter_writer(Box::new(io::stderr()), Some(c.cm.clone()));
|
||||
|
||||
let comments = c.comments().clone();
|
||||
(
|
||||
fm.clone(),
|
||||
c.parse_js(
|
||||
@ -41,7 +42,7 @@ fn parse(c: &swc::Compiler) -> (Arc<SourceFile>, Program) {
|
||||
EsVersion::Es5,
|
||||
Syntax::Typescript(Default::default()),
|
||||
IsModule::Bool(true),
|
||||
true,
|
||||
Some(&comments),
|
||||
)
|
||||
.unwrap(),
|
||||
)
|
||||
|
@ -4,8 +4,12 @@ use compat::{es2015::regenerator, es2020::export_namespace_from};
|
||||
use either::Either;
|
||||
use swc_atoms::JsWord;
|
||||
use swc_common::{
|
||||
chain, comments::Comments, errors::Handler, sync::Lrc, util::take::Take, FileName, Mark,
|
||||
SourceMap,
|
||||
chain,
|
||||
comments::{Comments, SingleThreadedComments},
|
||||
errors::Handler,
|
||||
sync::Lrc,
|
||||
util::take::Take,
|
||||
FileName, Mark, SourceMap,
|
||||
};
|
||||
use swc_ecma_ast::{EsVersion, Module};
|
||||
use swc_ecma_minifier::option::MinifyOptions;
|
||||
@ -17,9 +21,8 @@ use swc_ecma_transforms::{
|
||||
};
|
||||
use swc_ecma_visit::{as_folder, noop_visit_mut_type, VisitMut};
|
||||
|
||||
use crate::{
|
||||
config::{util::BoolOrObject, CompiledPaths, GlobalPassOption, JsMinifyOptions, ModuleConfig},
|
||||
SwcComments,
|
||||
use crate::config::{
|
||||
util::BoolOrObject, CompiledPaths, GlobalPassOption, JsMinifyOptions, ModuleConfig,
|
||||
};
|
||||
|
||||
/// Builder is used to create a high performance `Compiler`.
|
||||
@ -162,7 +165,7 @@ impl<'a, 'b, P: swc_ecma_visit::Fold> PassBuilder<'a, 'b, P> {
|
||||
base: &FileName,
|
||||
syntax: Syntax,
|
||||
module: Option<ModuleConfig>,
|
||||
comments: Option<&'cmt SwcComments>,
|
||||
comments: Option<&'cmt SingleThreadedComments>,
|
||||
) -> impl 'cmt + swc_ecma_visit::Fold
|
||||
where
|
||||
P: 'cmt,
|
||||
@ -318,7 +321,7 @@ impl<'a, 'b, P: swc_ecma_visit::Fold> PassBuilder<'a, 'b, P> {
|
||||
struct MinifierPass {
|
||||
options: Option<JsMinifyOptions>,
|
||||
cm: Lrc<SourceMap>,
|
||||
comments: Option<SwcComments>,
|
||||
comments: Option<SingleThreadedComments>,
|
||||
top_level_mark: Mark,
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@ use swc_cached::regex::CachedRegex;
|
||||
pub use swc_common::chain;
|
||||
use swc_common::{
|
||||
collections::{AHashMap, AHashSet},
|
||||
comments::SingleThreadedComments,
|
||||
errors::Handler,
|
||||
FileName, Mark, SourceMap, SyntaxContext,
|
||||
};
|
||||
@ -65,7 +66,7 @@ use self::util::BoolOrObject;
|
||||
use crate::{
|
||||
builder::PassBuilder,
|
||||
plugin::{PluginConfig, PluginContext},
|
||||
SwcComments, SwcImportResolver,
|
||||
SwcImportResolver,
|
||||
};
|
||||
|
||||
#[cfg(test)]
|
||||
@ -257,6 +258,8 @@ impl Default for InputSourceMap {
|
||||
|
||||
impl Options {
|
||||
/// `parse`: `(syntax, target, is_module)`
|
||||
///
|
||||
/// `parse` should use `comments`.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn build_as_input<'a, P>(
|
||||
&self,
|
||||
@ -268,7 +271,7 @@ impl Options {
|
||||
handler: &Handler,
|
||||
is_module: IsModule,
|
||||
config: Option<Config>,
|
||||
comments: Option<&'a SwcComments>,
|
||||
comments: Option<&'a SingleThreadedComments>,
|
||||
custom_before_pass: impl FnOnce(&Program) -> P,
|
||||
) -> Result<BuiltInput<impl 'a + swc_ecma_visit::Fold>, Error>
|
||||
where
|
||||
@ -505,6 +508,7 @@ impl Options {
|
||||
input_source_map: config.input_source_map.clone(),
|
||||
output_path: output_path.map(|v| v.to_path_buf()),
|
||||
source_file_name,
|
||||
comments: comments.cloned(),
|
||||
preserve_comments,
|
||||
})
|
||||
}
|
||||
@ -966,6 +970,7 @@ pub struct BuiltInput<P: swc_ecma_visit::Fold> {
|
||||
|
||||
pub source_file_name: Option<String>,
|
||||
|
||||
pub comments: Option<SingleThreadedComments>,
|
||||
pub preserve_comments: Option<BoolOrObject<JsMinifyCommentOption>>,
|
||||
|
||||
pub inline_sources_content: bool,
|
||||
|
@ -105,6 +105,7 @@
|
||||
//!
|
||||
//! See [swc_ecma_minifier::eval::Evaluator].
|
||||
#![deny(unused)]
|
||||
#![allow(clippy::too_many_arguments)]
|
||||
#![cfg_attr(docsrs, feature(doc_cfg))]
|
||||
|
||||
pub extern crate swc_atoms as atoms;
|
||||
@ -123,7 +124,9 @@ use anyhow::{bail, Context, Error};
|
||||
use atoms::JsWord;
|
||||
use common::{
|
||||
collections::AHashMap,
|
||||
comments::SingleThreadedComments,
|
||||
errors::{EmitterWriter, HANDLER},
|
||||
Span,
|
||||
};
|
||||
use config::{util::BoolOrObject, IsModule, JsMinifyCommentOption, JsMinifyOptions};
|
||||
use once_cell::sync::Lazy;
|
||||
@ -420,48 +423,24 @@ impl Compiler {
|
||||
target: EsVersion,
|
||||
syntax: Syntax,
|
||||
is_module: IsModule,
|
||||
parse_comments: bool,
|
||||
comments: Option<&dyn Comments>,
|
||||
) -> Result<Program, Error> {
|
||||
self.run(|| {
|
||||
let mut error = false;
|
||||
|
||||
let mut errors = vec![];
|
||||
let program_result = match is_module {
|
||||
IsModule::Bool(true) => parse_file_as_module(
|
||||
&fm,
|
||||
syntax,
|
||||
target,
|
||||
if parse_comments {
|
||||
Some(&self.comments)
|
||||
} else {
|
||||
None
|
||||
},
|
||||
&mut errors,
|
||||
)
|
||||
.map(Program::Module),
|
||||
IsModule::Bool(false) => parse_file_as_script(
|
||||
&fm,
|
||||
syntax,
|
||||
target,
|
||||
if parse_comments {
|
||||
Some(&self.comments)
|
||||
} else {
|
||||
None
|
||||
},
|
||||
&mut errors,
|
||||
)
|
||||
.map(Program::Script),
|
||||
IsModule::Unknown => parse_file_as_program(
|
||||
&fm,
|
||||
syntax,
|
||||
target,
|
||||
if parse_comments {
|
||||
Some(&self.comments)
|
||||
} else {
|
||||
None
|
||||
},
|
||||
&mut errors,
|
||||
),
|
||||
IsModule::Bool(true) => {
|
||||
parse_file_as_module(&fm, syntax, target, comments, &mut errors)
|
||||
.map(Program::Module)
|
||||
}
|
||||
IsModule::Bool(false) => {
|
||||
parse_file_as_script(&fm, syntax, target, comments, &mut errors)
|
||||
.map(Program::Script)
|
||||
}
|
||||
IsModule::Unknown => {
|
||||
parse_file_as_program(&fm, syntax, target, comments, &mut errors)
|
||||
}
|
||||
};
|
||||
|
||||
for e in errors {
|
||||
@ -501,57 +480,12 @@ impl Compiler {
|
||||
source_map_names: &AHashMap<BytePos, JsWord>,
|
||||
orig: Option<&sourcemap::SourceMap>,
|
||||
minify: bool,
|
||||
preserve_comments: Option<BoolOrObject<JsMinifyCommentOption>>,
|
||||
comments: Option<&dyn Comments>,
|
||||
) -> Result<TransformOutput, Error>
|
||||
where
|
||||
T: Node + VisitWith<IdentCollector>,
|
||||
{
|
||||
self.run(|| {
|
||||
let preserve_comments = preserve_comments.unwrap_or({
|
||||
if minify {
|
||||
BoolOrObject::Obj(JsMinifyCommentOption::PreserveSomeComments)
|
||||
} else {
|
||||
BoolOrObject::Obj(JsMinifyCommentOption::PreserveAllComments)
|
||||
}
|
||||
});
|
||||
|
||||
let span = node.span();
|
||||
|
||||
match preserve_comments {
|
||||
BoolOrObject::Bool(true)
|
||||
| BoolOrObject::Obj(JsMinifyCommentOption::PreserveAllComments) => {}
|
||||
|
||||
BoolOrObject::Obj(JsMinifyCommentOption::PreserveSomeComments) => {
|
||||
let preserve_excl = |pos: &BytePos, vc: &mut Vec<Comment>| -> bool {
|
||||
if *pos < span.lo || *pos >= span.hi {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Preserve license comments.
|
||||
if vc.iter().any(|c| c.text.contains("@license")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
vc.retain(|c: &Comment| c.text.starts_with('!'));
|
||||
!vc.is_empty()
|
||||
};
|
||||
self.comments.leading.retain(preserve_excl);
|
||||
self.comments.trailing.retain(preserve_excl);
|
||||
}
|
||||
|
||||
BoolOrObject::Bool(false) => {
|
||||
let remove_all_in_range = |pos: &BytePos, _: &mut Vec<Comment>| -> bool {
|
||||
if *pos < span.lo || *pos >= span.hi {
|
||||
return true;
|
||||
}
|
||||
|
||||
false
|
||||
};
|
||||
self.comments.leading.retain(remove_all_in_range);
|
||||
self.comments.trailing.retain(remove_all_in_range);
|
||||
}
|
||||
}
|
||||
|
||||
let mut src_map_buf = vec![];
|
||||
|
||||
let src = {
|
||||
@ -575,7 +509,7 @@ impl Compiler {
|
||||
|
||||
let mut emitter = Emitter {
|
||||
cfg: swc_ecma_codegen::Config { minify },
|
||||
comments: if minify { None } else { Some(&self.comments) },
|
||||
comments,
|
||||
cm: self.cm.clone(),
|
||||
wr,
|
||||
};
|
||||
@ -693,6 +627,97 @@ impl SourceMapGenConfig for SwcSourceMapConfig<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn minify_global_comments(
|
||||
comments: &SwcComments,
|
||||
span: Span,
|
||||
minify: bool,
|
||||
preserve_comments: Option<BoolOrObject<JsMinifyCommentOption>>,
|
||||
) {
|
||||
let preserve_comments = preserve_comments.unwrap_or({
|
||||
if minify {
|
||||
BoolOrObject::Obj(JsMinifyCommentOption::PreserveSomeComments)
|
||||
} else {
|
||||
BoolOrObject::Obj(JsMinifyCommentOption::PreserveAllComments)
|
||||
}
|
||||
});
|
||||
|
||||
match preserve_comments {
|
||||
BoolOrObject::Bool(true)
|
||||
| BoolOrObject::Obj(JsMinifyCommentOption::PreserveAllComments) => {}
|
||||
|
||||
BoolOrObject::Obj(JsMinifyCommentOption::PreserveSomeComments) => {
|
||||
let preserve_excl = |pos: &BytePos, vc: &mut Vec<Comment>| -> bool {
|
||||
if *pos < span.lo || *pos >= span.hi {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Preserve license comments.
|
||||
if vc.iter().any(|c| c.text.contains("@license")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
vc.retain(|c: &Comment| c.text.starts_with('!'));
|
||||
!vc.is_empty()
|
||||
};
|
||||
comments.leading.retain(preserve_excl);
|
||||
comments.trailing.retain(preserve_excl);
|
||||
}
|
||||
|
||||
BoolOrObject::Bool(false) => {
|
||||
let remove_all_in_range = |pos: &BytePos, _: &mut Vec<Comment>| -> bool {
|
||||
if *pos < span.lo || *pos >= span.hi {
|
||||
return true;
|
||||
}
|
||||
|
||||
false
|
||||
};
|
||||
comments.leading.retain(remove_all_in_range);
|
||||
comments.trailing.retain(remove_all_in_range);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn minify_file_comments(
|
||||
comments: &SingleThreadedComments,
|
||||
minify: bool,
|
||||
preserve_comments: Option<BoolOrObject<JsMinifyCommentOption>>,
|
||||
) {
|
||||
let preserve_comments = preserve_comments.unwrap_or({
|
||||
if minify {
|
||||
BoolOrObject::Obj(JsMinifyCommentOption::PreserveSomeComments)
|
||||
} else {
|
||||
BoolOrObject::Obj(JsMinifyCommentOption::PreserveAllComments)
|
||||
}
|
||||
});
|
||||
|
||||
match preserve_comments {
|
||||
BoolOrObject::Bool(true)
|
||||
| BoolOrObject::Obj(JsMinifyCommentOption::PreserveAllComments) => {}
|
||||
|
||||
BoolOrObject::Obj(JsMinifyCommentOption::PreserveSomeComments) => {
|
||||
let preserve_excl = |_: &BytePos, vc: &mut Vec<Comment>| -> bool {
|
||||
// Preserve license comments.
|
||||
if vc.iter().any(|c| c.text.contains("@license")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
vc.retain(|c: &Comment| c.text.starts_with('!'));
|
||||
!vc.is_empty()
|
||||
};
|
||||
let (mut l, mut t) = comments.borrow_all_mut();
|
||||
|
||||
l.retain(preserve_excl);
|
||||
t.retain(preserve_excl);
|
||||
}
|
||||
|
||||
BoolOrObject::Bool(false) => {
|
||||
let (mut l, mut t) = comments.borrow_all_mut();
|
||||
l.clear();
|
||||
t.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// High-level apis.
|
||||
impl Compiler {
|
||||
pub fn new(cm: Arc<SourceMap>) -> Self {
|
||||
@ -817,12 +842,13 @@ impl Compiler {
|
||||
handler: &'a Handler,
|
||||
opts: &Options,
|
||||
name: &FileName,
|
||||
comments: Option<&'a SingleThreadedComments>,
|
||||
before_pass: impl 'a + FnOnce(&Program) -> P,
|
||||
) -> Result<Option<BuiltInput<impl 'a + swc_ecma_visit::Fold>>, Error>
|
||||
where
|
||||
P: 'a + swc_ecma_visit::Fold,
|
||||
{
|
||||
self.run(|| {
|
||||
self.run(move || {
|
||||
let config = self.read_config(opts, name)?;
|
||||
let config = match config {
|
||||
Some(v) => v,
|
||||
@ -834,14 +860,21 @@ impl Compiler {
|
||||
name,
|
||||
move |syntax, target, is_module| match program {
|
||||
Some(v) => Ok(v),
|
||||
_ => self.parse_js(fm.clone(), handler, target, syntax, is_module, true),
|
||||
_ => self.parse_js(
|
||||
fm.clone(),
|
||||
handler,
|
||||
target,
|
||||
syntax,
|
||||
is_module,
|
||||
comments.as_ref().map(|v| v as _),
|
||||
),
|
||||
},
|
||||
opts.output_path.as_deref(),
|
||||
opts.source_file_name.clone(),
|
||||
handler,
|
||||
opts.is_module,
|
||||
Some(config),
|
||||
Some(&self.comments),
|
||||
comments,
|
||||
before_pass,
|
||||
)?;
|
||||
Ok(Some(built))
|
||||
@ -900,6 +933,7 @@ impl Compiler {
|
||||
P2: swc_ecma_visit::Fold,
|
||||
{
|
||||
self.run(|| -> Result<_, Error> {
|
||||
let comments = SingleThreadedComments::default();
|
||||
let config = self.run(|| {
|
||||
self.parse_js_as_input(
|
||||
fm.clone(),
|
||||
@ -907,6 +941,7 @@ impl Compiler {
|
||||
handler,
|
||||
opts,
|
||||
&fm.name,
|
||||
Some(&comments),
|
||||
custom_before_pass,
|
||||
)
|
||||
})?;
|
||||
@ -933,6 +968,7 @@ impl Compiler {
|
||||
source_file_name: config.source_file_name,
|
||||
preserve_comments: config.preserve_comments,
|
||||
inline_sources_content: config.inline_sources_content,
|
||||
comments: config.comments,
|
||||
};
|
||||
|
||||
let orig = if config.source_maps.enabled() {
|
||||
@ -1008,6 +1044,8 @@ impl Compiler {
|
||||
}
|
||||
}
|
||||
|
||||
let comments = SingleThreadedComments::default();
|
||||
|
||||
let module = self
|
||||
.parse_js(
|
||||
fm.clone(),
|
||||
@ -1019,11 +1057,10 @@ impl Compiler {
|
||||
decorators_before_export: true,
|
||||
import_assertions: true,
|
||||
private_in_object: true,
|
||||
|
||||
..Default::default()
|
||||
}),
|
||||
IsModule::Bool(true),
|
||||
true,
|
||||
Some(&comments),
|
||||
)
|
||||
.context("failed to parse input file")?
|
||||
.expect_module();
|
||||
@ -1048,7 +1085,7 @@ impl Compiler {
|
||||
let mut module = swc_ecma_minifier::optimize(
|
||||
module,
|
||||
self.cm.clone(),
|
||||
Some(&self.comments),
|
||||
Some(&comments),
|
||||
None,
|
||||
&min_opts,
|
||||
&swc_ecma_minifier::option::ExtraOptions { top_level_mark },
|
||||
@ -1057,9 +1094,11 @@ impl Compiler {
|
||||
if !is_mangler_enabled {
|
||||
module.visit_mut_with(&mut hygiene())
|
||||
}
|
||||
module.fold_with(&mut fixer(Some(&self.comments as &dyn Comments)))
|
||||
module.fold_with(&mut fixer(Some(&comments as &dyn Comments)))
|
||||
});
|
||||
|
||||
minify_file_comments(&comments, true, Some(opts.format.comments.clone()));
|
||||
|
||||
self.print(
|
||||
&module,
|
||||
Some(&fm.name.to_string()),
|
||||
@ -1070,7 +1109,7 @@ impl Compiler {
|
||||
&source_map_names,
|
||||
orig.as_ref(),
|
||||
true,
|
||||
Some(opts.format.comments.clone()),
|
||||
Some(&comments),
|
||||
)
|
||||
})
|
||||
}
|
||||
@ -1118,6 +1157,10 @@ impl Compiler {
|
||||
})
|
||||
});
|
||||
|
||||
if let Some(comments) = &config.comments {
|
||||
minify_file_comments(comments, config.minify, config.preserve_comments);
|
||||
}
|
||||
|
||||
self.print(
|
||||
&program,
|
||||
config.source_file_name.as_deref(),
|
||||
@ -1128,7 +1171,7 @@ impl Compiler {
|
||||
&source_map_names,
|
||||
orig,
|
||||
config.minify,
|
||||
config.preserve_comments,
|
||||
config.comments.as_ref().map(|v| v as _),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
@ -9,9 +9,13 @@ use swc::{
|
||||
BuiltInput, Config, IsModule, JscConfig, ModuleConfig, Options, SourceMapsConfig,
|
||||
TransformConfig,
|
||||
},
|
||||
Compiler, TransformOutput,
|
||||
minify_file_comments, Compiler, TransformOutput,
|
||||
};
|
||||
use swc_common::{
|
||||
chain,
|
||||
comments::{Comment, SingleThreadedComments},
|
||||
BytePos, FileName,
|
||||
};
|
||||
use swc_common::{chain, comments::Comment, BytePos, FileName};
|
||||
use swc_ecma_ast::{EsVersion, *};
|
||||
use swc_ecma_parser::{EsConfig, Syntax, TsConfig};
|
||||
use swc_ecma_transforms::{
|
||||
@ -705,6 +709,7 @@ fn should_visit() {
|
||||
"
|
||||
.into(),
|
||||
);
|
||||
let comments = SingleThreadedComments::default();
|
||||
let config = c
|
||||
.parse_js_as_input(
|
||||
fm.clone(),
|
||||
@ -725,6 +730,7 @@ fn should_visit() {
|
||||
..Default::default()
|
||||
},
|
||||
&fm.name,
|
||||
Some(&comments),
|
||||
|_| noop(),
|
||||
)
|
||||
.unwrap()
|
||||
@ -746,6 +752,7 @@ fn should_visit() {
|
||||
source_file_name: config.source_file_name,
|
||||
preserve_comments: config.preserve_comments,
|
||||
inline_sources_content: config.inline_sources_content,
|
||||
comments: config.comments,
|
||||
};
|
||||
|
||||
if config.minify {
|
||||
@ -765,6 +772,8 @@ fn should_visit() {
|
||||
})
|
||||
});
|
||||
|
||||
minify_file_comments(&comments, config.minify, config.preserve_comments);
|
||||
|
||||
Ok(c.print(
|
||||
&program,
|
||||
None,
|
||||
@ -776,7 +785,7 @@ fn should_visit() {
|
||||
None,
|
||||
// TODO: figure out sourcemaps
|
||||
config.minify,
|
||||
config.preserve_comments,
|
||||
Some(&comments),
|
||||
)
|
||||
.unwrap()
|
||||
.code)
|
||||
|
@ -1,5 +1,4 @@
|
||||
var Symbol;
|
||||
(new class {
|
||||
[Symbol.iterator]() {}
|
||||
})[Symbol.iterator](0) // Should error
|
||||
;
|
||||
})[Symbol.iterator](0);
|
||||
|
@ -19,5 +19,4 @@ var Symbol, _iterator = Symbol.iterator, C = function() {
|
||||
}
|
||||
], _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), C;
|
||||
}();
|
||||
(new C)[Symbol.iterator](0) // Should error
|
||||
;
|
||||
(new C)[Symbol.iterator](0);
|
||||
|
@ -11,4 +11,4 @@ const obj = new class extends Base {
|
||||
console.log(`x was set to ${value}`);
|
||||
}
|
||||
}();
|
||||
console.log(obj.x); // 1
|
||||
console.log(obj.x);
|
||||
|
@ -67,4 +67,4 @@ var Base = function() {
|
||||
}
|
||||
], _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), Derived1;
|
||||
}(Base), obj = new Derived1();
|
||||
console.log(obj.x); // 1
|
||||
console.log(obj.x);
|
||||
|
@ -1,3 +1,2 @@
|
||||
ohno.a // oh no
|
||||
;
|
||||
ohno.a;
|
||||
export { };
|
||||
|
@ -1,3 +1,2 @@
|
||||
ohno.a // oh no
|
||||
;
|
||||
ohno.a;
|
||||
export { };
|
||||
|
@ -18,5 +18,4 @@ new MyPromise((resolve)=>resolve()
|
||||
), call((x, y)=>42
|
||||
), call((x, y)=>42
|
||||
, 4), call((x, y)=>42
|
||||
, 4, 2) // ok
|
||||
;
|
||||
, 4, 2);
|
||||
|
@ -58,5 +58,4 @@ new MyPromise(function(resolve) {
|
||||
return 42;
|
||||
}, 4), call(function(x, y) {
|
||||
return 42;
|
||||
}, 4, 2) // ok
|
||||
;
|
||||
}, 4, 2);
|
||||
|
@ -1 +1 @@
|
||||
(void 0).p; // public, OK
|
||||
(void 0).p;
|
||||
|
@ -52,4 +52,4 @@ var d, Base = function(p) {
|
||||
}
|
||||
return Derived1;
|
||||
}(Base);
|
||||
d.p; // public, OK
|
||||
d.p;
|
||||
|
@ -3,4 +3,4 @@ class C extends C {
|
||||
class D extends D {
|
||||
}
|
||||
class E extends E {
|
||||
} // error
|
||||
}
|
||||
|
@ -68,5 +68,4 @@ var C1 = function(C) {
|
||||
return _classCallCheck(this, E1), _super.apply(this, arguments);
|
||||
}
|
||||
return E1;
|
||||
} // error
|
||||
(E1);
|
||||
}(E1);
|
||||
|
@ -48,5 +48,4 @@ var C = function(foo1) {
|
||||
}(this, C), _super.apply(this, arguments);
|
||||
}
|
||||
return C;
|
||||
} // error, cannot extend it though
|
||||
(foo);
|
||||
}(foo);
|
||||
|
@ -64,5 +64,5 @@ var ref8 = _slicedToArray(_toConsumableArray(temp), 2);
|
||||
ref8[0], ref8[1];
|
||||
var ref9 = _slicedToArray({
|
||||
2: !0
|
||||
}, 3); // Error
|
||||
}, 3);
|
||||
ref9[0], ref9[1], ref9[2];
|
||||
|
@ -1 +1 @@
|
||||
const [value] = data; // Error
|
||||
const [value] = data;
|
||||
|
@ -1,4 +1,4 @@
|
||||
let [key, value] = [
|
||||
"foo"
|
||||
];
|
||||
value.toUpperCase(); // Error
|
||||
value.toUpperCase();
|
||||
|
@ -1,3 +1,2 @@
|
||||
require("mod"), module.exports = N // Error
|
||||
;
|
||||
require("mod"), module.exports = N;
|
||||
export { };
|
||||
|
@ -1,3 +1,2 @@
|
||||
require("mod"), module.exports = N // Error
|
||||
;
|
||||
require("mod"), module.exports = N;
|
||||
export { };
|
||||
|
@ -1,3 +1,2 @@
|
||||
require("mod"), module.exports = N // Error
|
||||
;
|
||||
require("mod"), module.exports = N;
|
||||
export { };
|
||||
|
@ -1,3 +1,2 @@
|
||||
require("mod"), module.exports = N // Error
|
||||
;
|
||||
require("mod"), module.exports = N;
|
||||
export { };
|
||||
|
@ -2,5 +2,4 @@ export function x() {
|
||||
return !0;
|
||||
}
|
||||
const foo1 = require("./foo1");
|
||||
module.exports = foo1.x // Ok
|
||||
;
|
||||
module.exports = foo1.x;
|
||||
|
@ -2,5 +2,4 @@ export function x() {
|
||||
return !0;
|
||||
}
|
||||
var foo1 = require("./foo1");
|
||||
module.exports = foo1.x // Ok
|
||||
;
|
||||
module.exports = foo1.x;
|
||||
|
@ -5,4 +5,4 @@ const foo1 = require("./foo1");
|
||||
var x = foo1.x;
|
||||
module.exports = x;
|
||||
const foo2 = require("./foo2");
|
||||
var x = foo2(); // should be boolean
|
||||
var x = foo2();
|
||||
|
@ -3,4 +3,4 @@ export function x() {
|
||||
}
|
||||
var x = require("./foo1").x;
|
||||
module.exports = x;
|
||||
var x = require("./foo2")(); // should be boolean
|
||||
var x = require("./foo2")();
|
||||
|
@ -1,4 +1,4 @@
|
||||
export class A {
|
||||
}
|
||||
export * from "./b";
|
||||
new A(); // Error
|
||||
new A();
|
||||
|
@ -5,4 +5,4 @@ export var A = function() {
|
||||
}(this, A);
|
||||
};
|
||||
export * from "./b";
|
||||
new A(); // Error
|
||||
new A();
|
||||
|
@ -2,5 +2,5 @@ import * as _a from "./b";
|
||||
import { a } from "./c";
|
||||
export class A {
|
||||
}
|
||||
new a.A(); // Error
|
||||
new a.A();
|
||||
export { _a as a };
|
||||
|
@ -6,5 +6,5 @@ export var A = function() {
|
||||
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
||||
}(this, A);
|
||||
};
|
||||
new a.A(); // Error
|
||||
new a.A();
|
||||
export { _a as a };
|
||||
|
@ -7,6 +7,5 @@ class C1 {
|
||||
module.exports = C1;
|
||||
class C1 {
|
||||
}
|
||||
module.exports = C1 // Should work, private type I1 of visible class C1 only used in private member m1.
|
||||
;
|
||||
module.exports = C1;
|
||||
export { };
|
||||
|
@ -14,6 +14,5 @@ var C1 = function() {
|
||||
"use strict";
|
||||
_classCallCheck(this, C1);
|
||||
};
|
||||
module.exports = C1 // Should work, private type I1 of visible class C1 only used in private member m1.
|
||||
;
|
||||
module.exports = C1;
|
||||
export { };
|
||||
|
@ -4,4 +4,3 @@ for (v of new class {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
// Should fail because the iterator is not iterable
|
||||
|
@ -23,7 +23,6 @@ var StringIterator = function() {
|
||||
}(), _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
|
||||
try {
|
||||
for(var _step, _iterator = (new StringIterator)[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0)_step.value;
|
||||
// Should fail because the iterator is not iterable
|
||||
} catch (err) {
|
||||
_didIteratorError = !0, _iteratorError = err;
|
||||
} finally{
|
||||
|
@ -8,4 +8,3 @@ for (v of new class {
|
||||
return this;
|
||||
}
|
||||
});
|
||||
// Should fail
|
||||
|
@ -29,7 +29,6 @@ var _iterator = Symbol.iterator, StringIterator = function() {
|
||||
}(), _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
|
||||
try {
|
||||
for(var _step, _iterator1 = (new StringIterator)[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator1.next()).done); _iteratorNormalCompletion = !0)_step.value;
|
||||
// Should fail
|
||||
} catch (err) {
|
||||
_didIteratorError = !0, _iteratorError = err;
|
||||
} finally{
|
||||
|
@ -5,4 +5,3 @@ for (v of new class {
|
||||
return this;
|
||||
}
|
||||
});
|
||||
// Should fail
|
||||
|
@ -23,7 +23,6 @@ var _iterator = Symbol.iterator, StringIterator = function() {
|
||||
}(), _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
|
||||
try {
|
||||
for(var _step, _iterator1 = (new StringIterator)[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator1.next()).done); _iteratorNormalCompletion = !0)_step.value;
|
||||
// Should fail
|
||||
} catch (err) {
|
||||
_didIteratorError = !0, _iteratorError = err;
|
||||
} finally{
|
||||
|
@ -11,4 +11,3 @@ for (v of new class {
|
||||
return this;
|
||||
}
|
||||
});
|
||||
// Should succeed
|
||||
|
@ -32,7 +32,6 @@ var _iterator = Symbol.iterator, NumberIterator = function() {
|
||||
}(), _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
|
||||
try {
|
||||
for(var _step, _iterator1 = (new NumberIterator)[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator1.next()).done); _iteratorNormalCompletion = !0)_step.value;
|
||||
// Should succeed
|
||||
} catch (err) {
|
||||
_didIteratorError = !0, _iteratorError = err;
|
||||
} finally{
|
||||
|
@ -11,4 +11,3 @@ for (v of new class {
|
||||
return this;
|
||||
}
|
||||
});
|
||||
// Should succeed
|
||||
|
@ -32,7 +32,6 @@ var _iterator = Symbol.iterator, StringIterator = function() {
|
||||
}(), _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
|
||||
try {
|
||||
for(var _step, _iterator1 = (new StringIterator)[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator1.next()).done); _iteratorNormalCompletion = !0)_step.value;
|
||||
// Should succeed
|
||||
} catch (err) {
|
||||
_didIteratorError = !0, _iteratorError = err;
|
||||
} finally{
|
||||
|
@ -2,4 +2,4 @@ foo("", function*() {
|
||||
yield (x)=>x.length
|
||||
;
|
||||
}, (p)=>void 0
|
||||
); // T is fixed, should be string
|
||||
);
|
||||
|
@ -11,4 +11,4 @@ foo("", regeneratorRuntime.mark(function _callee() {
|
||||
return _ctx.stop();
|
||||
}
|
||||
}, _callee);
|
||||
}), function(p) {}); // T is fixed, should be string
|
||||
}), function(p) {});
|
||||
|
@ -6,4 +6,4 @@ foo("", function*() {
|
||||
}
|
||||
};
|
||||
}, (p)=>void 0
|
||||
); // T is fixed, should be string
|
||||
);
|
||||
|
@ -29,4 +29,4 @@ foo("", regeneratorRuntime.mark(function _callee1() {
|
||||
return _ctx1.stop();
|
||||
}
|
||||
}, _callee1);
|
||||
}), function(p) {}); // T is fixed, should be string
|
||||
}), function(p) {});
|
||||
|
@ -1,2 +1 @@
|
||||
globalThis.globalThis = 1, globalThis.x = 3, globalThis.y = 4 // should error
|
||||
;
|
||||
globalThis.globalThis = 1, globalThis.x = 3, globalThis.y = 4;
|
||||
|
@ -1,2 +1 @@
|
||||
globalThis.globalThis = 1, globalThis.x = 3, globalThis.y = 4 // should error
|
||||
;
|
||||
globalThis.globalThis = 1, globalThis.x = 3, globalThis.y = 4;
|
||||
|
@ -1,4 +1,4 @@
|
||||
module.exports = a;
|
||||
const a = require("./b");
|
||||
new a.A(); // Error
|
||||
new a.A();
|
||||
export { };
|
||||
|
@ -6,5 +6,5 @@ var A = function() {
|
||||
};
|
||||
module.exports = a;
|
||||
var a = require("./b");
|
||||
new a.A(); // Error
|
||||
new a.A();
|
||||
export { };
|
||||
|
@ -4,4 +4,4 @@ const [x] = [
|
||||
42
|
||||
], [person] = selectJohn(), [any, whatever] = selectJohn(), john = selectJohn(), [personAgain, nufinspecial] = john;
|
||||
makeTuple(stringy());
|
||||
const [isAny] = makeTuple(stringy()); // [string]
|
||||
const [isAny] = makeTuple(stringy());
|
||||
|
@ -48,14 +48,4 @@ var C = function() {
|
||||
}
|
||||
}
|
||||
]), C2;
|
||||
} //class C2<T extends Date, U extends T> {
|
||||
// g<T extends Number, U extends T>() {
|
||||
// var x: U;
|
||||
// x.toFixed();
|
||||
// }
|
||||
// h() {
|
||||
// var x: U;
|
||||
// x.getDate();
|
||||
// }
|
||||
//}
|
||||
();
|
||||
}();
|
||||
|
@ -4,5 +4,4 @@ const wrapped = create({
|
||||
styleMedia: "???"
|
||||
}
|
||||
});
|
||||
wrapped.first // error, first is a branded number
|
||||
;
|
||||
wrapped.first;
|
||||
|
@ -3,5 +3,4 @@ create({
|
||||
view: 0,
|
||||
styleMedia: "???"
|
||||
}
|
||||
}).first // error, first is a branded number
|
||||
;
|
||||
}).first;
|
||||
|
@ -2,7 +2,4 @@ export class Encoder {
|
||||
encode(value) {
|
||||
return new Uint8Array(0);
|
||||
}
|
||||
} /**
|
||||
* @template T
|
||||
* @typedef {import('./interface').Encoder<T>} IEncoder
|
||||
*/
|
||||
}
|
||||
|
@ -20,7 +20,4 @@ export var Encoder = function() {
|
||||
}
|
||||
}
|
||||
], _defineProperties(Constructor.prototype, protoProps), staticProps && _defineProperties(Constructor, staticProps), Encoder;
|
||||
} /**
|
||||
* @template T
|
||||
* @typedef {import('./interface').Encoder<T>} IEncoder
|
||||
*/ ();
|
||||
}();
|
||||
|
@ -7,8 +7,4 @@ class Handler {
|
||||
Handler.statische = function() {}, module.exports = Handler, module.exports.Strings = {
|
||||
a: "A",
|
||||
b: "B"
|
||||
} /**
|
||||
* @typedef {Object} HandlerOptions
|
||||
* @property {String} name
|
||||
* Should be able to export a type alias at the same time.
|
||||
*/ ;
|
||||
};
|
||||
|
@ -29,8 +29,4 @@ var Handler = function() {
|
||||
Handler.statische = function() {}, module.exports = Handler, module.exports.Strings = {
|
||||
a: "A",
|
||||
b: "B"
|
||||
} /**
|
||||
* @typedef {Object} HandlerOptions
|
||||
* @property {String} name
|
||||
* Should be able to export a type alias at the same time.
|
||||
*/ ;
|
||||
};
|
||||
|
@ -33,4 +33,4 @@ Point2D.prototype = {
|
||||
this.storage[1] = y;
|
||||
}
|
||||
};
|
||||
export const origin = new Point2D(0, 0); // export const res = Point2D(2, 3).dot(origin); // TODO: when __proto__ works, validate this
|
||||
export const origin = new Point2D(0, 0);
|
||||
|
@ -32,4 +32,4 @@ Point2D.prototype = {
|
||||
this.storage[1] = y;
|
||||
}
|
||||
};
|
||||
export var origin = new Point2D(0, 0); // export const res = Point2D(2, 3).dot(origin); // TODO: when __proto__ works, validate this
|
||||
export var origin = new Point2D(0, 0);
|
||||
|
@ -1,2 +1 @@
|
||||
export const y = 0; // @filename: /a.ts
|
||||
/// <reference types="@beep/boop" />
|
||||
export const y = 0;
|
||||
|
@ -1,2 +1 @@
|
||||
export var y = 0; // @filename: /a.ts
|
||||
/// <reference types="@beep/boop" />
|
||||
export var y = 0;
|
||||
|
@ -2,4 +2,4 @@ new class {
|
||||
constructor(widen = 2){
|
||||
this.widen = widen, this.noWiden = 1, this.noWiden = 5, this.widen = 6;
|
||||
}
|
||||
}(7); // ok
|
||||
}(7);
|
||||
|
@ -5,4 +5,4 @@ var D = function() {
|
||||
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
|
||||
}(this, D), this.widen = widen, this.noWiden = 1, this.noWiden = 5, this.widen = 6;
|
||||
};
|
||||
new D(7); // ok
|
||||
new D(7);
|
||||
|
@ -1,2 +1 @@
|
||||
module.exports = function() {}, module.exports(), require("./mod")() // should be callable from here too
|
||||
;
|
||||
module.exports = function() {}, module.exports(), require("./mod")();
|
||||
|
@ -1,2 +1 @@
|
||||
module.exports = function() {}, module.exports(), require("./mod")() // should be callable from here too
|
||||
;
|
||||
module.exports = function() {}, module.exports(), require("./mod")();
|
||||
|
@ -1,4 +1,3 @@
|
||||
module.exports = 1, module.exports.f = function() {};
|
||||
var mod1 = require("./mod1");
|
||||
mod1.toFixed(12), mod1.f() // error, 'f' is not a property on 'number'
|
||||
;
|
||||
mod1.toFixed(12), mod1.f();
|
||||
|
@ -1,4 +1,3 @@
|
||||
module.exports = 1, module.exports.f = function() {};
|
||||
var mod1 = require("./mod1");
|
||||
mod1.toFixed(12), mod1.f() // error, 'f' is not a property on 'number'
|
||||
;
|
||||
mod1.toFixed(12), mod1.f();
|
||||
|
@ -1,4 +1,3 @@
|
||||
module.exports = function() {}, module.exports.f = function(a) {};
|
||||
var mod1 = require("./mod1");
|
||||
mod1(), mod1.f() // error, not enough arguments
|
||||
;
|
||||
mod1(), mod1.f();
|
||||
|
@ -1,4 +1,3 @@
|
||||
module.exports = function() {}, module.exports.f = function(a) {};
|
||||
var mod1 = require("./mod1");
|
||||
mod1(), mod1.f() // error, not enough arguments
|
||||
;
|
||||
mod1(), mod1.f();
|
||||
|
@ -1,2 +1,2 @@
|
||||
import("./foo").then((x)=>x
|
||||
); // should error, ask for extension
|
||||
);
|
||||
|
@ -1,3 +1,3 @@
|
||||
import("./foo").then(function(x) {
|
||||
return x;
|
||||
}); // should error, ask for extension
|
||||
});
|
||||
|
@ -1,2 +1,2 @@
|
||||
import("./foo").then((x)=>x
|
||||
); // should error, ask for extension
|
||||
);
|
||||
|
@ -1,3 +1,3 @@
|
||||
import("./foo").then(function(x) {
|
||||
return x;
|
||||
}); // should error, ask for extension
|
||||
});
|
||||
|
@ -7,4 +7,4 @@ export function readSegment([length, count]) {}
|
||||
export const val = null;
|
||||
r = q = r, y = x = y;
|
||||
export const argumentsOfGAsFirstArgument = f(getArgsForInjection(g));
|
||||
export const argumentsOfG = f(...getArgsForInjection(g)); // captured arguments list re-spread
|
||||
export const argumentsOfG = f(...getArgsForInjection(g));
|
||||
|
@ -52,4 +52,4 @@ export var argumentsOfG = f.apply(void 0, function(arr) {
|
||||
})(arr) || _unsupportedIterableToArray(arr) || (function() {
|
||||
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
||||
})();
|
||||
}(getArgsForInjection(g))); // captured arguments list re-spread
|
||||
}(getArgsForInjection(g)));
|
||||
|
@ -1,4 +1,3 @@
|
||||
!function() {
|
||||
arguments;
|
||||
}(1, 2, 3) // oh no
|
||||
;
|
||||
}(1, 2, 3);
|
||||
|
@ -1,4 +1,3 @@
|
||||
!function() {
|
||||
arguments;
|
||||
}(1, 2, 3) // oh no
|
||||
;
|
||||
}(1, 2, 3);
|
||||
|
@ -31,4 +31,4 @@ export class Foo {
|
||||
}
|
||||
}
|
||||
const a = new A(), b = new B();
|
||||
a.copy(b); // error
|
||||
a.copy(b);
|
||||
|
@ -46,4 +46,4 @@ export var Foo = function() {
|
||||
});
|
||||
};
|
||||
var a = new A(), b = new B();
|
||||
a.copy(b); // error
|
||||
a.copy(b);
|
||||
|
@ -11,4 +11,4 @@ const obj = new class extends Base {
|
||||
super(...args), this.x = 1;
|
||||
}
|
||||
}();
|
||||
console.log(obj.x); // 2
|
||||
console.log(obj.x);
|
||||
|
@ -72,4 +72,4 @@ var Base = function() {
|
||||
}
|
||||
return Derived1;
|
||||
}(Base), obj = new Derived1();
|
||||
console.log(obj.x); // 2
|
||||
console.log(obj.x);
|
||||
|
@ -19,5 +19,4 @@ const lion = new class extends Animal {
|
||||
super(...args), this.sound = "RAWR!";
|
||||
}
|
||||
};
|
||||
lion.makeSound() // with [[Define]]: Expected "RAWR!" but got "rustling noise in the bushes"
|
||||
;
|
||||
lion.makeSound();
|
||||
|
@ -80,5 +80,4 @@ var Lion = function(Animal) {
|
||||
}
|
||||
return Lion;
|
||||
}(Animal);
|
||||
(new Lion).makeSound() // with [[Define]]: Expected "RAWR!" but got "rustling noise in the bushes"
|
||||
;
|
||||
(new Lion).makeSound();
|
||||
|
@ -1,4 +1,4 @@
|
||||
var r = {
|
||||
s: new Object()
|
||||
};
|
||||
r.s && r.s.toFixed(); // would blow up at runtime
|
||||
r.s && r.s.toFixed();
|
||||
|
@ -1,4 +1,4 @@
|
||||
var r = {
|
||||
s: new Object()
|
||||
};
|
||||
r.s && r.s.toFixed(); // would blow up at runtime
|
||||
r.s && r.s.toFixed();
|
||||
|
@ -1,2 +1 @@
|
||||
React.createElement("h1", null, " Hello World ") // No error
|
||||
;
|
||||
React.createElement("h1", null, " Hello World ");
|
||||
|
@ -1,2 +1 @@
|
||||
React.createElement("h1", null, " Hello World ") // No error
|
||||
;
|
||||
React.createElement("h1", null, " Hello World ");
|
||||
|
@ -1,2 +1 @@
|
||||
React.createElement("customTag", null, " Hello World ") // This should be an error. The lower-case is look up as an intrinsic element name
|
||||
;
|
||||
React.createElement("customTag", null, " Hello World ");
|
||||
|
@ -1,2 +1 @@
|
||||
React.createElement("customTag", null, " Hello World ") // This should be an error. The lower-case is look up as an intrinsic element name
|
||||
;
|
||||
React.createElement("customTag", null, " Hello World ");
|
||||
|
@ -1,2 +1 @@
|
||||
React.createElement("h1", null, " Hello World ") // This should be an error. we will try look up string literal type in JSX.IntrinsicElements
|
||||
;
|
||||
React.createElement("h1", null, " Hello World ");
|
||||
|
@ -1,2 +1 @@
|
||||
React.createElement("h1", null, " Hello World ") // This should be an error. we will try look up string literal type in JSX.IntrinsicElements
|
||||
;
|
||||
React.createElement("h1", null, " Hello World ");
|
||||
|
@ -1,2 +1 @@
|
||||
React.createElement("h1", null) // No error
|
||||
;
|
||||
React.createElement("h1", null);
|
||||
|
@ -1,2 +1 @@
|
||||
React.createElement("h1", null) // No error
|
||||
;
|
||||
React.createElement("h1", null);
|
||||
|
@ -1,3 +1,3 @@
|
||||
React.createElement("obj1", {
|
||||
x: 10
|
||||
}); // Error
|
||||
});
|
||||
|
@ -1,3 +1,3 @@
|
||||
React.createElement("obj1", {
|
||||
x: 10
|
||||
}); // Error
|
||||
});
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user