@thigasdevelopment/luam 0.6.0 → 0.7.0

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/luam.mjs +11 -11
  2. package/package.json +1 -1
package/luam.mjs CHANGED
@@ -4328,7 +4328,7 @@ function parseClassMethod(stream, token, decorators) {
4328
4328
  position: token.position
4329
4329
  };
4330
4330
  }
4331
- function parseLegacyClassMethod(stream, token, decorators) {
4331
+ function parseBraceClassMethod(stream, token, decorators) {
4332
4332
  const parameters = parseParameters(stream);
4333
4333
  const returnAnnotation = parseOptionalAnnotation(stream);
4334
4334
  const body = parseBraceBlock(stream);
@@ -4359,7 +4359,8 @@ function parseClassMember(stream) {
4359
4359
  const decorators = parseDecorators(stream);
4360
4360
  const token = stream.expectName();
4361
4361
  if (stream.check("punctuation", "(")) {
4362
- return parseLegacyClassMethod(stream, token, decorators);
4362
+ stream.report("parse-class-method-form", `Write class member "${token.value}" as "${token.value} = function (...) ... end".`, token.position);
4363
+ return parseBraceClassMethod(stream, token, decorators);
4363
4364
  }
4364
4365
  if (stream.check("operator", "=") && stream.checkAhead(1, "keyword", "function")) {
4365
4366
  return parseClassMethod(stream, token, decorators);
@@ -5943,7 +5944,7 @@ import { tmpdir } from "node:os";
5943
5944
  import { join as join2 } from "node:path";
5944
5945
 
5945
5946
  // src/cli/version.ts
5946
- var VERSION = true ? "0.6.0" : "0.0.0-dev";
5947
+ var VERSION = true ? "0.7.0" : "0.0.0-dev";
5947
5948
  var PROGRAM_NAME = "luam";
5948
5949
  var PROGRAM_DESCRIPTION = "luam \u2014 the Luam compiler for Multi Theft Auto resources.";
5949
5950
 
@@ -13187,9 +13188,9 @@ function containsJump(body, kind) {
13187
13188
  return inClause || statement.alternate !== null && containsJump(statement.alternate, kind);
13188
13189
  });
13189
13190
  }
13190
- function emitNested(state, body, wrapped2) {
13191
+ function emitNested(state, body, wrapped) {
13191
13192
  const previous = state.loopWrap;
13192
- state.loopWrap = wrapped2;
13193
+ state.loopWrap = wrapped;
13193
13194
  try {
13194
13195
  return emitBlock(state, body);
13195
13196
  } finally {
@@ -13858,10 +13859,9 @@ function collectBundles(helpers, scripts, pinned) {
13858
13859
  return members.length === 0 ? [] : [{ path: bundlePath(environment), environment, members }];
13859
13860
  });
13860
13861
  }
13861
- function wrapped(content) {
13862
- return `do
13863
- ${content}${content.length > 0 && !content.endsWith("\n") ? "\n" : ""}end
13864
- `;
13862
+ function terminated(content) {
13863
+ return content.length > 0 && !content.endsWith("\n") ? `${content}
13864
+ ` : content;
13865
13865
  }
13866
13866
  function newlineCount(value) {
13867
13867
  return value.match(/\n/g)?.length ?? 0;
@@ -13875,9 +13875,9 @@ function materializeBundle(bundle, resolveHelper) {
13875
13875
  let generatedStartLine = 1;
13876
13876
  for (const member of bundle.members) {
13877
13877
  const content = member.kind === "helper" ? resolveHelper(member.helper) : member.module.content;
13878
- const block = wrapped(content);
13878
+ const block = terminated(content);
13879
13879
  const generatedEndLine = generatedStartLine + newlineCount(block) - 1;
13880
- const contentStartLine = generatedStartLine + 1;
13880
+ const contentStartLine = generatedStartLine;
13881
13881
  const contentEndLine = contentStartLine + contentLineCount(content) - 1;
13882
13882
  const source = member.kind === "helper" ? member.helper.file : member.module.source;
13883
13883
  const lines = member.kind === "helper" ? [] : member.module.lines ?? [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thigasdevelopment/luam",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "The Luam compiler for Multi Theft Auto resources.",
5
5
  "keywords": [
6
6
  "mta",