diff --git a/README.md b/README.md index 8fcbe7ff56..bef552b11b 100644 --- a/README.md +++ b/README.md @@ -384,7 +384,8 @@ import [package].*; ``` ### Local -You can import from a local file in the `src/` directory by using its `[file].leo` as the `[package]` name. +You can import from a local file in the same package using its direct path. +`src/` directory by using its `[file].leo` as the `[package]` name. ```rust import [file].[name]; diff --git a/compiler/src/constraints/expression.rs b/compiler/src/constraints/expression.rs index e8cacd51c7..0d86812bda 100644 --- a/compiler/src/constraints/expression.rs +++ b/compiler/src/constraints/expression.rs @@ -34,6 +34,8 @@ use snarkos_models::{ }, }; +static SELF_KEYWORD: &'static str = "self"; + impl> ConstrainedProgram { /// Enforce a variable expression by getting the resolved value pub(crate) fn evaluate_identifier( @@ -699,6 +701,7 @@ impl> ConstrainedProgram { circuit_member: Identifier, span: Span, ) -> Result, ExpressionError> { + println!("access"); let (circuit_name, members) = match self.enforce_expression_value( cs, file_scope.clone(), @@ -725,8 +728,10 @@ impl> ConstrainedProgram { _ => { let circuit_scope = new_scope(file_scope.clone(), circuit_name.to_string()); let function_scope = new_scope(circuit_scope, member.0.to_string()); - let field = new_scope(function_scope, stored_member.0.to_string()); + let self_keyword = new_scope(function_scope, SELF_KEYWORD.to_string()); + let field = new_scope(self_keyword, stored_member.0.to_string()); + println!("storing"); self.store(field, stored_member.1.clone()); } } diff --git a/compiler/src/constraints/program.rs b/compiler/src/constraints/program.rs index 6fe4ee2ce7..307b87ecfe 100644 --- a/compiler/src/constraints/program.rs +++ b/compiler/src/constraints/program.rs @@ -22,6 +22,7 @@ impl> ConstrainedProgram { } pub(crate) fn store(&mut self, name: String, value: ConstrainedValue) { + println!("{}", name); self.identifiers.insert(name, value); } diff --git a/types/src/common/identifier.rs b/types/src/common/identifier.rs index 0739dbe3d3..cd152b5ccd 100644 --- a/types/src/common/identifier.rs +++ b/types/src/common/identifier.rs @@ -13,7 +13,7 @@ pub struct Identifier { impl Identifier { pub fn is_self(&self) -> bool { - self.name == "Self" + self.name == "Self" || self.name == "self" } }