private void CheckMoveAddr(Core.InstructionMoveAddr inst) { if (!TypeResolver.ValidateDataAccess(this.session, this.funct, inst.source)) { this.foundErrors = true; return; } var srcMut = TypeResolver.GetDataAccessMutability(this.session, this.funct, inst.source); if (inst.mutable && !srcMut) { this.foundErrors = true; this.session.AddMessage( Diagnostics.MessageKind.Error, Diagnostics.MessageCode.IncompatibleMutability, "value is not mutable", inst.source.span); } var destType = TypeResolver.GetDataAccessType(this.session, this.funct, inst.destination); var srcType = TypeResolver.GetDataAccessType(this.session, this.funct, inst.source); var srcPtr = Core.TypePointer.Of(inst.mutable, srcType); CheckMove(inst.destination, srcPtr, inst.span); }
private void CheckMoveAddr(List <InitStatus> statusList, Core.InstructionMoveAddr inst) { ValidateSource(statusList, inst.source); if (inst.mutable) { MarkTakenMutAddr(statusList, inst.source); } CheckAndInitDestination(statusList, inst.destination); }
private void ApplyRuleForMoveAddr(ref bool appliedRule, Core.InstructionMoveAddr inst) { var destType = TypeResolver.GetDataAccessType(session, funct, inst.destination); var srcPtr = Core.TypePointer.Of( inst.mutable, TypeResolver.GetDataAccessType(session, funct, inst.source)); var srcType = (Core.Type)srcPtr; var inferredDest = TypeInferencer.Try(session, srcType, ref destType); var inferredSrc = TypeInferencer.Try(session, destType, ref srcType); if (inferredDest) { appliedRule = ApplyToDataAccess(inst.destination, destType); } if (inferredSrc) { appliedRule = ApplyToDataAccess(inst.source, srcPtr.pointedToType); } }