Exemplo n.º 1
0
 /**      
  * Get the function prototype as string
  * 
  * @return string
  */
 public function getPrototypeAsString()
 {
     $str = $this->returnType->getFullTypeName() . ' ' . $this->name . '(';
     foreach ($this->argumentTypes as $argumentType) {
         $str .= $argumentType->getFullTypeName() . ', ';
     }
     return rtrim($str, ', ') . ')';
 }
Exemplo n.º 2
0
 /**
  * Checks this type is compatible with another type
  * Note: implementation of IType::isCompatibleWith
  * 
  * @param IType $type Type to check compatibility
  * 
  * @return boolean 
  */
 public function isCompatibleWith(IType $type)
 {
     switch ($type->getTypeCode()) {
         case TypeCode::BYTE:
         case TypeCode::CHAR:
             return true;
     }
     return false;
 }
Exemplo n.º 3
0
 /**
  * Parse primitive type literal.
  * 
  * @param IType $targetType Expected type of the current literal.
  * 
  * @return AbstractExpression
  * 
  * @throws ODataException
  */
 private function _parseTypedLiteral(IType $targetType)
 {
     $literal = $this->_lexer->getCurrentToken()->Text;
     $outVal = null;
     if (!$targetType->validate($literal, $outVal)) {
         throw ODataException::createSyntaxError(Messages::expressionParserUnrecognizedLiteral($targetType->getFullTypeName(), $literal, $this->_lexer->getCurrentToken()->Position));
     }
     $result = new ConstantExpression($outVal, $targetType);
     $this->_lexer->nextToken();
     return $result;
 }
Exemplo n.º 4
0
 /**
  * Checks expression is a specific type
  * 
  * @param IType $type The type to check
  * 
  * @return boolean
  */
 public function typeIs(IType $type)
 {
     return $this->type->getTypeCode() == $type->getTypeCode();
 }
Exemplo n.º 5
0
 /**
  * Checks this type (Void) is compatible with another type
  * Note: implementation of IType::isCompatibleWith
  * 
  * @param IType $type Type to check compatibility
  * 
  * @return boolean 
  */
 public function isCompatibleWith(IType $type)
 {
     return $type->getTypeCode() == TypeCode::VOID;
 }