6.6.3 - Alpha5 - 代码编辑器格式化代码支持 ??, ?., ??= 等运算符

This commit is contained in:
SuperMonster003
2025-05-22 17:14:37 +08:00
parent e4437fc935
commit 818e9d7e40
3 changed files with 12 additions and 4 deletions

View File

@@ -36,6 +36,7 @@
"关于应用与开发者页面增加水平布局及小屏布局适配",
"设置页面对话框相关设置支持 \"使用默认值\" 菜单选项",
"文件管理器浮动按钮展开后点击其他区域可自动隐藏",
"代码编辑器格式化代码支持 `??`, `?.`, `??=` 等运算符",
"打包单文件时自动读取并勾选已安装应用的声明权限 _[`issue #362`](http://issues.autojs6.com/362)_",
"意图相关操作 (编辑/查看/安装/发送/播放等) 增加操作异常提示",
"ImageWrapper#saveTo 方法的路径参数支持相对路径",

View File

@@ -1440,7 +1440,7 @@ function Beautifier(js_source_text, options) {
return;
}
if (current_token.text === '::') {
if (current_token.text === '::' || current_token.text === '?.') {
// no spaces around exotic namespacing syntax operator
print_token();
return;
@@ -2250,7 +2250,7 @@ function Tokenizer(input_string, opts) {
var digit_oct = /[01234567]/;
var digit_hex = /[0123456789abcdefABCDEF]/;
this.positionable_operators = '!= !== % & && * ** + - / : < << <= == === > >= >> >>> ? ^ | ||'.split(' ');
this.positionable_operators = '!= !== % & && &&= * ** + - / : < << <= == === > >= >> >>> ? ?? ??= ^ | |> || ||='.split(' ');
var punct = this.positionable_operators.concat(
// non-positionable operators - these do not follow operator position settings
'! %= &= *= **= ++ += , -- -= /= :: <<= = => >>= >>>= ^= |= ~ ...'.split(' '));
@@ -2457,6 +2457,13 @@ function Tokenizer(input_string, opts) {
return [c, 'TK_WORD'];
}
if (c === '?') {
if (input.peek() === '.' && !input.peek(1).match(/\d/)) {
c += input.next();
return [c, 'TK_OPERATOR'];
}
}
if (c === '(' || c === '[') {
return [c, 'TK_START_EXPR'];
}

View File

@@ -1,5 +1,5 @@
#Thu May 22 15:43:17 CST 2025
BUILD_TIME=1747899797441
#Thu May 22 17:14:04 CST 2025
BUILD_TIME=1747905244827
COMPILE_SDK_VERSION=35
IMAGE_QUANT_CMAKE_VERSION=3.22.1
IMAGE_QUANT_NDK_VERSION=26.1.10909125