Browse Source

Add an error for C-style pointer selector expressions using '->' when parsing

gingerBill 6 years ago
parent
commit
b1663a14e9
1 changed files with 7 additions and 0 deletions
  1. 7 0
      src/parser.cpp

+ 7 - 0
src/parser.cpp

@@ -2203,6 +2203,13 @@ Ast *parse_atom_expr(AstFile *f, Ast *operand, bool lhs) {
 			}
 		} break;
 
+		case Token_ArrowRight: {
+			Token token = advance_token(f);
+			syntax_error(token, "Selector expressions use '.' rather than '->'");
+			operand = ast_selector_expr(f, token, operand, parse_ident(f));
+			break;
+		}
+
 		case Token_OpenBracket: {
 			if (lhs) {
 				// TODO(bill): Handle this