mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-11-23 23:23:50 +03:00
Stubs for arrays access expressions in passes
This commit is contained in:
parent
c94acdebbd
commit
eb420b6544
@ -62,6 +62,11 @@ impl<'a> ExpressionVisitor<'a> for CheckUniqueNodeIds<'a> {
|
||||
|
||||
fn visit_access(&mut self, input: &'a AccessExpression, _: &Self::AdditionalInput) -> Self::Output {
|
||||
match input {
|
||||
AccessExpression::Array(ArrayAccess { array, index, id, .. }) => {
|
||||
self.visit_expression(array, &Default::default());
|
||||
self.visit_expression(index, &Default::default());
|
||||
self.check(*id);
|
||||
}
|
||||
AccessExpression::AssociatedConstant(AssociatedConstant { ty, name, id, .. }) => {
|
||||
self.check_ty(ty);
|
||||
self.visit_identifier(name, &Default::default());
|
||||
|
@ -492,6 +492,7 @@ impl<'a> CodeGenerator<'a> {
|
||||
|
||||
fn visit_access(&mut self, input: &'a AccessExpression) -> (String, String) {
|
||||
match input {
|
||||
AccessExpression::Array(array) => todo!(),
|
||||
AccessExpression::Member(access) => self.visit_member_access(access),
|
||||
AccessExpression::AssociatedConstant(constant) => self.visit_associated_constant(constant),
|
||||
AccessExpression::AssociatedFunction(function) => self.visit_associated_function(function),
|
||||
|
@ -18,6 +18,7 @@ use crate::DeadCodeEliminator;
|
||||
|
||||
use leo_ast::{
|
||||
AccessExpression,
|
||||
ArrayAccess,
|
||||
AssociatedFunction,
|
||||
Expression,
|
||||
ExpressionReconstructor,
|
||||
@ -37,6 +38,12 @@ impl ExpressionReconstructor for DeadCodeEliminator<'_> {
|
||||
fn reconstruct_access(&mut self, input: AccessExpression) -> (Expression, Self::AdditionalOutput) {
|
||||
(
|
||||
Expression::Access(match input {
|
||||
AccessExpression::Array(array) => AccessExpression::Array(ArrayAccess {
|
||||
array: Box::new(self.reconstruct_expression(*array.array).0),
|
||||
index: Box::new(self.reconstruct_expression(*array.index).0),
|
||||
span: array.span,
|
||||
id: array.id,
|
||||
}),
|
||||
AccessExpression::AssociatedFunction(function) => {
|
||||
// If the associated function manipulates a mapping, mark the statement as necessary.
|
||||
match (&function.ty, function.name.name) {
|
||||
|
@ -42,6 +42,7 @@ impl<'a> ExpressionVisitor<'a> for TypeChecker<'a> {
|
||||
|
||||
fn visit_access(&mut self, input: &'a AccessExpression, expected: &Self::AdditionalInput) -> Self::Output {
|
||||
match input {
|
||||
AccessExpression::Array(array) => todo!(),
|
||||
AccessExpression::AssociatedFunction(access) => {
|
||||
// Check core struct name and function.
|
||||
if let Some(core_instruction) = self.get_core_function_call(&access.ty, &access.name) {
|
||||
|
Loading…
Reference in New Issue
Block a user