GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: replace the top-level context only · kunjun/lowcode-engine@37e07bb

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • modules/code-generator/src/utils
    • expressionParser.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎modules/code-generator/src/utils/expressionParser.ts‎

Copy file name to clipboardExpand all lines: modules/code-generator/src/utils/expressionParser.ts
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ export function parseExpressionConvertThis2Context(
271271

272272
const localVariablesSet = new Set(localVariables);
273273

274-
let thisScopeLevel = CROSS_THIS_SCOPE_TYPE_NODE[exprAst.type] ? -1 : 0;
274+
let thisScopeLevel = -1;
275275
traverse(fileAst, {
276276
enter(path) {
277277
if (CROSS_THIS_SCOPE_TYPE_NODE[path.node.type]) {
@@ -303,7 +303,7 @@ export function parseExpressionConvertThis2Context(
303303
}
304304

305305
// 替换 this (只在顶层替换)
306-
if (thisScopeLevel <= 0) {
306+
if (thisScopeLevel === 0) {
307307
obj.replaceWith(t.identifier(contextName));
308308
}
309309
},
@@ -317,7 +317,7 @@ export function parseExpressionConvertThis2Context(
317317
return;
318318
}
319319

320-
if (thisScopeLevel <= 0) {
320+
if (thisScopeLevel === 0) {
321321
path.replaceWith(t.identifier(contextName));
322322
}
323323
},

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.