Enallage is the poetic function where there is a sudden shift in personage by the writer. It is found throughout the Old Testament. Here is an example in the 23rd Psalm:

[Third person]

1 The LORD is my shepherd, I shall not be in want.

2 He makes me lie down in green pastures,
he leads me beside quiet waters,

3 he restores my soul.
He guides me in paths of righteousness
for his name’s sake.

[Second person]

4 Even though I walk
through the valley of the shadow of death,
I will fear no evil,
for you are with me;
your rod and your staff,
they comfort me.

5 You prepare a table before me
in the presence of my enemies.
You anoint my head with oil;
my cup overflows.

6 Surely goodness and love will follow me
all the days of my life,
and I will dwell in the house of the LORD
forever. (Psalm 23 NIV)

The Book of Mormon also contains Enallage. Here is an example in the Psalm of Nephi:

[Third person]

20 My God hath been my support; he hath led me through mine afflictions in the wilderness; and he hath preserved me upon the waters of the great deep.
21 He hath filled me with his love, even unto the consuming of my flesh.
22 He hath confounded mine enemies, unto the causing of them to quake before me.
23 Behold, he hath heard my cry by day, and he hath given me knowledge by visions in the night-time.

[Second person]

30 Rejoice, O my heart, and cry unto the Lord, and say: O Lord, I will praise thee forever; yea, my soul will rejoice in thee, my God, and the rock of my salvation.
31 O Lord, wilt thou redeem my soul? Wilt thou deliver me out of the hands of mine enemies? Wilt thou make me that I may shake at the appearance of sin?
32 May the gates of hell be shut continually before me, because that my heart is broken and my spirit is contrite! O Lord, wilt thou not shut the gates of thy righteousness before me, that I may walk in the path of the low valley, that I may be strict in the plain road!
33 O Lord, wilt thou encircle me around in the robe of thy righteousness! O Lord, wilt thou make a way for mine escape before mine enemies! Wilt thou make my path straight before me! Wilt thou not place a stumbling block in my way—but that thou wouldst clear my way before me, and hedge not up my way, but the ways of mine enemy.
34 O Lord, I have trusted in thee, and I will trust in thee forever. I will not put my trust in the arm of flesh; for I know that cursed is he that putteth his trust in the arm of flesh. Yea, cursed is he that putteth his trust in man or maketh flesh his arm.

[Third person]

35 Yea, I know that God will give liberally to him that asketh. Yea, my God will give me, if I ask not amiss;

[Second person]

therefore I will lift up my voice unto thee; yea, I will cry unto thee, my God, the rock of my righteousness. Behold, my voice shall forever ascend up unto thee, my rock and mine everlasting God. Amen. (2 Nephi 4)

Once more, The Book of Mormon follows literary formulas. In this case, the shift in personage was meant to draw the person closer to God, just as it did in Psalm 23.