Fix builds.

This commit is contained in:
Stephen Chung 2023-02-25 20:58:40 +08:00
parent 51581cdef5
commit 5f09b5d9d9
2 changed files with 6 additions and 1 deletions

View File

@ -24,6 +24,7 @@ Potentially breaking changes
Enhancements Enhancements
------------ ------------
* `Engine::new_raw` is now `const` and runs very fast, delaying all other initialization until first use.
* The functions `min` and `max` are added for numbers. * The functions `min` and `max` are added for numbers.
* Range cases in `switch` statements now also match floating-point and decimal values. In order to support this, however, small numeric ranges cases are no longer unrolled. * Range cases in `switch` statements now also match floating-point and decimal values. In order to support this, however, small numeric ranges cases are no longer unrolled.
* Loading a module via `import` now gives the module access to the current scope, including variables and constants defined inside. * Loading a module via `import` now gives the module access to the current scope, including variables and constants defined inside.

View File

@ -326,7 +326,11 @@ impl Engine {
&self, &self,
string: impl AsRef<str> + Into<ImmutableString>, string: impl AsRef<str> + Into<ImmutableString>,
) -> ImmutableString { ) -> ImmutableString {
locked_write(&self.interned_strings).get(string) if let Some(ref interner) = self.interned_strings {
locked_write(interner).get(string)
} else {
string.into()
}
} }
/// _(internals)_ Get an interned [string][ImmutableString]. /// _(internals)_ Get an interned [string][ImmutableString].