🚑️ 不再允许通过不同子树访问/修改同一个对象 #42
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why?
通过两个子树修改同一个对象,可能破坏CT的可恢复性,例如:
因为
#0.bullet和#1.bullet实际关联的bullet实例是同一个,第二次构建damage时,将记录错误的初始值,导致错误恢复。Change
现在访问重复对象的子树时,例如
#1.bullet.damage,将在resolve("damage")时报错,阻止访问,防止修改子属性。允许:直接设置bullet本身的行为,例如
"#1.bullet.=": {...}