overpy 9.7.6 → 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 +18 -7
  2. package/package.json +1 -1
package/overpy.js CHANGED
@@ -48675,7 +48675,9 @@ OverPyCompiler.prototype.parse = function(content, kwargs = {}) {
48675
48675
  return this.Ast("$" + name);
48676
48676
  }
48677
48677
  if (name in this.astConstants) {
48678
- return this.astConstants[name].value.clone();
48678
+ let result2 = this.astConstants[name].value.clone();
48679
+ result2.fileStack = this.getFileStackRange(content);
48680
+ return result2;
48679
48681
  }
48680
48682
  if (isNumber(name)) {
48681
48683
  if (name.startsWith("0x")) {
@@ -48927,7 +48929,9 @@ OverPyCompiler.prototype.parseMember = function(object, member) {
48927
48929
  object[0].text = "StartRuleBehavior";
48928
48930
  }
48929
48931
  if (object[0].text in this.enumMembers && name in this.enumMembers[object[0].text]) {
48930
- 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;
48931
48935
  }
48932
48936
  if (object[0].text === "Hero" && name === "MCCREE") {
48933
48937
  name = "CASSIDY";
@@ -50280,6 +50284,7 @@ OverPyDecompiler.prototype.getName = function(content) {
50280
50284
  };
50281
50285
 
50282
50286
  // src/utils/file.ts
50287
+ var fileContentOverlay = /* @__PURE__ */ new Map();
50283
50288
  OverPyCompiler.prototype.getFilenameFromPath = function(filename) {
50284
50289
  try {
50285
50290
  var path = require("path");
@@ -50320,15 +50325,20 @@ OverPyCompiler.prototype.getFilePaths = function(pathStr, basePath) {
50320
50325
  return matchingFiles;
50321
50326
  };
50322
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
+ }
50323
50337
  try {
50324
50338
  var fs = require("fs");
50325
50339
  } catch (e) {
50326
50340
  this.error("Cannot import files in browsers (fs not found)");
50327
50341
  }
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
50342
  try {
50333
50343
  this.importedFiles.push(path);
50334
50344
  return fs.readFileSync(path) + "\n";
@@ -69534,7 +69544,8 @@ OverPyCompiler.prototype.parseAstRules = function(rules) {
69534
69544
  } else if (rule.name === "pass") {
69535
69545
  continue;
69536
69546
  } else {
69537
- 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);
69538
69549
  }
69539
69550
  this.currentRuleName = rule.ruleAttributes.name;
69540
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.6",
10
+ "version": "9.7.7",
11
11
  "readme": "README.md",
12
12
  "keywords": [
13
13
  "overpy",