Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
giacomocavalieri authored and lpil committed Sep 12, 2024
1 parent 49b24d9 commit ac9ed60
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 23 deletions.
14 changes: 7 additions & 7 deletions compiler-core/schema.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ struct ValueConstructor {
}

struct Publicity {
union {
public @0 :Void;
private @1 :Void;
internal @2 :Option(SrcSpan);
}
union {
public @0 :Void;
private @1 :Void;
internal @2 :Option(SrcSpan);
}
}

struct Implementations {
Expand Down Expand Up @@ -159,8 +159,8 @@ struct ValueConstructorVariant {
}

struct External {
module @0 :Text;
function @1 :Text;
module @0 :Text;
function @1 :Text;
}

struct SrcSpan {
Expand Down
24 changes: 18 additions & 6 deletions compiler-core/src/analyse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,12 @@ impl<'a, A> ModuleAnalyzer<'a, A> {
let variant = ValueConstructorVariant::ModuleFn {
documentation: doc.as_ref().map(|(_, doc)| doc.clone()),
name: name.clone(),
external_erlang: external_erlang.clone().map(|(m, f, _)| (m, f)),
external_javascript: external_javascript.clone().map(|(m, f, _)| (m, f)),
external_erlang: external_erlang
.as_ref()
.map(|(m, f, _)| (m.clone(), f.clone())),
external_javascript: external_javascript
.as_ref()
.map(|(m, f, _)| (m.clone(), f.clone())),
field_map,
module: environment.current_module.clone(),
arity: typed_args.len(),
Expand Down Expand Up @@ -1290,8 +1294,12 @@ impl<'a, A> ModuleAnalyzer<'a, A> {
documentation: documentation.as_ref().map(|(_, doc)| doc.clone()),
name: name.clone(),
field_map,
external_erlang: external_erlang.clone().map(|(m, f, _)| (m, f)),
external_javascript: external_javascript.clone().map(|(m, f, _)| (m, f)),
external_erlang: external_erlang
.as_ref()
.map(|(m, f, _)| (m.clone(), f.clone())),
external_javascript: external_javascript
.as_ref()
.map(|(m, f, _)| (m.clone(), f.clone())),
module: environment.current_module.clone(),
arity: args.len(),
location: *location,
Expand Down Expand Up @@ -1590,8 +1598,12 @@ fn generalise_function(
documentation: doc.as_ref().map(|(_, doc)| doc.clone()),
name: name.clone(),
field_map,
external_erlang: external_erlang.clone().map(|(m, f, _)| (m, f)),
external_javascript: external_javascript.clone().map(|(m, f, _)| (m, f)),
external_erlang: external_erlang
.as_ref()
.map(|(m, f, _)| (m.clone(), f.clone())),
external_javascript: external_javascript
.as_ref()
.map(|(m, f, _)| (m.clone(), f.clone())),
module: module_name.clone(),
arity: args.len(),
location,
Expand Down
5 changes: 0 additions & 5 deletions compiler-core/src/language_server/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,6 @@ where
None => return Ok(None),
};

let a =
node.definition_location(this.compiler.project_compiler.get_importable_modules());
tracing::info!("{:#?}", node);
tracing::info!("{:#?}", a);

let location = match node
.definition_location(this.compiler.project_compiler.get_importable_modules())
{
Expand Down
10 changes: 5 additions & 5 deletions compiler-core/src/language_server/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,11 +414,11 @@ impl<'a> TestProject<'a> {
};

find_module(&self.root_package_modules)
.or(find_module(&self.dependency_modules))
.or(find_module(&self.test_modules))
.or(find_module(&self.hex_modules))
.or(find_module(&self.dev_hex_modules))
.or(find_module(&self.indirect_hex_modules))
.or_else(|| find_module(&self.dependency_modules))
.or_else(|| find_module(&self.test_modules))
.or_else(|| find_module(&self.hex_modules))
.or_else(|| find_module(&self.dev_hex_modules))
.or_else(|| find_module(&self.indirect_hex_modules))
}

pub fn add_module(mut self, name: &'a str, src: &'a str) -> Self {
Expand Down

0 comments on commit ac9ed60

Please sign in to comment.