Exception: Pione::Lang::LangTypeError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/pione/lang/lang-exception.rb

Overview

LangTypeError represents type mismatch error in PIONE language.

Instance Method Summary collapse

Constructor Details

#initialize(obj, type, env) ⇒ LangTypeError

Returns a new instance of LangTypeError.



159
160
161
162
163
# File 'lib/pione/lang/lang-exception.rb', line 159

def initialize(obj, type, env)
  @obj = obj
  @type = type
  @env = env
end

Instance Method Details

#messageObject



165
166
167
168
169
170
171
172
173
# File 'lib/pione/lang/lang-exception.rb', line 165

def message
  args = [
    @type.name,
    @obj.pione_type(env).name,
    @obj.line,
    @obj.column
  ]
  "expected %s, but got %s(line: %s, column: %s)" % args
end