forked from Aurel300/prusti-dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port
show_ide_info
and skip_verification
flags
Querying signatures, spans of call contract collection and call finding does not work yet. PR: viperproject#1334
- Loading branch information
Showing
11 changed files
with
277 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
use serde::Serialize; | ||
use super::vsc_span::VscSpan; | ||
|
||
#[derive(Serialize)] | ||
pub struct EncodingInfo { | ||
pub call_contract_spans: String, | ||
} | ||
|
||
impl EncodingInfo { | ||
pub fn to_json_string(self) -> String { | ||
serde_json::to_string(&self).unwrap() | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use serde::Serialize; | ||
use viper::VerificationResult; | ||
|
||
/// Generated for each verification item, containing information | ||
/// about the result of the verification. This information will be emitted | ||
/// if the show_ide_info flag is set, and it's purpose is to be | ||
/// consumed by prusti-assistant. | ||
#[derive(Serialize)] | ||
pub struct IdeVerificationResult { | ||
/// the name / defpath of the method | ||
item_name: String, | ||
/// whether the verification of that method was successful | ||
success: bool, | ||
/// how long the verification took | ||
time_ms: u128, | ||
/// whether this result was cached or is fresh | ||
cached: bool, | ||
} | ||
|
||
impl From<&VerificationResult> for IdeVerificationResult { | ||
fn from(res: &VerificationResult) -> Self { | ||
Self { | ||
item_name: res.item_name.clone(), | ||
success: res.is_success(), | ||
time_ms: res.time_ms, | ||
cached: res.cached, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
pub mod ide_verification_result; | ||
pub mod encoding_info; | ||
pub mod vsc_span; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use prusti_rustc_interface::span::{source_map::SourceMap, Span}; | ||
use serde::Serialize; | ||
|
||
/// a representation of spans that is more usable with VSCode. | ||
#[derive(Serialize, Clone)] | ||
pub struct VscSpan { | ||
column_end: usize, | ||
column_start: usize, | ||
line_end: usize, | ||
line_start: usize, | ||
file_name: String, | ||
is_primary: bool, | ||
} | ||
|
||
impl VscSpan { | ||
pub fn from_span(sp: &Span, sourcemap: &SourceMap) -> Self { | ||
let span_filename = sourcemap.span_to_filename(*sp); | ||
let diag_filename = sourcemap.filename_for_diagnostics(&span_filename); | ||
let file_name = format!("{diag_filename}"); | ||
|
||
let (l1, l2) = sourcemap.is_valid_span(*sp).expect("Invalid span"); | ||
Self { | ||
column_start: l1.col.0, | ||
column_end: l2.col.0, | ||
line_start: l1.line, | ||
line_end: l2.line, | ||
file_name, | ||
// the following one is not relevant here, we just want to be | ||
// able to reuse the existing methods and the parser | ||
// for spans in VSCode | ||
is_primary: false, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.