class TypedRb::Model::TmRegexp
Regular expresssion
Attributes
exp[R]
options[R]
Public Class Methods
new(exp, options, node)
click to toggle source
Calls superclass method
TypedRb::Model::Expr::new
# File lib/typed/model/tm_regexp.rb, line 8 def initialize(exp, options, node) super(node) @exp = exp @ptions = options end
Public Instance Methods
check_type(context)
click to toggle source
# File lib/typed/model/tm_regexp.rb, line 14 def check_type(context) options.check_type(context) if options exp_type = exp.check_type(context) if exp_type.compatible?(Types::TyString.new(node), :lt) Types::TyRegexp.new(node) else error_message = "Error type checking Regexp: Expected String type for expression, found #{exp_type}" fail Types::TypeCheckError.new(error_message, node) end end