Skip to content

Commit

Permalink
全局变量改名叫 G
Browse files Browse the repository at this point in the history
  • Loading branch information
sumneko committed Jan 23, 2025
1 parent c6051b5 commit 02d40ee
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ecaCompiler/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export class VarRef extends Node {
case 'local':
return 'v.' + y3.lua.getValidName(this.name, reservedNames);
case 'global':
return 'V.' + y3.lua.getValidName(this.name, reservedNames);
return 'G.' + y3.lua.getValidName(this.name, reservedNames);
case 'actor':
return 'g.' + y3.lua.getValidName(this.name, reservedNames);
}
Expand Down Expand Up @@ -454,9 +454,9 @@ export class GlobalVariables {

make(formatter: Formatter) {
let buffer: string[] = [];
buffer.push('V = {}\n\n');
buffer.push('G = {}\n\n');
for (const variable of this.variables.values()) {
buffer.push(`V.${y3.lua.getValidName(variable.name)} = ${formatter.getVariableInitValue(variable)}`);
buffer.push(`G.${y3.lua.getValidName(variable.name)} = ${formatter.getVariableInitValue(variable)}`);
buffer.push('\n');
}
let content = buffer.join('');
Expand Down

0 comments on commit 02d40ee

Please sign in to comment.