diff --git a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstFnExpr.java b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstFnExpr.java index 68d09460..858dcf20 100644 --- a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstFnExpr.java +++ b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstFnExpr.java @@ -50,6 +50,14 @@ public Swc4jAstFnExpr( setIdent(ident); } + public static Swc4jAstFnExpr create(Swc4jAstFunction function) { + return create(null, function); + } + + public static Swc4jAstFnExpr create(Swc4jAstIdent ident, Swc4jAstFunction function) { + return new Swc4jAstFnExpr(ident, function, Swc4jSpan.DUMMY); + } + @Override public List getChildNodes() { List childNodes = SimpleList.of(function); diff --git a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstIdent.java b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstIdent.java index 83702b7a..6b940f07 100644 --- a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstIdent.java +++ b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstIdent.java @@ -52,7 +52,11 @@ public Swc4jAstIdent( } public static Swc4jAstIdent create(String sym) { - return new Swc4jAstIdent(sym, false, Swc4jSpan.DUMMY); + return create(sym, false); + } + + public static Swc4jAstIdent create(String sym, boolean optional) { + return new Swc4jAstIdent(sym, optional, Swc4jSpan.DUMMY); } public static Swc4jAstIdent createApply() { diff --git a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstJsxElement.java b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstJsxElement.java index 0854d0fd..389eeaed 100644 --- a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstJsxElement.java +++ b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstJsxElement.java @@ -58,6 +58,23 @@ public Swc4jAstJsxElement( this.children.forEach(node -> node.setParent(this)); } + public static Swc4jAstJsxElement create(Swc4jAstJsxOpeningElement opening) { + return create(opening, SimpleList.of()); + } + + public static Swc4jAstJsxElement create( + Swc4jAstJsxOpeningElement opening, + List children) { + return create(opening, children, null); + } + + public static Swc4jAstJsxElement create( + Swc4jAstJsxOpeningElement opening, + List children, + Swc4jAstJsxClosingElement closing) { + return new Swc4jAstJsxElement(opening, children, closing, Swc4jSpan.DUMMY); + } + @Override public List getChildNodes() { List childNodes = SimpleList.copyOf(children); diff --git a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstJsxEmptyExpr.java b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstJsxEmptyExpr.java index 728099bb..b859b922 100644 --- a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstJsxEmptyExpr.java +++ b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstJsxEmptyExpr.java @@ -40,6 +40,10 @@ public Swc4jAstJsxEmptyExpr( super(span); } + public static Swc4jAstJsxEmptyExpr create() { + return new Swc4jAstJsxEmptyExpr(Swc4jSpan.DUMMY); + } + @Override public List getChildNodes() { return EMPTY_CHILD_NODES; diff --git a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstJsxExprContainer.java b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstJsxExprContainer.java index 2cfc9a7b..6e46a585 100644 --- a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstJsxExprContainer.java +++ b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstJsxExprContainer.java @@ -44,6 +44,10 @@ public Swc4jAstJsxExprContainer( setExpr(expr); } + public static Swc4jAstJsxExprContainer create(ISwc4jAstJsxExpr expr) { + return new Swc4jAstJsxExprContainer(expr, Swc4jSpan.DUMMY); + } + @Override public List getChildNodes() { return SimpleList.of(expr); diff --git a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstJsxFragment.java b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstJsxFragment.java index e4f18f5f..1d5bdd91 100644 --- a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstJsxFragment.java +++ b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstJsxFragment.java @@ -56,6 +56,23 @@ public Swc4jAstJsxFragment( this.children.forEach(node -> node.setParent(this)); } + public static Swc4jAstJsxFragment create(Swc4jAstJsxOpeningFragment opening) { + return create(opening, SimpleList.of()); + } + + public static Swc4jAstJsxFragment create( + Swc4jAstJsxOpeningFragment opening, + List children) { + return create(opening, children, null); + } + + public static Swc4jAstJsxFragment create( + Swc4jAstJsxOpeningFragment opening, + List children, + Swc4jAstJsxClosingFragment closing) { + return new Swc4jAstJsxFragment(opening, children, closing, Swc4jSpan.DUMMY); + } + @Override public List getChildNodes() { List childNodes = SimpleList.copyOf(children); diff --git a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstJsxMemberExpr.java b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstJsxMemberExpr.java index 22d76f3b..2d22c31a 100644 --- a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstJsxMemberExpr.java +++ b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstJsxMemberExpr.java @@ -50,6 +50,10 @@ public Swc4jAstJsxMemberExpr( setProp(prop); } + public static Swc4jAstJsxMemberExpr create(ISwc4jAstJsxObject obj, Swc4jAstIdent prop) { + return new Swc4jAstJsxMemberExpr(obj, prop, Swc4jSpan.DUMMY); + } + @Override public List getChildNodes() { return SimpleList.of(obj, prop); diff --git a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstJsxNamespacedName.java b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstJsxNamespacedName.java index 1258f13e..3cc7ff44 100644 --- a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstJsxNamespacedName.java +++ b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstJsxNamespacedName.java @@ -50,6 +50,10 @@ public Swc4jAstJsxNamespacedName( setNs(ns); } + public static Swc4jAstJsxNamespacedName create(Swc4jAstIdent ns, Swc4jAstIdent name) { + return new Swc4jAstJsxNamespacedName(ns, name, Swc4jSpan.DUMMY); + } + @Override public List getChildNodes() { return SimpleList.of(ns, name); diff --git a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstJsxSpreadChild.java b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstJsxSpreadChild.java index d17aaaf3..806ac7ec 100644 --- a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstJsxSpreadChild.java +++ b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstJsxSpreadChild.java @@ -48,6 +48,10 @@ public Swc4jAstJsxSpreadChild( setExpr(expr); } + public static Swc4jAstJsxSpreadChild create(ISwc4jAstExpr expr) { + return new Swc4jAstJsxSpreadChild(expr, Swc4jSpan.DUMMY); + } + @Override public List getChildNodes() { return SimpleList.of(expr); diff --git a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstMetaPropExpr.java b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstMetaPropExpr.java index 129ed468..44b71ba7 100644 --- a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstMetaPropExpr.java +++ b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstMetaPropExpr.java @@ -45,6 +45,10 @@ public Swc4jAstMetaPropExpr( setKind(kind); } + public static Swc4jAstMetaPropExpr create(Swc4jAstMetaPropKind kind) { + return new Swc4jAstMetaPropExpr(kind, Swc4jSpan.DUMMY); + } + @Override public List getChildNodes() { return EMPTY_CHILD_NODES; diff --git a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstNewExpr.java b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstNewExpr.java index aba313de..9e32ee4e 100644 --- a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstNewExpr.java +++ b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstNewExpr.java @@ -53,6 +53,23 @@ public Swc4jAstNewExpr( setTypeArgs(typeArgs); } + public static Swc4jAstNewExpr create(ISwc4jAstExpr callee) { + return create(callee, null); + } + + public static Swc4jAstNewExpr create( + ISwc4jAstExpr callee, + List args) { + return create(callee, args, null); + } + + public static Swc4jAstNewExpr create( + ISwc4jAstExpr callee, + List args, + Swc4jAstTsTypeParamInstantiation typeArgs) { + return new Swc4jAstNewExpr(callee, args, typeArgs, Swc4jSpan.DUMMY); + } + @Jni2RustMethod public Optional> getArgs() { return args; @@ -110,7 +127,7 @@ public boolean replaceNode(ISwc4jAst oldNode, ISwc4jAst newNode) { } public Swc4jAstNewExpr setArgs(List args) { - this.args = Optional.ofNullable(args).map(SimpleList::immutableCopyOf); + this.args = Optional.ofNullable(args); this.args.ifPresent(nodes -> nodes.forEach(node -> node.setParent(this))); return this; } diff --git a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstOptChainExpr.java b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstOptChainExpr.java index acb00ad6..ad8b5046 100644 --- a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstOptChainExpr.java +++ b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstOptChainExpr.java @@ -52,6 +52,14 @@ public Swc4jAstOptChainExpr( setOptional(optional); } + public static Swc4jAstOptChainExpr create(ISwc4jAstOptChainBase base) { + return create(false, base); + } + + public static Swc4jAstOptChainExpr create(boolean optional, ISwc4jAstOptChainBase base) { + return new Swc4jAstOptChainExpr(optional, base, Swc4jSpan.DUMMY); + } + @Jni2RustMethod public ISwc4jAstOptChainBase getBase() { return base; diff --git a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstParenExpr.java b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstParenExpr.java index 095d8242..ac359f5b 100644 --- a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstParenExpr.java +++ b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstParenExpr.java @@ -48,6 +48,10 @@ public Swc4jAstParenExpr( setExpr(expr); } + public static Swc4jAstParenExpr create(ISwc4jAstExpr expr) { + return new Swc4jAstParenExpr(expr, Swc4jSpan.DUMMY); + } + @Override public List getChildNodes() { return SimpleList.of(expr); diff --git a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstSeqExpr.java b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstSeqExpr.java index f4a45d7b..de80e046 100644 --- a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstSeqExpr.java +++ b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstSeqExpr.java @@ -49,6 +49,10 @@ public Swc4jAstSeqExpr( this.exprs.forEach(node -> node.setParent(this)); } + public static Swc4jAstSeqExpr create(List exprs) { + return new Swc4jAstSeqExpr(exprs, Swc4jSpan.DUMMY); + } + @Override public List getChildNodes() { return SimpleList.copyOf(exprs); diff --git a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstSpreadElement.java b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstSpreadElement.java index 3a7dd849..d9588359 100644 --- a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstSpreadElement.java +++ b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstSpreadElement.java @@ -52,6 +52,14 @@ public Swc4jAstSpreadElement( setExpr(expr); } + public static Swc4jAstSpreadElement create(ISwc4jAstExpr expr) { + return create(Swc4jSpan.DUMMY, expr); + } + + public static Swc4jAstSpreadElement create(Swc4jSpan dot3Token, ISwc4jAstExpr expr) { + return new Swc4jAstSpreadElement(dot3Token, expr, Swc4jSpan.DUMMY); + } + @Override public List getChildNodes() { return SimpleList.of(expr); diff --git a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstSuperPropExpr.java b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstSuperPropExpr.java index f95d8851..70f2ae15 100644 --- a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstSuperPropExpr.java +++ b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstSuperPropExpr.java @@ -51,6 +51,10 @@ public Swc4jAstSuperPropExpr( setProp(prop); } + public static Swc4jAstSuperPropExpr create(Swc4jAstSuper obj, ISwc4jAstSuperProp prop) { + return new Swc4jAstSuperPropExpr(obj, prop, Swc4jSpan.DUMMY); + } + @Override public List getChildNodes() { return SimpleList.of(obj, prop); diff --git a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstTaggedTpl.java b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstTaggedTpl.java index 198f6e9d..d534822e 100644 --- a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstTaggedTpl.java +++ b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstTaggedTpl.java @@ -20,8 +20,6 @@ import com.caoccao.javet.swc4j.ast.enums.Swc4jAstType; import com.caoccao.javet.swc4j.ast.interfaces.ISwc4jAst; import com.caoccao.javet.swc4j.ast.interfaces.ISwc4jAstExpr; -import com.caoccao.javet.swc4j.ast.interfaces.ISwc4jAstPropName; -import com.caoccao.javet.swc4j.ast.ts.Swc4jAstTsTypeAnn; import com.caoccao.javet.swc4j.ast.ts.Swc4jAstTsTypeParamInstantiation; import com.caoccao.javet.swc4j.ast.visitors.ISwc4jAstVisitor; import com.caoccao.javet.swc4j.ast.visitors.Swc4jAstVisitorResponse; @@ -56,6 +54,17 @@ public Swc4jAstTaggedTpl( setTypeParams(typeParams); } + public static Swc4jAstTaggedTpl create(ISwc4jAstExpr tag, Swc4jAstTpl tpl) { + return create(tag, null, tpl); + } + + public static Swc4jAstTaggedTpl create( + ISwc4jAstExpr tag, + Swc4jAstTsTypeParamInstantiation typeParams, + Swc4jAstTpl tpl) { + return new Swc4jAstTaggedTpl(tag, typeParams, tpl, Swc4jSpan.DUMMY); + } + @Override public List getChildNodes() { List childNodes = SimpleList.of(tag, tpl); @@ -78,6 +87,11 @@ public Swc4jAstType getType() { return Swc4jAstType.TaggedTpl; } + @Jni2RustMethod + public Optional getTypeParams() { + return typeParams; + } + @Override public boolean replaceNode(ISwc4jAst oldNode, ISwc4jAst newNode) { if (tag == oldNode && newNode instanceof ISwc4jAstExpr) { @@ -95,11 +109,6 @@ public boolean replaceNode(ISwc4jAst oldNode, ISwc4jAst newNode) { return false; } - @Jni2RustMethod - public Optional getTypeParams() { - return typeParams; - } - public Swc4jAstTaggedTpl setTag(ISwc4jAstExpr tag) { this.tag = AssertionUtils.notNull(tag, "Tag"); this.tag.setParent(this); diff --git a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstThisExpr.java b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstThisExpr.java index 3b540bce..06a964a3 100644 --- a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstThisExpr.java +++ b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstThisExpr.java @@ -39,6 +39,10 @@ public Swc4jAstThisExpr( super(span); } + public static Swc4jAstThisExpr create() { + return new Swc4jAstThisExpr(Swc4jSpan.DUMMY); + } + @Override public List getChildNodes() { return EMPTY_CHILD_NODES; diff --git a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstTpl.java b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstTpl.java index 9d66dccd..b2cf1363 100644 --- a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstTpl.java +++ b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstTpl.java @@ -53,6 +53,18 @@ public Swc4jAstTpl( this.quasis.forEach(node -> node.setParent(this)); } + public static Swc4jAstTpl create() { + return create(SimpleList.of()); + } + + public static Swc4jAstTpl create(List exprs) { + return create(exprs, SimpleList.of()); + } + + public static Swc4jAstTpl create(List exprs, List quasis) { + return new Swc4jAstTpl(exprs, quasis, Swc4jSpan.DUMMY); + } + @Override public List getChildNodes() { List childNodes = SimpleList.copyOf(exprs); diff --git a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstTsAsExpr.java b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstTsAsExpr.java index a5457ecc..5f3f6905 100644 --- a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstTsAsExpr.java +++ b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstTsAsExpr.java @@ -53,6 +53,10 @@ public Swc4jAstTsAsExpr( setTypeAnn(typeAnn); } + public static Swc4jAstTsAsExpr create(ISwc4jAstExpr expr, ISwc4jAstTsType typeAnn) { + return new Swc4jAstTsAsExpr(expr, typeAnn, Swc4jSpan.DUMMY); + } + @Override public List getChildNodes() { return SimpleList.of(expr, typeAnn); diff --git a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstTsConstAssertion.java b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstTsConstAssertion.java index 8903649f..74c30536 100644 --- a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstTsConstAssertion.java +++ b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstTsConstAssertion.java @@ -47,6 +47,10 @@ public Swc4jAstTsConstAssertion( setExpr(expr); } + public static Swc4jAstTsConstAssertion create(ISwc4jAstExpr expr) { + return new Swc4jAstTsConstAssertion(expr, Swc4jSpan.DUMMY); + } + @Override public List getChildNodes() { return SimpleList.of(expr); diff --git a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstTsInstantiation.java b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstTsInstantiation.java index acf2e5cb..cdc02858 100644 --- a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstTsInstantiation.java +++ b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstTsInstantiation.java @@ -53,6 +53,10 @@ public Swc4jAstTsInstantiation( setTypeArgs(typeArgs); } + public static Swc4jAstTsInstantiation create(ISwc4jAstExpr expr, Swc4jAstTsTypeParamInstantiation typeArgs) { + return new Swc4jAstTsInstantiation(expr, typeArgs, Swc4jSpan.DUMMY); + } + @Override public List getChildNodes() { return SimpleList.of(expr, typeArgs); diff --git a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstTsNonNullExpr.java b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstTsNonNullExpr.java index cdc6ff22..8c37f734 100644 --- a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstTsNonNullExpr.java +++ b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstTsNonNullExpr.java @@ -48,6 +48,10 @@ public Swc4jAstTsNonNullExpr( setExpr(expr); } + public static Swc4jAstTsNonNullExpr create(ISwc4jAstExpr expr) { + return new Swc4jAstTsNonNullExpr(expr, Swc4jSpan.DUMMY); + } + @Override public List getChildNodes() { return SimpleList.of(expr); diff --git a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstTsSatisfiesExpr.java b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstTsSatisfiesExpr.java index 33591e02..cbc6bf1d 100644 --- a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstTsSatisfiesExpr.java +++ b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstTsSatisfiesExpr.java @@ -53,6 +53,10 @@ public Swc4jAstTsSatisfiesExpr( setTypeAnn(typeAnn); } + public static Swc4jAstTsSatisfiesExpr create(ISwc4jAstExpr expr, ISwc4jAstTsType typeAnn) { + return new Swc4jAstTsSatisfiesExpr(expr, typeAnn, Swc4jSpan.DUMMY); + } + @Override public List getChildNodes() { return SimpleList.of(expr, typeAnn); diff --git a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstTsTypeAssertion.java b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstTsTypeAssertion.java index 69b726b9..3d1c5601 100644 --- a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstTsTypeAssertion.java +++ b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstTsTypeAssertion.java @@ -53,6 +53,10 @@ public Swc4jAstTsTypeAssertion( setTypeAnn(typeAnn); } + public static Swc4jAstTsTypeAssertion create(ISwc4jAstExpr expr, ISwc4jAstTsType typeAnn) { + return new Swc4jAstTsTypeAssertion(expr, typeAnn, Swc4jSpan.DUMMY); + } + @Override public List getChildNodes() { return SimpleList.of(expr, typeAnn); diff --git a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstUpdateExpr.java b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstUpdateExpr.java index 63ad2208..dae22f59 100644 --- a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstUpdateExpr.java +++ b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstUpdateExpr.java @@ -54,6 +54,14 @@ public Swc4jAstUpdateExpr( setPrefix(prefix); } + public static Swc4jAstUpdateExpr create(Swc4jAstUpdateOp op, ISwc4jAstExpr arg) { + return create(op, false, arg); + } + + public static Swc4jAstUpdateExpr create(Swc4jAstUpdateOp op, boolean prefix, ISwc4jAstExpr arg) { + return new Swc4jAstUpdateExpr(op, prefix, arg, Swc4jSpan.DUMMY); + } + @Jni2RustMethod public ISwc4jAstExpr getArg() { return arg; diff --git a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstYieldExpr.java b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstYieldExpr.java index be7fc229..186a06bc 100644 --- a/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstYieldExpr.java +++ b/src/main/java/com/caoccao/javet/swc4j/ast/expr/Swc4jAstYieldExpr.java @@ -47,6 +47,18 @@ public Swc4jAstYieldExpr( setDelegate(delegate); } + public static Swc4jAstYieldExpr create() { + return create(null); + } + + public static Swc4jAstYieldExpr create(ISwc4jAstExpr arg) { + return create(arg, false); + } + + public static Swc4jAstYieldExpr create(ISwc4jAstExpr arg, boolean delegate) { + return new Swc4jAstYieldExpr(arg, delegate, Swc4jSpan.DUMMY); + } + @Jni2RustMethod public Optional getArg() { return arg;