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); }