static bool static_match(compile_t* c, LLVMValueRef value, ast_t* type, ast_t* pattern, LLVMBasicBlockRef next_block) { switch(ast_id(pattern)) { case TK_NONE: return true; case TK_MATCH_CAPTURE: // Capture the match expression (or element thereof). return static_capture(c, value, type, pattern, next_block); case TK_SEQ: { // Treat a one element sequence as its component expression. // We already checked that the sequence doesn't have multiple elements // during type checking. ast_t* child = ast_child(pattern); assert(child != NULL); assert(ast_sibling(child) == NULL); // Pass on the element in the seq instead of the seq. return static_match(c, value, type, child, next_block); } case TK_TUPLE: { // Tuples must have multiple elements, or they aren't tuples. assert(ast_child(pattern) != NULL); assert(ast_sibling(ast_child(pattern)) != NULL); // Destructure the match expression (or element thereof). return static_tuple(c, value, type, pattern, next_block); } default: // Test the match expression (or element thereof). return static_value(c, value, type, pattern, next_block); } return true; }
of_size_proxy& operator=(std::size_t value_) { BOOST_ASSERT_MSG( static_value(i) == -1 || static_value(i) == value_, "Dimension in size different from static value" ); *value = value_; return *this; }