| 270 | |
| 271 | |
| 272 | void BinaryOp::SubScriptingOpTypeChecking() { |
| 273 | auto lhsType = lhs_->Type()->ToPointer(); |
| 274 | if (!lhsType) { |
| 275 | Error(this, "an pointer expected"); |
| 276 | } |
| 277 | if (!rhs_->Type()->IsInteger()) { |
| 278 | Error(this, "the operand of [] should be intger"); |
| 279 | } |
| 280 | |
| 281 | // The type of [] operator is the derived type |
| 282 | type_ = lhsType->Derived(); |
| 283 | } |
| 284 | |
| 285 | |
| 286 | void BinaryOp::MemberRefOpTypeChecking() { |