Skip to content
Merged
Show file tree
Hide file tree
Changes from 19 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
307 changes: 112 additions & 195 deletions Cargo.lock

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ datatest-stable = "0.3.2"
sha2 = "0.10.9"
dir-test = "0.4.1"

move-stdlib = { git = "https://github.com/asymptotic-code/sui", branch = "next" }
move-docgen = { git = "https://github.com/asymptotic-code/sui", branch = "next" }
move-package = { git = "https://github.com/asymptotic-code/sui", branch = "next" }
move-compiler = { git = "https://github.com/asymptotic-code/sui", branch = "next" }
move-ir-types = { git = "https://github.com/asymptotic-code/sui", branch = "next" }
move-core-types = { git = "https://github.com/asymptotic-code/sui", branch = "next" }
move-symbol-pool = { git = "https://github.com/asymptotic-code/sui", branch = "next" }
move-disassembler = { git = "https://github.com/asymptotic-code/sui", branch = "next" }
move-binary-format = { git = "https://github.com/asymptotic-code/sui", branch = "next" }
move-bytecode-source-map = { git = "https://github.com/asymptotic-code/sui", branch = "next" }
move-command-line-common = { git = "https://github.com/asymptotic-code/sui", branch = "next" }
move-stdlib = { git = "https://github.com/asymptotic-code/sui", branch = "more-spec-only-attributes" }
move-docgen = { git = "https://github.com/asymptotic-code/sui", branch = "more-spec-only-attributes" }
move-package = { git = "https://github.com/asymptotic-code/sui", branch = "more-spec-only-attributes" }
move-compiler = { git = "https://github.com/asymptotic-code/sui", branch = "more-spec-only-attributes" }
move-ir-types = { git = "https://github.com/asymptotic-code/sui", branch = "more-spec-only-attributes" }
move-core-types = { git = "https://github.com/asymptotic-code/sui", branch = "more-spec-only-attributes" }
move-symbol-pool = { git = "https://github.com/asymptotic-code/sui", branch = "more-spec-only-attributes" }
move-disassembler = { git = "https://github.com/asymptotic-code/sui", branch = "more-spec-only-attributes" }
move-binary-format = { git = "https://github.com/asymptotic-code/sui", branch = "more-spec-only-attributes" }
move-bytecode-source-map = { git = "https://github.com/asymptotic-code/sui", branch = "more-spec-only-attributes" }
move-command-line-common = { git = "https://github.com/asymptotic-code/sui", branch = "more-spec-only-attributes" }
3 changes: 3 additions & 0 deletions crates/move-model/src/builder/module_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ impl<'env, 'translator> ModuleBuilder<'env, 'translator> {
self.populate_env_from_result(
loc,
attributes,
module_def.attributes,
compiled_module,
source_map,
&function_infos,
Expand Down Expand Up @@ -516,6 +517,7 @@ impl ModuleBuilder<'_, '_> {
&mut self,
loc: Loc,
attributes: Vec<Attribute>,
toplevel_attributes: EA::Attributes,
module: CompiledModule,
source_map: SourceMap,
function_infos: &UniqueMap<PA::FunctionName, FunctionInfo>,
Expand Down Expand Up @@ -657,6 +659,7 @@ ot in AST",
self.parent.env.add(
loc,
attributes,
toplevel_attributes,
module,
source_map,
named_constants,
Expand Down
10 changes: 10 additions & 0 deletions crates/move-model/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,7 @@ impl GlobalEnv {
&mut self,
loc: Loc,
attributes: Vec<Attribute>,
toplevel_attributes: expansion::ast::Attributes,
module: CompiledModule,
source_map: SourceMap,
named_constants: BTreeMap<NamedConstantId, NamedConstantData>,
Expand Down Expand Up @@ -966,6 +967,7 @@ impl GlobalEnv {
source_map,
loc,
attributes,
toplevel_attributes,
used_modules: Default::default(),
friend_modules: Default::default(),
});
Expand Down Expand Up @@ -3983,6 +3985,7 @@ impl GlobalEnv {
),
loc: Loc::default(),
attributes: Default::default(),
toplevel_attributes: Default::default(),
used_modules: Default::default(),
friend_modules: Default::default(),
enum_data: BTreeMap::new(),
Expand Down Expand Up @@ -4025,6 +4028,8 @@ pub struct ModuleData {
/// Attributes attached to this module.
attributes: Vec<Attribute>,

toplevel_attributes: expansion::ast::Attributes,

/// Module byte code.
pub module: CompiledModule,

Expand Down Expand Up @@ -4080,6 +4085,7 @@ impl ModuleData {
source_map: SourceMap::new(MoveIrLoc::new(FileHash::empty(), 0, 0), ident),
loc: Loc::default(),
attributes: Default::default(),
toplevel_attributes: Default::default(),
used_modules: Default::default(),
friend_modules: Default::default(),
enum_data: BTreeMap::new(),
Expand Down Expand Up @@ -4125,6 +4131,10 @@ impl<'env> ModuleEnv<'env> {
&self.data.attributes
}

pub fn get_toplevel_attributes(&self) -> &expansion::ast::Attributes {
&self.data.toplevel_attributes
}

/// Returns full name as a string.
pub fn get_full_name_str(&self) -> String {
self.get_name().display_full(self.symbol_pool()).to_string()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ use crate::boogie_backend::{
boogie_type_suffix_for_struct, boogie_well_formed_check, boogie_well_formed_expr_bv,
FunctionTranslationStyle, TypeIdentToken,
},
options::{BoogieFileMode, BoogieOptions},
options::BoogieOptions,
spec_translator::SpecTranslator,
};

Expand Down Expand Up @@ -387,9 +387,7 @@ impl<'env> BoogieTranslator<'env> {
}
// Attempt to emit Pure variant if eligible
// BUT: Don't emit Pure variants in spec_no_abort_check.bpl
if !self.options.spec_no_abort_check_only
&& self.options.boogie_file_mode != BoogieFileMode::All
{
if !self.options.spec_no_abort_check_only {
self.translate_function_style(fun_env, FunctionTranslationStyle::Pure);
}
}
Expand All @@ -413,9 +411,7 @@ impl<'env> BoogieTranslator<'env> {
}
// Attempt to emit Pure variant if eligible
// BUT: Don't emit Pure variants in spec_no_abort_check.bpl
if !self.options.spec_no_abort_check_only
&& self.options.boogie_file_mode != BoogieFileMode::All
{
if !self.options.spec_no_abort_check_only {
self.translate_function_style(fun_env, FunctionTranslationStyle::Pure);
}
}
Expand Down Expand Up @@ -518,18 +514,14 @@ impl<'env> BoogieTranslator<'env> {
self.translate_function_style(fun_env, FunctionTranslationStyle::Aborts);
self.translate_function_style(fun_env, FunctionTranslationStyle::Opaque);

if self.options.boogie_file_mode == BoogieFileMode::All
|| self.targets.is_verified_spec(&fun_env.get_qualified_id())
{
if self.targets.is_verified_spec(&fun_env.get_qualified_id()) {
self.translate_function_style(fun_env, FunctionTranslationStyle::Default);
self.translate_function_style(fun_env, FunctionTranslationStyle::Asserts);
self.translate_function_style(fun_env, FunctionTranslationStyle::SpecNoAbortCheck);
}
// Emit Pure variant if eligible (gated inside)
// BUT: Don't emit Pure variants in spec_no_abort_check.bpl
if !self.options.spec_no_abort_check_only
&& self.options.boogie_file_mode != BoogieFileMode::All
{
if !self.options.spec_no_abort_check_only {
self.translate_function_style(fun_env, FunctionTranslationStyle::Pure);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,13 @@ impl BorrowAggregate {
pub enum BoogieFileMode {
Function,
Module,
All,
}

impl ToString for BoogieFileMode {
fn to_string(&self) -> String {
match self {
BoogieFileMode::Function => "function".to_string(),
BoogieFileMode::Module => "module".to_string(),
BoogieFileMode::All => "all".to_string(),
}
}
}
Expand Down
Loading