Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions compiler-rust/src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12510,6 +12510,9 @@ pub struct InProcessCompileResult {
pub typed_tree_sexp: String,
pub raw_lambda_sexp: String,
pub lambda_sexp: String,
/// What the file defines, as JSON (`repl::describe_signature`); with
/// `CompilerOptions::capture_intermediates`.
pub signature_description: String,
/// The intermediate representations requested by `CompilerOptions::dumps`.
pub dumps: Vec<(DumpKind, String)>,
/// The warning reports the file compile prints to stderr.
Expand Down Expand Up @@ -12545,6 +12548,9 @@ pub struct InProcessPreJsCompileResult {
pub typed_tree_sexp: String,
pub raw_lambda_sexp: String,
pub lambda_sexp: String,
/// What the file defines, as JSON (`repl::describe_signature`); with
/// `CompilerOptions::capture_intermediates`.
pub signature_description: String,
/// The intermediate representations requested by `CompilerOptions::dumps`.
pub dumps: Vec<(DumpKind, String)>,
/// The warning reports the file compile prints to stderr.
Expand Down Expand Up @@ -13670,6 +13676,12 @@ pub fn compile_preprocessed_structure_in_process_until_js(
} else {
String::new()
};
let signature_description = if options.capture_intermediates {
let signature = crate::types::includemod::simplify_signature(&typed_structure.str_type);
crate::repl::describe_signature(&type_ctx, &final_env, &signature).to_string()
} else {
String::new()
};

if !has_interface || gentype_ignore_interface {
// With a `.resi`, compiler/gentype/Paths.ml:61-86 makes the
Expand Down Expand Up @@ -13958,6 +13970,7 @@ pub fn compile_preprocessed_structure_in_process_until_js(
loaded_modules,
lam_locs,
typed_tree_sexp,
signature_description,
raw_lambda_sexp,
lambda_sexp,
dumps,
Expand Down Expand Up @@ -14192,6 +14205,7 @@ pub fn finish_preprocessed_structure_in_process_from_js_boundary_with_metadata_h
cmj_export_lambdas,
hoisted_exports: pre_js.hoisted_exports,
typed_tree_sexp: pre_js.typed_tree_sexp,
signature_description: pre_js.signature_description,
raw_lambda_sexp: pre_js.raw_lambda_sexp,
lambda_sexp: pre_js.lambda_sexp,
dumps: pre_js.dumps,
Expand Down
1 change: 1 addition & 0 deletions compiler-rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ pub mod parser;
pub mod perf_counters;
pub mod process_cwd;
pub mod raw_lambda;
pub mod repl;
/// Source text decoding helpers.
pub mod source_text;
pub mod string_literal;
Expand Down
7 changes: 6 additions & 1 deletion compiler-rust/src/macros/discover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,12 @@ fn run_call(
return None;
}
};
let (module, value) = split_macro_name(name);
// The file the macro is in is where its name leads, which is not always
// its first part: the name can go through an alias (`module D = Debug`)
// or name a module of an opened file.
let resolved =
lookup_value(tctx, env, name).map(|(path, _)| env.normalize_path_prefix(&path).name());
let (module, value) = split_macro_name(resolved.as_deref().unwrap_or(name));
let request = json!({
"kind": "call",
"module": module,
Expand Down
2 changes: 1 addition & 1 deletion compiler-rust/src/macros/reflect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ fn tag_text(tag: &LiteralTag) -> String {

/// The type of a declaration's member (a field, a constructor argument) at
/// the instance `args` of the declaration's parameters.
fn member_type(
pub(crate) fn member_type(
ctx: &TypeContext,
params: &[TypeExprRef],
args: &[TypeExprRef],
Expand Down
Loading
Loading