fix swc_ecma_codegen

This commit is contained in:
강동윤 2019-01-24 16:18:39 +09:00
parent 334b25c7b8
commit fd79f4eb78
2 changed files with 14 additions and 20 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "swc_ecma_codegen"
version = "0.5.1"
version = "0.5.2"
authors = ["강동윤 <kdy1@outlook.kr>"]
license = "Apache-2.0/MIT"
repository = "https://github.com/swc-project/swc.git"
@ -11,7 +11,7 @@ description = "Ecmascript code generator for the swc project."
bitflags = "1"
swc_atoms = { version = "0.1", path ="../../atoms" }
swc_common = { version = "0.2", path ="../../common" }
swc_ecma_ast = { version = "0.6", path ="../ast" }
swc_ecma_ast = { version = "0.7", path ="../ast" }
swc_ecma_codegen_macros = { version = "0.2", path ="./macros" }
sourcemap = "2.2"

View File

@ -567,39 +567,33 @@ impl<'a> Emitter<'a> {
}
fn emit_class_method<K: Node>(&mut self, node: &ClassMethod<K>) -> Result {
macro_rules! __cur_emitter {
() => {
self
};
}
if node.is_static {
keyword!("static");
space!();
keyword!(self, "static");
space!(self);
}
match node.kind {
MethodKind::Method => {
if node.function.is_async {
keyword!("async");
keyword!(self, "async");
}
space!();
space!(self);
if node.function.is_generator {
punct!("*");
punct!(self, "*");
}
emit!(node.key);
emit!(self, node.key);
}
MethodKind::Getter => {
keyword!("get");
space!();
keyword!(self, "get");
space!(self);
emit!(node.key);
emit!(self, node.key);
}
MethodKind::Setter => {
keyword!("set");
space!();
keyword!(self, "set");
space!(self);
emit!(node.key);
emit!(self, node.key);
}
}