Skip to content

Commit

Permalink
Move struct() global next to struct defs
Browse files Browse the repository at this point in the history
Reviewed By: JakobDegen

Differential Revision: D63009242

fbshipit-source-id: e7273227d20d9e84c3c0c2f7b94a1ddf43b46ef4
  • Loading branch information
stepancheg authored and facebook-github-bot committed Sep 20, 2024
1 parent 0701d2f commit 577903e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions starlark/src/stdlib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ mod funcs;
pub(crate) mod internal;
pub(crate) mod json;
pub(crate) mod partial;
pub(crate) mod structs;

pub use extra::PrintHandler;

use crate::stdlib::funcs::globals::register_globals;
use crate::stdlib::internal::register_internal;
use crate::values::enumeration::globals::register_enum;
use crate::values::record::globals::register_record;
use crate::values::structs::structs::register_struct;
use crate::values::typing;

/// Return the default global environment, it is not yet frozen so that a caller
Expand Down Expand Up @@ -108,7 +108,7 @@ impl LibraryExtension {
pub fn add(self, builder: &mut GlobalsBuilder) {
use LibraryExtension::*;
match self {
StructType => structs::global(builder),
StructType => register_struct(builder),
RecordType => register_record(builder),
EnumType => register_enum(builder),
Map => extra::map(builder),
Expand Down
1 change: 1 addition & 0 deletions starlark/src/values/types/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
pub(crate) mod alloc;
pub(crate) mod refs;
pub(crate) mod structs;
pub(crate) mod unordered_hasher;
pub(crate) mod value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ impl TyCustomFunctionImpl for StructType {
}
}

/// Register `struct` builtin.
#[starlark_module]
pub fn global(builder: &mut GlobalsBuilder) {
pub(crate) fn register_struct(builder: &mut GlobalsBuilder) {
#[starlark(
ty_custom_function = StructType,
as_type = FrozenStruct,
Expand Down

0 comments on commit 577903e

Please sign in to comment.