More documentation on chained assignment.

This commit is contained in:
Stephen Chung
2020-03-14 14:57:59 +08:00
parent 360fab7760
commit 504fd56f1f
4 changed files with 19 additions and 7 deletions

View File

@@ -153,12 +153,12 @@ impl AST {
/// Optimize the AST with constants defined in an external Scope.
///
/// Although optimization is performed by default during compilation, sometimes it is necessary to
/// "re"-optimize an AST. For example, when working with constants that are passed in via an
/// _re_-optimize an AST. For example, when working with constants that are passed in via an
/// external scope, it will be more efficient to optimize the AST once again to take advantage
/// of the new constants.
///
/// With this method, it is no longer necessary to regenerate a large script with hard-coded
/// constant values. The script AST can be compiled once and stored. During actually evaluation,
/// constant values. The script AST can be compiled just once. During actual evaluation,
/// constants are passed into the Engine via an external scope (i.e. with `scope.push_constant(...)`).
/// Then, the AST is cloned and the copy re-optimized before running.
pub fn optimize(self, scope: &Scope) -> Self {