class Savi::AST::Annotation

Overview

Annotation is a comment attached to an expression, such as a doc string. These are differentiated from true comments, which are discarded in the AST. Annotations use the :: syntax instead of // and run til the end of line. These are currently used in compiler specs to mark checks for an expression, such as in the following example, which in a compiler spec will assert that the LiteralString expression gets its type inferred as String:

example = "example" ::type=> String ^~~~~~~~~~~~~

Defined in:

savi/ast.cr

Constructors

Instance Method Summary

Instance methods inherited from class Savi::AST::Node

accept(ctx : Compiler::Context, visitor : Visitor)
accept(ctx : Compiler::Context, visitor : CopyOnMutateVisitor)
accept
, annotations : Array(Annotation) | Nil annotations, annotations=(annotations : Array(Annotation) | Nil) annotations=, children_accept(ctx : Compiler::Context, visitor : Visitor)
children_accept(ctx : Compiler::Context, visitor : CopyOnMutateVisitor)
children_accept
, from(other : Node) from, pos pos, pos? : Savi::Source::Pos? pos?, span_pos(source) span_pos, with_pos(pos : Source::Pos) with_pos

Constructor Detail

def self.new(value : String) #

[View source]

Instance Method Detail

def name #

[View source]
def to_a : Array(A) #

[View source]
def value : String #

[View source]
def value=(value : String) #

[View source]