private SemanticType checkConstant ( Expr . Constant expr , Environment env ) { Value item = expr . getValue ( ) ; switch ( item . getOpcode ( ) ) { case ITEM_null : return Type . Null ; case ITEM_bool : return Type . Bool ; case ITEM_int : return Type . Int ; case ITEM_byte : return Type . Byte ; case ITEM_utf8 : // FIXME: this is not an optimal solution. The reason being that we // have lost nominal information regarding whether it is an instance // of std::ascii or std::utf8, for example. return new SemanticType . Array ( Type . Int ) ; default : return internalFailure ( "unknown constant encountered: " + expr , expr ) ; } }
Check the type of a given constant expression . This is straightforward since the determine is fully determined by the kind of constant we have .