src/AST/Expr.cpp
Type * addrExprType( const CodeLocation & loc, const Expr * arg ) {
		assert( arg );
		// If the expression's type is unknown, the address type is unknown.
		if ( nullptr == arg->result ) {
			return nullptr;
		// An lvalue is transformed directly.
		} else if ( arg->get_lvalue() ) {
			return addrType( arg->result );
		// Strip a layer of reference to "create" an lvalue expression.
		} else if ( auto refType = arg->result.as< ReferenceType >() ) {
			return addrType( refType->base );
		} else {
			SemanticError( loc, arg->result.get(),
				"Attempt to take address of non-lvalue expression: " );
		}
	}
/// The type of the address of an expression.
/// Caller is responsible for managing returned memory
The type of the address of an expression.
Caller is responsible for managing returned memory
The type of the address of an expression . Caller is responsible for managing returned memory
Type * addrExprType( const CodeLocation & loc, const Expr * arg ) {
		assert( arg );
		if ( nullptr == arg->result ) {
			return nullptr;
		} else if ( arg->get_lvalue() ) {
			return addrType( arg->result );
		} else if ( auto refType = arg->result.as< ReferenceType >() ) {
			return addrType( refType->base );
		} else {
			SemanticError( loc, arg->result.get(),
				"Attempt to take address of non-lvalue expression: " );
		}
	}
Type * addrExprType ( const CodeLocation & loc , const Expr * arg ) { assert ( arg ) ; if ( nullptr == arg -> result ) { return nullptr ; } else if ( arg -> get_lvalue ( ) ) { return addrType ( arg -> result ) ; } else if ( auto refType = arg -> result . as < ReferenceType > ( ) ) { return addrType ( refType -> base ) ; } else { SemanticError ( loc , arg -> result . get ( ) , " " ) ; } }
The type of the address of an expression.
The type of the address of an expression .
// If the expression's type is unknown, the address type is unknown. // An lvalue is transformed directly. // Strip a layer of reference to "create" an lvalue expression.