[DDMD] [refactor] Move Expression::isConst into a free function