6.7.0 - Alpha10 - Fine tuning

This commit is contained in:
SuperMonster003
2025-11-07 19:28:19 +08:00
parent bc2f580e1c
commit 6186754327
8 changed files with 127 additions and 76 deletions

View File

@@ -323,6 +323,8 @@ object Inspect : Augmentable(), Invokable {
if (isReferenceRhino(value)) {
var cur: Scriptable = value
val objProtoForJs: Scriptable? = ScriptableObject.getObjectPrototype(cur)
val arrProtoForJs: Scriptable? = ScriptableObject.getArrayPrototype(cur)
val funcProtoForJs: Scriptable? = ScriptableObject.getFunctionPrototype(cur)
val objProtoForAugmentable: Scriptable = RhinoUtils.objectPrototype
val arrProtoForAugmentable: Scriptable = RhinoUtils.arrayPrototype
val funcProtoForAugmentable: Scriptable = RhinoUtils.functionPrototype
@@ -346,9 +348,9 @@ object Inspect : Augmentable(), Invokable {
// zh-CN: 标准 Java Object#toString 或等价实现, 视为未自定义, 跳过自定义判定.
return@run false
}
if (fn === objProtoForJs?.get("toString")) {
// Standard JavaScript Object.prototype.toString or equivalent implementation, skip custom check.
// zh-CN: 标准 JavaScript Object.prototype.toString 或等价实现, 视为未自定义, 跳过自定义判定.
if (fn === objProtoForJs?.get("toString") || fn === arrProtoForJs?.get("toString") || fn === funcProtoForJs?.get("toString")) {
// Standard JavaScript (Object/Array/Function).prototype.toString or equivalent implementation, skip custom check.
// zh-CN: 标准 JavaScript (Object/Array/Function).prototype.toString 或等价实现, 视为未自定义, 跳过自定义判定.
return@run false
}
val augmentableToStringList = listOf(
@@ -599,7 +601,7 @@ object Inspect : Augmentable(), Invokable {
ctx.stylize(content, "string")
}
value is Number -> {
ctx.stylize(value.toString(), "number")
ctx.stylize(Context.toString(value), "number")
}
value is Boolean -> {
ctx.stylize(Context.toString(value), "boolean")

View File

@@ -147,7 +147,6 @@ object IntentUtils {
false
}
@JvmStatic
@JvmOverloads
fun getUriOfFile(context: Context, path: String?, fileProviderAuthority: String? = AppFileProvider.AUTHORITY): Uri {

View File

@@ -69,18 +69,25 @@ object RhinoUtils {
/** [Long]: 2^53 - 1. */
const val MAX_SAFE_INT_IEEE754_L = 9_007_199_254_740_991L
/** [Long]: -(2^53 - 1). */
const val MIN_SAFE_INT_IEEE754_L = -9_007_199_254_740_991L
/** [Double]: 2^53 - 1. */
const val MAX_SAFE_INT_IEEE754_D = 9_007_199_254_740_991.0
/** [Double]: -(2^53 - 1). */
const val MIN_SAFE_INT_IEEE754_D = -9_007_199_254_740_991.0
/** [java.math.BigDecimal]: 2^53 - 1. */
val MAX_SAFE_INT_IEEE754_BD = MAX_SAFE_INT_IEEE754_D.toBigDecimal()
/** [java.math.BigDecimal]: -(2^53 - 1). */
val MIN_SAFE_INT_IEEE754_BD = MIN_SAFE_INT_IEEE754_D.toBigDecimal()
/** [java.math.BigInteger]: 2^53 - 1. */
val MAX_SAFE_INT_IEEE754_BI = MAX_SAFE_INT_IEEE754_L.toBigInteger()
/** [java.math.BigInteger]: -(2^53 - 1). */
val MIN_SAFE_INT_IEEE754_BI = MIN_SAFE_INT_IEEE754_L.toBigInteger()