Skip to content

Commit

Permalink
Change annotations on fe code blocks to fix expensive tests (#659)
Browse files Browse the repository at this point in the history
  • Loading branch information
Y-Nak authored Feb 8, 2022
1 parent 6d9c722 commit 9d413f6
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions crates/analyzer/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,37 +79,40 @@ pub trait AnalyzerContext {
///
/// # Example
///
/// ```ignore
/// ```fe
/// contract Foo:
/// fn foo():
/// if ...:
/// ...
/// else:
/// ...
/// ```
/// If the context is in `then` block, then this function returns `Item::Function(..)`.
/// If the context is in `then` block, then this function returns
/// `Item::Function(..)`.
fn parent(&self) -> Item;

/// Returns a function id that encloses a context.
///
/// # Panics
///
/// Panics if a context is not in a function. Use [`Self::is_in_function`] to determine whether a context is in a function.
/// Panics if a context is not in a function. Use [`Self::is_in_function`]
/// to determine whether a context is in a function.
fn parent_function(&self) -> FunctionId;

/// Returns a non-function item that encloses a context.
///
/// # Example
///
/// ```ignore
/// ```fe
/// contract Foo:
/// fn foo():
/// if ...:
/// ...
/// else:
/// ...
/// ```
/// If the context is in `then` block, then this function returns `Item::Type(TypeDef::Contract(..))`.
/// If the context is in `then` block, then this function returns
/// `Item::Type(TypeDef::Contract(..))`.
fn root_item(&self) -> Item {
let mut item = self.parent();
while let Item::Function(func_id) = item {
Expand All @@ -120,14 +123,16 @@ pub trait AnalyzerContext {

/// # Panics
///
/// Panics if a context is not in a function. Use [`Self::is_in_function`] to determine whether a context is in a function.
/// Panics if a context is not in a function. Use [`Self::is_in_function`]
/// to determine whether a context is in a function.
fn add_call(&self, node: &Node<ast::Expr>, call_type: CallType);

/// Store string literal to the current context.
///
/// # Panics
///
/// Panics if a context is not in a function. Use [`Self::is_in_function`] to determine whether a context is in a function.
/// Panics if a context is not in a function. Use [`Self::is_in_function`]
/// to determine whether a context is in a function.
fn add_string(&self, str_lit: SmolStr);

/// Returns `true` if the context is in function scope.
Expand Down

0 comments on commit 9d413f6

Please sign in to comment.