Skip to content

Commit 913c82e

Browse files
committed
cleanup
1 parent b6121a1 commit 913c82e

File tree

11 files changed

+39
-49
lines changed

11 files changed

+39
-49
lines changed

src/main/java/org/perlonjava/codegen/EmitterVisitor.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -317,12 +317,12 @@ private void handleUnaryBuiltin(OperatorNode node, String operator) {
317317
false);
318318
} else if ((operator.equals("stat") || operator.equals("lstat"))
319319
&& (node.operand instanceof IdentifierNode && ((IdentifierNode) node.operand).name.equals("_"))) {
320-
// `stat _`
321-
ctx.mv.visitMethodInsn(
322-
Opcodes.INVOKESTATIC,
323-
"org/perlonjava/operators/Stat",
324-
operator + "LastHandle",
325-
"()Lorg/perlonjava/runtime/RuntimeList;", false);
320+
// `stat _`
321+
ctx.mv.visitMethodInsn(
322+
Opcodes.INVOKESTATIC,
323+
"org/perlonjava/operators/Stat",
324+
operator + "LastHandle",
325+
"()Lorg/perlonjava/runtime/RuntimeList;", false);
326326
} else {
327327
node.operand.accept(this.with(RuntimeContextType.SCALAR));
328328
if (operatorHandler != null) {

src/main/java/org/perlonjava/codegen/JavaClassInfo.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.perlonjava.codegen;
22

33
import org.objectweb.asm.Label;
4-
import org.perlonjava.runtime.RuntimeContextType;
54

65
import java.util.ArrayDeque;
76
import java.util.Deque;

src/main/java/org/perlonjava/codegen/LoopLabels.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.perlonjava.codegen;
22

33
import org.objectweb.asm.Label;
4-
import org.perlonjava.runtime.RuntimeContextType;
54

65
public class LoopLabels {
76
public String labelName;

src/main/java/org/perlonjava/operators/FileTestOperator.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import java.nio.file.Files;
88
import java.nio.file.LinkOption;
99
import java.nio.file.Path;
10-
import java.nio.file.Paths;
1110
import java.nio.file.attribute.FileTime;
1211
import java.nio.file.attribute.PosixFilePermission;
1312

src/main/java/org/perlonjava/operators/Stat.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import java.nio.file.Files;
88
import java.nio.file.LinkOption;
99
import java.nio.file.Path;
10-
import java.nio.file.Paths;
1110
import java.nio.file.attribute.BasicFileAttributes;
1211
import java.nio.file.attribute.PosixFileAttributes;
1312
import java.nio.file.attribute.PosixFilePermission;

src/main/java/org/perlonjava/parser/OperatorParser.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,9 +483,9 @@ public static Node parseCoreOperator(Parser parser, LexerToken token, int startI
483483
parser.parsingTakeReference = true; // don't call `&subr` while parsing "Take reference"
484484
operand = ListParser.parseZeroOrOneList(parser, 0);
485485
parser.parsingTakeReference = false;
486-
if (((ListNode)operand).elements.isEmpty()) {
486+
if (((ListNode) operand).elements.isEmpty()) {
487487
// `defined` without arguments means `defined $_`
488-
((ListNode)operand).elements.add(
488+
((ListNode) operand).elements.add(
489489
new OperatorNode(
490490
"$",
491491
new IdentifierNode("_", parser.tokenIndex),

src/main/java/org/perlonjava/parser/StatementParser.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
import org.perlonjava.perlmodule.Universal;
99
import org.perlonjava.runtime.*;
1010

11-
import java.util.List;
12-
1311
import static org.perlonjava.parser.NumberParser.parseNumber;
1412
import static org.perlonjava.parser.SpecialBlockParser.runSpecialBlock;
1513
import static org.perlonjava.parser.SpecialBlockParser.setCurrentScope;

src/main/java/org/perlonjava/parser/SubroutineParser.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ static Node parseSubroutineCall(Parser parser) {
6868
if (TokenUtils.peek(parser).text.equals("->")) {
6969
// method call without parentheses
7070
arguments = new ListNode(parser.tokenIndex);
71-
}
72-
else if (prototype == null) {
71+
} else if (prototype == null) {
7372
// no prototype
7473
arguments = ListParser.parseZeroOrMoreList(parser, 0, false, true, false, false);
7574
} else if (prototype.isEmpty()) {

src/main/java/org/perlonjava/perlmodule/Exporter.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
import org.perlonjava.runtime.*;
44

5-
import java.lang.reflect.Method;
6-
75
/**
86
* The Exporter class is responsible for managing the export of symbols from one Perl package to another.
97
* It mimics the behavior of Perl's Exporter module, allowing symbols to be imported into other namespaces.

src/main/java/org/perlonjava/perlmodule/FileSpec.java

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package org.perlonjava.perlmodule;
22

3-
import org.perlonjava.runtime.*;
3+
import org.perlonjava.runtime.RuntimeArray;
4+
import org.perlonjava.runtime.RuntimeList;
5+
import org.perlonjava.runtime.RuntimeScalar;
46

57
import java.io.File;
68
import java.nio.file.Paths;
@@ -64,7 +66,7 @@ public static void initialize() {
6466
* Converts a path to a canonical form, removing redundant separators and up-level references.
6567
*
6668
* @param args The arguments passed from the Perl environment, where args[1] is the path.
67-
* @param ctx The context in which the method is called.
69+
* @param ctx The context in which the method is called.
6870
* @return A {@link RuntimeList} containing the canonical path.
6971
*/
7072
public static RuntimeList canonpath(RuntimeArray args, int ctx) {
@@ -80,7 +82,7 @@ public static RuntimeList canonpath(RuntimeArray args, int ctx) {
8082
* Concatenates multiple directory names into a single path.
8183
*
8284
* @param args The arguments passed from the Perl environment, representing directory names.
83-
* @param ctx The context in which the method is called.
85+
* @param ctx The context in which the method is called.
8486
* @return A {@link RuntimeList} containing the concatenated directory path.
8587
*/
8688
public static RuntimeList catdir(RuntimeArray args, int ctx) {
@@ -97,7 +99,7 @@ public static RuntimeList catdir(RuntimeArray args, int ctx) {
9799
* This method is an alias for {@link #catdir(RuntimeArray, int)}.
98100
*
99101
* @param args The arguments passed from the Perl environment, representing file names.
100-
* @param ctx The context in which the method is called.
102+
* @param ctx The context in which the method is called.
101103
* @return A {@link RuntimeList} containing the concatenated file path.
102104
*/
103105
public static RuntimeList catfile(RuntimeArray args, int ctx) {
@@ -108,7 +110,7 @@ public static RuntimeList catfile(RuntimeArray args, int ctx) {
108110
* Returns the current directory symbol.
109111
*
110112
* @param args The arguments passed from the Perl environment.
111-
* @param ctx The context in which the method is called.
113+
* @param ctx The context in which the method is called.
112114
* @return A {@link RuntimeList} containing the current directory symbol.
113115
*/
114116
public static RuntimeList curdir(RuntimeArray args, int ctx) {
@@ -119,7 +121,7 @@ public static RuntimeList curdir(RuntimeArray args, int ctx) {
119121
* Returns the null device for the current operating system.
120122
*
121123
* @param args The arguments passed from the Perl environment.
122-
* @param ctx The context in which the method is called.
124+
* @param ctx The context in which the method is called.
123125
* @return A {@link RuntimeList} containing the null device path.
124126
*/
125127
public static RuntimeList devnull(RuntimeArray args, int ctx) {
@@ -131,7 +133,7 @@ public static RuntimeList devnull(RuntimeArray args, int ctx) {
131133
* Returns the root directory for the current operating system.
132134
*
133135
* @param args The arguments passed from the Perl environment.
134-
* @param ctx The context in which the method is called.
136+
* @param ctx The context in which the method is called.
135137
* @return A {@link RuntimeList} containing the root directory path.
136138
*/
137139
public static RuntimeList rootdir(RuntimeArray args, int ctx) {
@@ -143,7 +145,7 @@ public static RuntimeList rootdir(RuntimeArray args, int ctx) {
143145
* Returns the temporary directory path for the current operating system.
144146
*
145147
* @param args The arguments passed from the Perl environment.
146-
* @param ctx The context in which the method is called.
148+
* @param ctx The context in which the method is called.
147149
* @return A {@link RuntimeList} containing the temporary directory path.
148150
*/
149151
public static RuntimeList tmpdir(RuntimeArray args, int ctx) {
@@ -158,7 +160,7 @@ public static RuntimeList tmpdir(RuntimeArray args, int ctx) {
158160
* Returns the parent directory symbol.
159161
*
160162
* @param args The arguments passed from the Perl environment.
161-
* @param ctx The context in which the method is called.
163+
* @param ctx The context in which the method is called.
162164
* @return A {@link RuntimeList} containing the parent directory symbol.
163165
*/
164166
public static RuntimeList updir(RuntimeArray args, int ctx) {
@@ -169,7 +171,7 @@ public static RuntimeList updir(RuntimeArray args, int ctx) {
169171
* Filters out the current and parent directory symbols from a list of directory names.
170172
*
171173
* @param args The arguments passed from the Perl environment, representing directory names.
172-
* @param ctx The context in which the method is called.
174+
* @param ctx The context in which the method is called.
173175
* @return A {@link RuntimeList} containing the filtered directory names.
174176
*/
175177
public static RuntimeList no_upwards(RuntimeArray args, int ctx) {
@@ -187,7 +189,7 @@ public static RuntimeList no_upwards(RuntimeArray args, int ctx) {
187189
* Determines if the current file system is case-tolerant.
188190
*
189191
* @param args The arguments passed from the Perl environment.
190-
* @param ctx The context in which the method is called.
192+
* @param ctx The context in which the method is called.
191193
* @return A {@link RuntimeList} containing a boolean indicating case tolerance.
192194
*/
193195
public static RuntimeList case_tolerant(RuntimeArray args, int ctx) {
@@ -199,7 +201,7 @@ public static RuntimeList case_tolerant(RuntimeArray args, int ctx) {
199201
* Checks if a given file name is an absolute path.
200202
*
201203
* @param args The arguments passed from the Perl environment, where args[1] is the file name.
202-
* @param ctx The context in which the method is called.
204+
* @param ctx The context in which the method is called.
203205
* @return A {@link RuntimeList} containing a boolean indicating if the path is absolute.
204206
*/
205207
public static RuntimeList file_name_is_absolute(RuntimeArray args, int ctx) {
@@ -215,7 +217,7 @@ public static RuntimeList file_name_is_absolute(RuntimeArray args, int ctx) {
215217
* Retrieves the system's PATH environment variable as a list of directories.
216218
*
217219
* @param args The arguments passed from the Perl environment.
218-
* @param ctx The context in which the method is called.
220+
* @param ctx The context in which the method is called.
219221
* @return A {@link RuntimeList} containing the directories in the PATH.
220222
*/
221223
public static RuntimeList path(RuntimeArray args, int ctx) {
@@ -233,7 +235,7 @@ public static RuntimeList path(RuntimeArray args, int ctx) {
233235
* This method is an alias for {@link #catfile(RuntimeArray, int)}.
234236
*
235237
* @param args The arguments passed from the Perl environment, representing path components.
236-
* @param ctx The context in which the method is called.
238+
* @param ctx The context in which the method is called.
237239
* @return A {@link RuntimeList} containing the joined path.
238240
*/
239241
public static RuntimeList join(RuntimeArray args, int ctx) {
@@ -244,7 +246,7 @@ public static RuntimeList join(RuntimeArray args, int ctx) {
244246
* Splits a path into volume, directory, and file components.
245247
*
246248
* @param args The arguments passed from the Perl environment, where args[1] is the path and args[2] is optional.
247-
* @param ctx The context in which the method is called.
249+
* @param ctx The context in which the method is called.
248250
* @return A {@link RuntimeList} containing the volume, directory, and file components.
249251
*/
250252
public static RuntimeList splitpath(RuntimeArray args, int ctx) {
@@ -281,7 +283,7 @@ public static RuntimeList splitpath(RuntimeArray args, int ctx) {
281283
* Splits a directory path into its individual components.
282284
*
283285
* @param args The arguments passed from the Perl environment, where args[1] is the directory path.
284-
* @param ctx The context in which the method is called.
286+
* @param ctx The context in which the method is called.
285287
* @return A {@link RuntimeList} containing the directory components.
286288
*/
287289
public static RuntimeList splitdir(RuntimeArray args, int ctx) {
@@ -301,7 +303,7 @@ public static RuntimeList splitdir(RuntimeArray args, int ctx) {
301303
* Constructs a complete path from volume, directory, and file components.
302304
*
303305
* @param args The arguments passed from the Perl environment, where args[1] is the volume, args[2] is the directory, and args[3] is the file.
304-
* @param ctx The context in which the method is called.
306+
* @param ctx The context in which the method is called.
305307
* @return A {@link RuntimeList} containing the constructed path.
306308
*/
307309
public static RuntimeList catpath(RuntimeArray args, int ctx) {
@@ -319,7 +321,7 @@ public static RuntimeList catpath(RuntimeArray args, int ctx) {
319321
* Converts an absolute path to a relative path based on a given base path.
320322
*
321323
* @param args The arguments passed from the Perl environment, where args[1] is the absolute path and args[2] is optional base path.
322-
* @param ctx The context in which the method is called.
324+
* @param ctx The context in which the method is called.
323325
* @return A {@link RuntimeList} containing the relative path.
324326
*/
325327
public static RuntimeList abs2rel(RuntimeArray args, int ctx) {
@@ -336,7 +338,7 @@ public static RuntimeList abs2rel(RuntimeArray args, int ctx) {
336338
* Converts a relative path to an absolute path based on a given base path.
337339
*
338340
* @param args The arguments passed from the Perl environment, where args[1] is the relative path and args[2] is optional base path.
339-
* @param ctx The context in which the method is called.
341+
* @param ctx The context in which the method is called.
340342
* @return A {@link RuntimeList} containing the absolute path.
341343
*/
342344
public static RuntimeList rel2abs(RuntimeArray args, int ctx) {

0 commit comments

Comments
 (0)