Skip to content

Commit

Permalink
Move code out of juno_ast lib.rs
Browse files Browse the repository at this point in the history
Summary:
`lib.rs` was getting to have too much code in it and the public API
was getting muddled by the excess of real code we had to read through.

Clean things up by making new files:
* `node_child.rs` contains the actual `NodeChild` trait and all the
  basic node children: lists, nodes, strings, etc.
* `node_enums.rs` contains the trivial enums that we use for things like
  operator kinds, import/export kinds, etc.
* `visitor.rs` contains the `Visitor` patterns and their helpers.

`lib.rs` now more clearly designates the public API for the `juno_ast`
crate and we should continue to ensure that it contains no code.

All the movement is invisible to any users of the crate, as the public
API is completely unchanged.

Reviewed By: tmikov

Differential Revision: D37698636

fbshipit-source-id: 1f6f0800169ff3a466d607286b3b8baa427ee432
  • Loading branch information
avp authored and facebook-github-bot committed Jul 8, 2022
1 parent 5dd2260 commit ec35cdb
Show file tree
Hide file tree
Showing 6 changed files with 807 additions and 749 deletions.
2 changes: 1 addition & 1 deletion unsupported/juno/crates/juno_ast/src/dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ use super::UpdateExpressionOperator;
use super::VariableDeclarationKind;
use juno_support::case::ascii_snake_to_camel;
use juno_support::json::*;
use std::io;
use std::io::Write;
use std::io::{self};

pub use juno_support::json::Pretty;

Expand Down
5 changes: 4 additions & 1 deletion unsupported/juno/crates/juno_ast/src/kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ macro_rules! gen_nodekind_enum {
),*
$(,)?
}) => {
use crate::context::NodeListElement;
use crate::node_child::NodeChild;

// The kind of an AST node.
// Matching against this enum allows traversal of the AST.
// Each variant of the enum must only have fields of the following types:
Expand Down Expand Up @@ -356,9 +359,9 @@ macro_rules! gen_nodekind_enum {
LogicalExpressionOperator,
MethodDefinitionKind,
Node,
NodeChild,
NodeLabel,
NodeList,
node_child::NodeChild,
NodeMetadata,
NodeString,
PropertyKind,
Expand Down
Loading

0 comments on commit ec35cdb

Please sign in to comment.