Skip to content

Commit

Permalink
Move {Call,Member}Expression <: ChainElement update to def/es2020.
Browse files Browse the repository at this point in the history
Types can be built up incrementally, so we can avoid including the
ChainElement functionality in def/core.
  • Loading branch information
benjamn committed Sep 12, 2020
1 parent 7442110 commit 94c0cdd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions def/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,14 +291,14 @@ export default function (fork: Fork) {
.field("arguments", [def("Expression")]);

def("CallExpression")
.bases("Expression", "ChainElement")
.bases("Expression")
.build("callee", "arguments")
.field("callee", def("Expression"))
// See comment for NewExpression above.
.field("arguments", [def("Expression")]);

def("MemberExpression")
.bases("Expression", "ChainElement")
.bases("Expression")
.build("object", "property", "computed")
.field("object", def("Expression"))
.field("property", or(def("Identifier"), def("Expression")))
Expand Down
6 changes: 6 additions & 0 deletions def/es2020.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ export default function (fork: Fork) {
.bases("Node")
.field("optional", Boolean, defaults["true"]);

def("CallExpression")
.bases("Expression", "ChainElement");

def("MemberExpression")
.bases("Expression", "ChainElement");

def("ChainExpression")
.bases("Expression")
.build("expression")
Expand Down

0 comments on commit 94c0cdd

Please sign in to comment.