Skip to content

Commit

Permalink
post rebase patches
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-schott committed Nov 4, 2023
1 parent 0c1ccaa commit b1c9e93
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 13 deletions.
13 changes: 7 additions & 6 deletions compiler/passes/src/type_checking/check_program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,13 @@ impl<'a> ProgramVisitor<'a> for TypeChecker<'a> {

fn visit_struct_stub(&mut self, input: &'a Struct) {
// Allow records only.
if !input.is_record {
self.emit_err(TypeCheckerError::stubs_can_only_have_records_and_transitions(
"non-record struct",
input.span,
));
}
// TODO: Keep this or not?
// if !input.is_record {
// self.emit_err(TypeCheckerError::stubs_can_only_have_records_and_transitions(
// "non-record struct",
// input.span,
// ));
// }

self.visit_struct(input);
}
Expand Down
5 changes: 3 additions & 2 deletions leo/cli/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use leo_errors::Result;

use clap::Parser;
use colored::Colorize;
use leo_span::symbol::create_session_if_not_set_then;
use std::{path::PathBuf, process::exit};

/// CLI Arguments entry point - includes global parameters and subcommands
Expand Down Expand Up @@ -135,8 +134,10 @@ pub fn run_with_args(cli: CLI) -> Result<()> {
}
}


#[test]
pub fn build_test() -> Result<()> {
use leo_span::symbol::create_session_if_not_set_then;
const BUILD_DIRECTORY: &str = "utils/tmp/project";

let cli = CLI {
Expand All @@ -152,7 +153,7 @@ pub fn build_test() -> Result<()> {
}
#[test]
pub fn build_super_simple_test() -> Result<()> {
dbg!(std::env::current_dir().expect("TODO: panic message"));
use leo_span::symbol::create_session_if_not_set_then;
const BUILD_DIRECTORY: &str = "utils/tmp/super_simple";

let cli = CLI {
Expand Down
15 changes: 11 additions & 4 deletions utils/disassembler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
// You should have received a copy of the GNU General Public License
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.

use std::str::FromStr;
use snarkvm::{
prelude::{Itertools, Network},
synthesizer::program::{CommandTrait, InstructionTrait, ProgramCore},
prelude::{Itertools, Network, Testnet3},
synthesizer::program::{CommandTrait, InstructionTrait, Program, ProgramCore},
};
type CurrentNetwork = Testnet3;

use leo_ast::{FunctionStub, Identifier, ProgramId, Struct, Stub};

fn main() {}

pub fn disassemble<N: Network, Instruction: InstructionTrait<N>, Command: CommandTrait<N>>(
program: ProgramCore<N, Instruction, Command>,
) -> Stub {
Expand Down Expand Up @@ -53,6 +53,13 @@ pub fn disassemble<N: Network, Instruction: InstructionTrait<N>, Command: Comman
}
}

pub fn disassemble_from_str(
program: String,
) -> Stub {
let program = Program::<CurrentNetwork>::from_str(&program);
disassemble(program.expect("Failed to parse program")) // TODO: Handle error
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
3 changes: 2 additions & 1 deletion utils/retriever/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use disassembler::disassemble_from_str;
use indexmap::{IndexMap, IndexSet};
use leo_ast::Stub;
use leo_passes::{common::DiGraph, DiGraphError};
use leo_span::{symbol::create_session_if_not_set_then, Symbol};
use leo_span::Symbol;
use serde::{Deserialize, Serialize};
use sha2::{Digest, Sha256};
use std::{
Expand Down Expand Up @@ -322,6 +322,7 @@ fn fetch_from_network(program: String, network: Network) -> String {
#[cfg(test)]
mod tests {
use super::*;
use leo_span::symbol::create_session_if_not_set_then;

#[test]
fn basic_test() {
Expand Down

0 comments on commit b1c9e93

Please sign in to comment.