mirror of
https://github.com/voltrevo/ValueScript.git
synced 2026-01-15 00:18:06 -05:00
Implement to_val_string on Val and avoid conversion when already string
This commit is contained in:
@@ -8,7 +8,7 @@ use crate::builtins::type_error_builtin::ToTypeError;
|
||||
use crate::vs_array::VsArray;
|
||||
use crate::vs_class::VsClass;
|
||||
use crate::vs_object::VsObject;
|
||||
use crate::vs_value::{LoadFunctionResult, ToVal, ToValString, Val, ValTrait, VsType};
|
||||
use crate::vs_value::{LoadFunctionResult, ToVal, Val, ValTrait, VsType};
|
||||
|
||||
pub struct ThisWrapper<'a> {
|
||||
const_: bool,
|
||||
@@ -51,7 +51,7 @@ impl ValTrait for NativeFunction {
|
||||
false
|
||||
}
|
||||
fn to_primitive(&self) -> Val {
|
||||
self.to_val_string()
|
||||
self.to_string().to_val()
|
||||
}
|
||||
fn is_truthy(&self) -> bool {
|
||||
true
|
||||
|
||||
Reference in New Issue
Block a user