Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
GearsDatapacks committed Feb 26, 2025
1 parent 16b4100 commit ac899bf
Show file tree
Hide file tree
Showing 15 changed files with 256 additions and 151 deletions.
138 changes: 69 additions & 69 deletions compiler-core/generated/schema_capnp.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion compiler-core/schema.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ struct Version {
struct TypesVariantConstructors {
variants @0 :List(TypeValueConstructor);
typeParametersIds @1 :List(UInt16);
opaque @2 :Bool;
}

struct TypeValueConstructor {
Expand All @@ -77,7 +78,6 @@ struct TypeConstructor {
deprecated @4 :Text;
origin @5 :SrcSpan;
documentation @6 :Text;
opaque @7 :Bool;
}

struct AccessorsMap {
Expand Down
16 changes: 10 additions & 6 deletions compiler-core/src/analyse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ use crate::{
fields::{FieldMap, FieldMapBuilder},
hydrator::Hydrator,
prelude::*,
AccessorsMap, Deprecation, ModuleInterface, PatternConstructor, RecordAccessor, Type,
TypeAliasConstructor, TypeConstructor, TypeValueConstructor, TypeValueConstructorField,
TypeVariantConstructors, ValueConstructor, ValueConstructorVariant, Warning,
AccessorsMap, Deprecation, ModuleInterface, Opaque, PatternConstructor, RecordAccessor,
Type, TypeAliasConstructor, TypeConstructor, TypeValueConstructor,
TypeValueConstructorField, TypeVariantConstructors, ValueConstructor,
ValueConstructorVariant, Warning,
},
uid::UniqueIdGenerator,
warning::TypeWarningEmitter,
Expand Down Expand Up @@ -1108,10 +1109,15 @@ impl<'a, A> ModuleAnalyzer<'a, A> {
);
}

let opaque = if *opaque {
Opaque::Opaque
} else {
Opaque::NotOpaque
};
// Now record the constructors for the type.
environment.insert_type_to_constructors(
name.clone(),
TypeVariantConstructors::new(constructors_data, type_parameters, hydrator),
TypeVariantConstructors::new(constructors_data, type_parameters, opaque, hydrator),
);

Ok(())
Expand Down Expand Up @@ -1185,7 +1191,6 @@ impl<'a, A> ModuleAnalyzer<'a, A> {
publicity,
type_,
documentation: documentation.as_ref().map(|(_, doc)| doc.clone()),
opaque: *opaque,
},
)
.expect("name uniqueness checked above");
Expand Down Expand Up @@ -1260,7 +1265,6 @@ impl<'a, A> ModuleAnalyzer<'a, A> {
deprecation: deprecation.clone(),
publicity: *publicity,
documentation: documentation.as_ref().map(|(_, doc)| doc.clone()),
opaque: false,
},
)?;

Expand Down
2 changes: 1 addition & 1 deletion compiler-core/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ fn mode_includes_tests() {
pub struct Package {
pub config: PackageConfig,
pub modules: Vec<Module>,
pub module_names: Vec<EcoString>,
pub cached_module_names: Vec<EcoString>,
}

impl Package {
Expand Down
Loading

0 comments on commit ac899bf

Please sign in to comment.