overpy 9.7.5 → 9.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/overpy.js +20 -8
  2. package/package.json +1 -1
package/overpy.js CHANGED
@@ -3613,7 +3613,8 @@ var mapKw = (
3613
3613
  "skirmish",
3614
3614
  "hybrid"
3615
3615
  ],
3616
- "en-US": "Neon Junction"
3616
+ "en-US": "Neon Junction",
3617
+ "zh-CN": "\u9713\u8679\u67A2\u7EBD"
3617
3618
  },
3618
3619
  "nepal": {
3619
3620
  "guid": "00000000138A",
@@ -48674,7 +48675,9 @@ OverPyCompiler.prototype.parse = function(content, kwargs = {}) {
48674
48675
  return this.Ast("$" + name);
48675
48676
  }
48676
48677
  if (name in this.astConstants) {
48677
- return this.astConstants[name].value.clone();
48678
+ let result2 = this.astConstants[name].value.clone();
48679
+ result2.fileStack = this.getFileStackRange(content);
48680
+ return result2;
48678
48681
  }
48679
48682
  if (isNumber(name)) {
48680
48683
  if (name.startsWith("0x")) {
@@ -48926,7 +48929,9 @@ OverPyCompiler.prototype.parseMember = function(object, member) {
48926
48929
  object[0].text = "StartRuleBehavior";
48927
48930
  }
48928
48931
  if (object[0].text in this.enumMembers && name in this.enumMembers[object[0].text]) {
48929
- return this.enumMembers[object[0].text][name].clone();
48932
+ let result2 = this.enumMembers[object[0].text][name].clone();
48933
+ result2.fileStack = this.getFileStackRange(object.concat(...member));
48934
+ return result2;
48930
48935
  }
48931
48936
  if (object[0].text === "Hero" && name === "MCCREE") {
48932
48937
  name = "CASSIDY";
@@ -50279,6 +50284,7 @@ OverPyDecompiler.prototype.getName = function(content) {
50279
50284
  };
50280
50285
 
50281
50286
  // src/utils/file.ts
50287
+ var fileContentOverlay = /* @__PURE__ */ new Map();
50282
50288
  OverPyCompiler.prototype.getFilenameFromPath = function(filename) {
50283
50289
  try {
50284
50290
  var path = require("path");
@@ -50319,15 +50325,20 @@ OverPyCompiler.prototype.getFilePaths = function(pathStr, basePath) {
50319
50325
  return matchingFiles;
50320
50326
  };
50321
50327
  OverPyCompiler.prototype.getFileContent = function(path) {
50328
+ if (path.endsWith(".opy") && this.importedFiles.includes(path)) {
50329
+ this.warn("w_already_imported", "The file '" + path + "' was already imported and will not be imported again.");
50330
+ return "";
50331
+ }
50332
+ const overlayContent = fileContentOverlay.get(path);
50333
+ if (overlayContent !== void 0) {
50334
+ this.importedFiles.push(path);
50335
+ return overlayContent + "\n";
50336
+ }
50322
50337
  try {
50323
50338
  var fs = require("fs");
50324
50339
  } catch (e) {
50325
50340
  this.error("Cannot import files in browsers (fs not found)");
50326
50341
  }
50327
- if (path.endsWith(".opy") && this.importedFiles.includes(path)) {
50328
- this.warn("w_already_imported", "The file '" + path + "' was already imported and will not be imported again.");
50329
- return "";
50330
- }
50331
50342
  try {
50332
50343
  this.importedFiles.push(path);
50333
50344
  return fs.readFileSync(path) + "\n";
@@ -69533,7 +69544,8 @@ OverPyCompiler.prototype.parseAstRules = function(rules) {
69533
69544
  } else if (rule.name === "pass") {
69534
69545
  continue;
69535
69546
  } else {
69536
- this.error("Unexpected function '" + rule.name + "' outside a rule");
69547
+ const usageFrame = rule.fileStack.find((frame) => frame.staticMember);
69548
+ this.error("Unexpected function '" + rule.name + "' outside a rule", usageFrame ? [usageFrame] : rule.fileStack);
69537
69549
  }
69538
69550
  this.currentRuleName = rule.ruleAttributes.name;
69539
69551
  this.currentRuleEvent = rule.ruleAttributes.event;
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "url": "https://github.com/Zezombye/overpy"
8
8
  },
9
9
  "description": "High-level language for the Overwatch Workshop, with decompilation and compilation.",
10
- "version": "9.7.5",
10
+ "version": "9.7.7",
11
11
  "readme": "README.md",
12
12
  "keywords": [
13
13
  "overpy",