Skip to content

Commit a819459

Browse files
committed
Fixed some minor issues
1 parent a5c4348 commit a819459

File tree

5 files changed

+4
-25
lines changed

5 files changed

+4
-25
lines changed

src/CommandLineParser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const optionDeclarations: { [key: string]: yargs.Options } = {
2121
luaLibImport: {
2222
choices: ["inline", "require", "none"],
2323
default: "inline",
24-
describe: "Specify Lua target version.",
24+
describe: "Specifies how js standard features missing in lua are imported.",
2525
type: "string",
2626
},
2727
luaTarget: {

src/Compiler.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ export function compileFilesWithOptions(fileNames: string[], options: CompilerOp
5151
try {
5252
const rootDir = options.rootDir;
5353

54-
// console.log(`Transpiling ${sourceFile.fileName}...`);
55-
5654
// Transpile AST
5755
const lua = createTranspiler(checker, options, sourceFile).transpileSourceFile();
5856

src/Index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env node
22

3-
import {compile} from "./Compiler";
3+
import { compile } from "./Compiler";
44

55
compile(process.argv.slice(2));

src/lualib/ArraySplice.ts

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
1-
// https://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
21
function __TS__ArraySplice<T>(list: T[], start: number, deleteCount: number, ...items: T[]): T[] {
3-
// 1. 2.
2+
43
const len = list.length;
54

65
let actualStart;
76

8-
// 4.
97
if (start < 0) {
108
actualStart = Math.max(len + start, 0);
119
} else {
1210
actualStart = Math.min(start, len);
1311
}
1412

15-
// 13.
16-
// 14.
1713
const itemCount = items.length;
1814

19-
// 5. - 7.
2015
let actualDeleteCount: number;
2116

2217
if (!start) {
@@ -27,13 +22,8 @@ function __TS__ArraySplice<T>(list: T[], start: number, deleteCount: number, ...
2722
actualDeleteCount = Math.min(Math.max(deleteCount, 0), len - actualStart);
2823
}
2924

30-
// 8. ignored
31-
32-
// 9.
3325
const out: T[] = [];
3426

35-
// 10.
36-
// 11.
3727
for (let k = 0; k < actualDeleteCount; k++) {
3828
const from = actualStart + k;
3929

@@ -42,9 +32,7 @@ function __TS__ArraySplice<T>(list: T[], start: number, deleteCount: number, ...
4232
}
4333
}
4434

45-
// 15.
4635
if (itemCount < actualDeleteCount) {
47-
// a. b.
4836
for (let k = actualStart; k < len - actualDeleteCount; k++) {
4937
const from = k + actualDeleteCount;
5038
const to = k + itemCount;
@@ -55,11 +43,9 @@ function __TS__ArraySplice<T>(list: T[], start: number, deleteCount: number, ...
5543
list[to] = undefined;
5644
}
5745
}
58-
// c. d.
5946
for (let k = len; k > len - actualDeleteCount + itemCount; k--) {
6047
list[k - 1] = undefined;
6148
}
62-
// 16.
6349
} else if (itemCount > actualDeleteCount) {
6450

6551
for (let k = len - actualDeleteCount; k > actualStart; k--) {
@@ -71,23 +57,18 @@ function __TS__ArraySplice<T>(list: T[], start: number, deleteCount: number, ...
7157
} else {
7258
list[to] = undefined;
7359
}
74-
7560
}
7661
}
7762

78-
// 17.
79-
// 18.
8063
let j = actualStart;
8164
for (const e of items) {
8265
list[j] = e;
8366
j++;
8467
}
8568

86-
// 19.
8769
for (let k = list.length - 1; k >= len - actualDeleteCount + itemCount; k--) {
8870
list[k] = undefined;
8971
}
9072

91-
// 20.
9273
return out;
9374
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Expect, Test, TestCase } from "alsatian";
2-
import * as util from "../src/util";
2+
import * as util from "../../src/util";
33

44
export class LuaLibArrayTests {
55

0 commit comments

Comments
 (0)