Exception: Rubycc::Front::ConstantEvaluator::NotConstant

Inherits:
StandardError
  • Object
show all
Defined in:
lib/rubycc/front/constant_evaluator.rb

Overview

Raised when some reachable part of the expression is not a constant-expression at all — a variable reference, a function call, an assignment, an increment/decrement, sizeof of an expression, or a comma. token is the offending node's token, for the caller to build a diagnostic naming its own context ("case label ...", "array size ...").

Direct Known Subclasses

OffsetofError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token) ⇒ NotConstant

Returns a new instance of NotConstant.



35
36
37
38
# File 'lib/rubycc/front/constant_evaluator.rb', line 35

def initialize(token)
  @token = token
  super("expression is not a constant expression")
end

Instance Attribute Details

#tokenObject (readonly)

Returns the value of attribute token.



33
34
35
# File 'lib/rubycc/front/constant_evaluator.rb', line 33

def token
  @token
end