From 4dfdd918ca12e58fd55dfa679b7719a6299cd83f Mon Sep 17 00:00:00 2001 From: mxd <838425805@qq.com> Date: Fri, 17 Dec 2021 23:00:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E7=A4=BA=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/console/src/scripts/editor/completion.js | 6 +++--- .../src/console/src/scripts/parsing/parser.js | 11 +++-------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/magic-editor/src/console/src/scripts/editor/completion.js b/magic-editor/src/console/src/scripts/editor/completion.js index 07413649..abfddb87 100644 --- a/magic-editor/src/console/src/scripts/editor/completion.js +++ b/magic-editor/src/console/src/scripts/editor/completion.js @@ -299,9 +299,9 @@ const quickSuggestions = [ ['ife', 'if (${1:condition}) {\r\n\t$2\r\n} else { \r\n\t$3\r\n}', '判断'], ['for', 'for (item in ${1:collection}) {\r\n\t$2\r\n}', '循环集合'], ['exit', 'exit ${1:code}, ${2:message};', '退出'], - ['info', 'log.info($1);', 'info日志'], - ['debug', 'log.debug($1);', 'debug日志'], - ['err', 'log.error($1);', 'error日志'], + ['logi', 'log.info($1);', 'info日志'], + ['logd', 'log.debug($1);', 'debug日志'], + ['loge', 'log.error($1);', 'error日志'], ['ass', 'assert ${1:condition} : ${2:code}, ${3:message}', '校验参数'] ] diff --git a/magic-editor/src/console/src/scripts/parsing/parser.js b/magic-editor/src/console/src/scripts/parsing/parser.js index 804fef3d..96468709 100644 --- a/magic-editor/src/console/src/scripts/parsing/parser.js +++ b/magic-editor/src/console/src/scripts/parsing/parser.js @@ -589,14 +589,9 @@ export class Parser { } if (this.stream.match(TokenType.StringLiteral, false)) { key = this.stream.expect(TokenType.StringLiteral); - } else if (this.stream.match(TokenType.LeftBracket, false)) { // [key] - let opening = this.stream.expect(TokenType.LeftBracket).getSpan(); - this.stream.expect(TokenType.Identifier); - let closing = this.stream.expect(TokenType.RightBracket).getSpan(); - let span = new Span(opening, closing); - let dynamicKey = span.getText(); - dynamicKey = dynamicKey.substring(1, dynamicKey.length - 1); - key = new VariableAccess(span, dynamicKey); + } else if (this.stream.match(TokenType.LeftBracket, true)) { // [key] + key = this.parseExpression() + this.stream.expect(TokenType.RightBracket); } else { key = this.stream.expect(TokenType.Identifier); }