Skip to content

Commit

Permalink
Addressing reviewer comments #3
Browse files Browse the repository at this point in the history
  • Loading branch information
wrwg committed Oct 26, 2023
1 parent 7fabbc5 commit 6aba0c6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
9 changes: 5 additions & 4 deletions third_party/move/move-compiler/src/parser/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,15 @@ pub type AccessSpecifier = Spanned<AccessSpecifier_>;
/// An address specifier specifies the address at which a resource is accessed.
#[derive(Debug, Clone, PartialEq)]
pub enum AddressSpecifier_ {
/// Represents that now address was specicied, as in `Resource`
Empty,
/// Represents that the specified address is a wildcard, as in `Resource(*)`.
Any,
/// Represents the precise address.
Literal(NumericalAddress),
/// Represents a parameter name.
Name(Name),
/// Represents a function applied to a parameter name.
Call(NameAccessChain, Option<Vec<Type>>, Name),
}

Expand Down Expand Up @@ -281,10 +286,6 @@ pub enum FunctionBody_ {
pub type FunctionBody = Spanned<FunctionBody_>;

#[derive(PartialEq, Debug, Clone)]
// (public?) foo<T1(: copyable?), ..., TN(: copyable?)>(x1: t1, ..., xn: tn): t1 * ... * tn {
// body
// }
// (public?) native foo<T1(: copyable?), ..., TN(: copyable?)>(x1: t1, ..., xn: tn): t1 * ... * tn;
pub struct Function {
pub attributes: Vec<Attributes>,
pub loc: Loc,
Expand Down
8 changes: 4 additions & 4 deletions third_party/move/move-model/src/builder/module_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pub(crate) struct ModuleBuilder<'env, 'translator> {
/// Translated function definitions, if we are compiling Move code
pub fun_defs: BTreeMap<Symbol, Exp>,
/// Translated access specifiers, if we are compiling Move code
pub access_specifiers: BTreeMap<Symbol, Vec<AccessSpecifier>>,
pub fun_access_specifiers: BTreeMap<Symbol, Vec<AccessSpecifier>>,
/// Translated struct specifications.
pub struct_specs: BTreeMap<Symbol, Spec>,
/// Translated module spec
Expand Down Expand Up @@ -154,7 +154,7 @@ impl<'env, 'translator> ModuleBuilder<'env, 'translator> {
spec_vars: vec![],
fun_specs: BTreeMap::new(),
fun_defs: BTreeMap::new(),
access_specifiers: BTreeMap::new(),
fun_access_specifiers: BTreeMap::new(),
struct_specs: BTreeMap::new(),
module_spec: Spec::default(),
spec_block_infos: Default::default(),
Expand Down Expand Up @@ -1270,7 +1270,7 @@ impl<'env, 'translator> ModuleBuilder<'env, 'translator> {
.is_none());
if let Some(specifiers) = access_specifiers {
assert!(self
.access_specifiers
.fun_access_specifiers
.insert(full_name.symbol, specifiers)
.is_none());
}
Expand Down Expand Up @@ -3600,7 +3600,7 @@ impl<'env, 'translator> ModuleBuilder<'env, 'translator> {
// New function
let spec = self.fun_specs.remove(&name.symbol).unwrap_or_default();
let def = self.fun_defs.remove(&name.symbol);
let access_specifiers = self.access_specifiers.remove(&name.symbol);
let access_specifiers = self.fun_access_specifiers.remove(&name.symbol);
let data = FunctionData {
name: name.symbol,
loc: entry.loc.clone(),
Expand Down

0 comments on commit 6aba0c6

Please sign in to comment.