class Coverage::SourceFile

Included Modules

Defined in:

coverage/inject/source_file.cr

Constant Summary

CRYSTAL_KEYWORDS = ["abstract", "do", "if", "nil?", "self", "unless", "alias", "else", "of", "sizeof", "until", "as", "elsif", "include", "struct", "when", "as?", "end", "instance_sizeof", "pointerof", "super", "while", "asm", "ensure", "is_a?", "private", "then", "with", "begin", "enum", "lib", "protected", "true", "yield", "break", "extend", "macro", "require", "case", "false", "module", "rescue", "typeof", "class", "for", "next", "return", "uninitialized", "def", "fun", "nil", "select", "union"] of ::String

List of keywords which are trouble with variable name. Some keywoards are not and won't be present in this list. Since this can break the code replacing the variable by a underscored version of it, and I'm not sure about this list, we will need to add/remove stuff to not break the code.

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from module MacroUtils

propagate_location_in_macro(node : Crystal::ASTNode, location : Nil)
propagate_location_in_macro(node : Crystal::Nop, location : Crystal::Location)
propagate_location_in_macro(node : Crystal::MacroIf, location : Crystal::Location)
propagate_location_in_macro(node : Crystal::MacroFor, location : Crystal::Location)
propagate_location_in_macro(node : Crystal::MacroLiteral, location : Crystal::Location)
propagate_location_in_macro(node : Crystal::Expressions, location)
propagate_location_in_macro(node : Crystal::ASTNode, location : Crystal::Location)
propagate_location_in_macro

Constructor Detail

def self.new(path : String, source : String, required_at : Int32 = 0) #

[View source]

Class Method Detail

def self.already_covered_file_name #

[View source]
def self.cover_file(file, &) #

[View source]
def self.file_list #

[View source]
def self.final_operations #

[View source]
def self.outputter : String #

[View source]
def self.outputter=(outputter : String) #

[View source]
def self.prelude_operations #

[View source]
def self.project_path : String #

[View source]
def self.project_path? : String | Nil #

[View source]
def self.register_file(f) #

[View source]
def self.relative_path_to_project(path) #

[View source]
def self.require_expanders #

[View source]
def self.use_require : String #

[View source]
def self.use_require=(use_require : String) #

[View source]

Instance Method Detail

def already_covered_locations : Set(Crystal::Location?) #

[View source]
def astree : Crystal::ASTNode #

[View source]
def astree? : Crystal::ASTNode | Nil #

[View source]
def enriched_source : String #

[View source]
def enriched_source? : String | Nil #

[View source]
def id : Int32 #

[View source]
def inject_cover(node : Crystal::ASTNode) #

[View source]
def lines : Array(Int32) #

[View source]
def md5_signature : String #

[View source]
def path : String #

[View source]
def process #

Inject in AST tree if required.


[View source]
def required_at : Int32 #

[View source]
def source : String #

[View source]
def to_covered_source #

[View source]
def visit(node : Crystal::Require) #

Management of required file is nasty and should be improved Since I've hard time to replace node on visit, I change the file argument to a number linked to an array of files Then on finalization, we replace each require "xxx" by the proper file.


[View source]
def visit(node : Crystal::OpAssign | Crystal::BinaryOp) #

Do not visit sub elements of inlined computations


[View source]
def visit(node : Crystal::Arg) #

[View source]
def visit(node : Crystal::Assign) #

Placeholder for bug #XXX


[View source]
def visit(node : Crystal::Expressions) #

[View source]
def visit(node : Crystal::Block | Crystal::While) #

[View source]
def visit(node : Crystal::MacroExpression) #

[View source]
def visit(node : Crystal::MacroLiteral) #

[View source]
def visit(node : Crystal::MacroIf) #

[View source]
def visit(node : Crystal::MacroFor) #

[View source]
def visit(node : Crystal::MacroVar) #

[View source]
def visit(node : Crystal::Asm) #

[View source]
def visit(node : Crystal::Def) #

[View source]
def visit(node : Crystal::Select) #

[View source]
def visit(node : Crystal::Case) #

[View source]
def visit(node : Crystal::If) #

[View source]
def visit(node : Crystal::Unless) #

[View source]
def visit(node : Crystal::ASTNode) #

Ignore other nodes for now


[View source]
def visit(node : Macro) #

[View source]