Skip to content

Commit

Permalink
整理代码
Browse files Browse the repository at this point in the history
  • Loading branch information
sumneko committed Jan 23, 2025
1 parent 02d40ee commit 9e033ea
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/ecaCompiler/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ export class Trigger {
conditions: Exp[] = [];
actions: Action[] = [];
variables: Variable[] = [];
constructor(public eca: ECA, private json: any, isClosure = false) {
constructor(public eca: ECA, private json: any, public isClosure = false) {
this.name = json.trigger_name as string;
this.groupID = json.group_id as number;
if (isClosure) {
Expand Down
12 changes: 1 addition & 11 deletions src/ecaCompiler/formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ export class Formatter {
result += this.makeGroupVariablePart(trg);
}

if (trg.variables.length > 0 && this.usingLocalVariable(trg)) {
if (trg.variables.length > 0) {
result += this.makeLocalVariablePart(trg);
}

Expand All @@ -358,16 +358,6 @@ export class Formatter {
return result;
}

private usingLocalVariable(trg: Trigger | Function): boolean {
return trg.eachNode(node => {
if (node instanceof VarRef && node.scope === 'local') {
return true;
} else {
return false;
}
});
}

private usingGroupVariable(trg: Trigger | Function): boolean {
return trg.eachNode(node => {
if (node instanceof VarRef && node.scope === 'actor') {
Expand Down

0 comments on commit 9e033ea

Please sign in to comment.