Rename InstructionLocation to TextLocation. Replace NodeLocation by TextLocation

This commit is contained in:
Alexey Andreev 2016-08-20 13:45:27 +03:00
parent 3dd76c9355
commit 1be9ffb19e
56 changed files with 192 additions and 259 deletions

View File

@ -17,15 +17,12 @@ package org.teavm.ast;
import java.util.HashSet;
import java.util.Set;
import org.teavm.model.TextLocation;
/**
*
* @author Alexey Andreev
*/
public class AssignmentStatement extends Statement {
private Expr leftValue;
private Expr rightValue;
private NodeLocation location;
private TextLocation location;
private Set<String> debugNames = new HashSet<>();
private boolean async;
@ -45,11 +42,11 @@ public class AssignmentStatement extends Statement {
this.rightValue = rightValue;
}
public NodeLocation getLocation() {
public TextLocation getLocation() {
return location;
}
public void setLocation(NodeLocation location) {
public void setLocation(TextLocation location) {
this.location = location;
}

View File

@ -15,9 +15,11 @@
*/
package org.teavm.ast;
import org.teavm.model.TextLocation;
public class BreakStatement extends Statement {
private IdentifiedStatement target;
private NodeLocation location;
private TextLocation location;
public IdentifiedStatement getTarget() {
return target;
@ -27,11 +29,11 @@ public class BreakStatement extends Statement {
this.target = target;
}
public NodeLocation getLocation() {
public TextLocation getLocation() {
return location;
}
public void setLocation(NodeLocation location) {
public void setLocation(TextLocation location) {
this.location = location;
}

View File

@ -15,13 +15,11 @@
*/
package org.teavm.ast;
/**
*
* @author Alexey Andreev
*/
import org.teavm.model.TextLocation;
public class ContinueStatement extends Statement {
private IdentifiedStatement target;
private NodeLocation location;
private TextLocation location;
public IdentifiedStatement getTarget() {
return target;
@ -31,11 +29,11 @@ public class ContinueStatement extends Statement {
this.target = target;
}
public NodeLocation getLocation() {
public TextLocation getLocation() {
return location;
}
public void setLocation(NodeLocation location) {
public void setLocation(TextLocation location) {
this.location = location;
}

View File

@ -21,7 +21,7 @@ import java.util.Map;
import org.teavm.model.*;
public abstract class Expr implements Cloneable {
private NodeLocation location;
private TextLocation location;
public abstract void acceptVisitor(ExprVisitor visitor);
@ -53,7 +53,7 @@ public abstract class Expr implements Cloneable {
return expr;
}
public static Expr binary(BinaryOperation op, OperationType type, Expr first, Expr second, NodeLocation loc) {
public static Expr binary(BinaryOperation op, OperationType type, Expr first, Expr second, TextLocation loc) {
Expr expr = binary(op, type, first, second);
expr.setLocation(loc);
return expr;
@ -151,11 +151,11 @@ public abstract class Expr implements Cloneable {
return expr;
}
public NodeLocation getLocation() {
public TextLocation getLocation() {
return location;
}
public void setLocation(NodeLocation location) {
public void setLocation(TextLocation location) {
this.location = location;
}
}

View File

@ -15,12 +15,10 @@
*/
package org.teavm.ast;
/**
*
* @author Alexey Andreev
*/
import org.teavm.model.TextLocation;
public class InitClassStatement extends Statement {
private NodeLocation location;
private TextLocation location;
private String className;
public String getClassName() {
@ -31,11 +29,11 @@ public class InitClassStatement extends Statement {
this.className = className;
}
public NodeLocation getLocation() {
public TextLocation getLocation() {
return location;
}
public void setLocation(NodeLocation location) {
public void setLocation(TextLocation location) {
this.location = location;
}

View File

@ -15,12 +15,10 @@
*/
package org.teavm.ast;
/**
*
* @author shannah
*/
import org.teavm.model.TextLocation;
public class MonitorEnterStatement extends Statement {
private NodeLocation location;
private TextLocation location;
private Expr objectRef;
@Override
@ -28,11 +26,11 @@ public class MonitorEnterStatement extends Statement {
visitor.visit(this);
}
public NodeLocation getLocation() {
public TextLocation getLocation() {
return location;
}
public void setLocation(NodeLocation location) {
public void setLocation(TextLocation location) {
this.location = location;
}

View File

@ -15,12 +15,10 @@
*/
package org.teavm.ast;
/**
*
* @author shannah
*/
import org.teavm.model.TextLocation;
public class MonitorExitStatement extends Statement {
private NodeLocation location;
private TextLocation location;
private Expr objectRef;
@Override
@ -28,11 +26,11 @@ public class MonitorExitStatement extends Statement {
visitor.visit(this);
}
public NodeLocation getLocation() {
public TextLocation getLocation() {
return location;
}
public void setLocation(NodeLocation location) {
public void setLocation(TextLocation location) {
this.location = location;
}

View File

@ -1,38 +0,0 @@
/*
* Copyright 2016 Alexey Andreev.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.teavm.ast;
/**
*
* @author Alexey Andreev
*/
public class NodeLocation {
private String fileName;
private int line;
public NodeLocation(String fileName, int line) {
this.fileName = fileName;
this.line = line;
}
public String getFileName() {
return fileName;
}
public int getLine() {
return line;
}
}

View File

@ -15,13 +15,11 @@
*/
package org.teavm.ast;
/**
*
* @author Alexey Andreev
*/
import org.teavm.model.TextLocation;
public class ReturnStatement extends Statement {
private Expr result;
private NodeLocation location;
private TextLocation location;
public Expr getResult() {
return result;
@ -31,11 +29,11 @@ public class ReturnStatement extends Statement {
this.result = result;
}
public NodeLocation getLocation() {
public TextLocation getLocation() {
return location;
}
public void setLocation(NodeLocation location) {
public void setLocation(TextLocation location) {
this.location = location;
}

View File

@ -18,10 +18,6 @@ package org.teavm.ast;
import java.util.Collections;
import java.util.List;
/**
*
* @author Alexey Andreev
*/
public abstract class Statement {
public abstract void acceptVisitor(StatementVisitor visitor);

View File

@ -15,13 +15,11 @@
*/
package org.teavm.ast;
/**
*
* @author Alexey Andreev
*/
import org.teavm.model.TextLocation;
public class ThrowStatement extends Statement {
private Expr exception;
private NodeLocation location;
private TextLocation location;
public Expr getException() {
return exception;
@ -31,11 +29,11 @@ public class ThrowStatement extends Statement {
this.exception = exception;
}
public NodeLocation getLocation() {
public TextLocation getLocation() {
return location;
}
public void setLocation(NodeLocation location) {
public void setLocation(TextLocation location) {
this.location = location;
}

View File

@ -37,7 +37,6 @@ import org.teavm.ast.GotoPartStatement;
import org.teavm.ast.IdentifiedStatement;
import org.teavm.ast.MethodNode;
import org.teavm.ast.NativeMethodNode;
import org.teavm.ast.NodeLocation;
import org.teavm.ast.NodeModifier;
import org.teavm.ast.RegularMethodNode;
import org.teavm.ast.SequentialStatement;
@ -62,7 +61,7 @@ import org.teavm.model.ClassHolderSource;
import org.teavm.model.ElementModifier;
import org.teavm.model.FieldHolder;
import org.teavm.model.Instruction;
import org.teavm.model.InstructionLocation;
import org.teavm.model.TextLocation;
import org.teavm.model.MethodHolder;
import org.teavm.model.MethodReference;
import org.teavm.model.Program;
@ -456,17 +455,15 @@ public class Decompiler {
if (node >= 0) {
generator.statements.clear();
InstructionLocation lastLocation = null;
NodeLocation nodeLocation = null;
TextLocation lastLocation = null;
List<Instruction> instructions = generator.currentBlock.getInstructions();
for (int j = 0; j < instructions.size(); ++j) {
Instruction insn = generator.currentBlock.getInstructions().get(j);
if (insn.getLocation() != null && lastLocation != insn.getLocation()) {
lastLocation = insn.getLocation();
nodeLocation = new NodeLocation(lastLocation.getFileName(), lastLocation.getLine());
}
if (insn.getLocation() != null) {
generator.setCurrentLocation(nodeLocation);
generator.setCurrentLocation(lastLocation);
}
insn.acceptVisitor(generator);
}

View File

@ -31,7 +31,6 @@ import org.teavm.ast.InitClassStatement;
import org.teavm.ast.InvocationExpr;
import org.teavm.ast.MonitorEnterStatement;
import org.teavm.ast.MonitorExitStatement;
import org.teavm.ast.NodeLocation;
import org.teavm.ast.OperationType;
import org.teavm.ast.PrimitiveCastExpr;
import org.teavm.ast.ReturnStatement;
@ -48,6 +47,7 @@ import org.teavm.model.InvokeDynamicInstruction;
import org.teavm.model.MethodDescriptor;
import org.teavm.model.MethodReference;
import org.teavm.model.Program;
import org.teavm.model.TextLocation;
import org.teavm.model.ValueType;
import org.teavm.model.Variable;
import org.teavm.model.instructions.ArrayElementType;
@ -101,10 +101,10 @@ class StatementGenerator implements InstructionVisitor {
Decompiler.Block[] blockMap;
Program program;
ClassHolderSource classSource;
private NodeLocation currentLocation;
private TextLocation currentLocation;
boolean async;
void setCurrentLocation(NodeLocation currentLocation) {
void setCurrentLocation(TextLocation currentLocation) {
this.currentLocation = currentLocation;
}

View File

@ -51,7 +51,6 @@ import org.teavm.ast.MonitorExitStatement;
import org.teavm.ast.NewArrayExpr;
import org.teavm.ast.NewExpr;
import org.teavm.ast.NewMultiArrayExpr;
import org.teavm.ast.NodeLocation;
import org.teavm.ast.NodeModifier;
import org.teavm.ast.OperationType;
import org.teavm.ast.PrimitiveCastExpr;
@ -75,6 +74,7 @@ import org.teavm.ast.WhileStatement;
import org.teavm.model.FieldReference;
import org.teavm.model.MethodDescriptor;
import org.teavm.model.MethodReference;
import org.teavm.model.TextLocation;
import org.teavm.model.ValueType;
import org.teavm.model.instructions.ArrayElementType;
import org.teavm.model.util.VariableType;
@ -227,7 +227,7 @@ public class AstIO {
expr.acceptVisitor(this);
}
private void writeLocation(NodeLocation location) throws IOException {
private void writeLocation(TextLocation location) throws IOException {
if (location == null || location.getFileName() == null) {
output.writeShort(-1);
} else {
@ -659,12 +659,12 @@ public class AstIO {
}
}
private NodeLocation readLocation(DataInput input) throws IOException {
private TextLocation readLocation(DataInput input) throws IOException {
int fileIndex = input.readShort();
if (fileIndex == -1) {
return null;
} else {
return new NodeLocation(fileTable.at(fileIndex), input.readShort());
return new TextLocation(fileTable.at(fileIndex), input.readShort());
}
}
@ -846,7 +846,7 @@ public class AstIO {
}
private Expr readExpr(DataInput input) throws IOException {
NodeLocation location = readLocation(input);
TextLocation location = readLocation(input);
Expr expr = readExprWithoutLocation(input);
expr.setLocation(location);
return expr;

View File

@ -75,7 +75,7 @@ public class ProgramIO {
}
}
}
InstructionLocation location = null;
TextLocation location = null;
InstructionWriter insnWriter = new InstructionWriter(data);
for (Instruction insn : basicBlock.getInstructions()) {
try {
@ -158,7 +158,7 @@ public class ProgramIO {
block.getTryCatchBlocks().add(tryCatch);
}
InstructionLocation location = null;
TextLocation location = null;
insnLoop: while (true) {
byte insnType = data.readByte();
switch (insnType) {
@ -170,7 +170,7 @@ public class ProgramIO {
case -3: {
String file = fileTable.at(data.readShort());
short line = data.readShort();
location = new InstructionLocation(file, line);
location = new TextLocation(file, line);
break;
}
default: {

View File

@ -15,7 +15,7 @@
*/
package org.teavm.callgraph;
import org.teavm.model.InstructionLocation;
import org.teavm.model.TextLocation;
/**
* <p>Call site that represents exact place in the code that calls a method.</p>.
@ -27,7 +27,7 @@ public interface CallSite {
*
* @return location of the call site or <code>null</code> if no debug information found for this call site.
*/
InstructionLocation getLocation();
TextLocation getLocation();
/**
* <p>Gets a method that this call site invokes.</p>

View File

@ -15,14 +15,14 @@
*/
package org.teavm.callgraph;
import org.teavm.model.InstructionLocation;
import org.teavm.model.TextLocation;
/**
*
* @author Alexey Andreev
*/
public interface ClassAccessSite {
InstructionLocation getLocation();
TextLocation getLocation();
CallGraphNode getCallee();

View File

@ -17,7 +17,7 @@ package org.teavm.callgraph;
import java.util.*;
import org.teavm.model.FieldReference;
import org.teavm.model.InstructionLocation;
import org.teavm.model.TextLocation;
import org.teavm.model.MethodReference;
/**
@ -67,7 +67,7 @@ public class DefaultCallGraphNode implements CallGraphNode {
return safeCallersCallSites;
}
public boolean addCallSite(MethodReference method, InstructionLocation location) {
public boolean addCallSite(MethodReference method, TextLocation location) {
DefaultCallGraphNode callee = graph.getNode(method);
DefaultCallSite callSite = new DefaultCallSite(location, callee, this);
if (callSites.add(callSite)) {
@ -90,7 +90,7 @@ public class DefaultCallGraphNode implements CallGraphNode {
return safeFieldAccessSites;
}
public boolean addFieldAccess(FieldReference field, InstructionLocation location) {
public boolean addFieldAccess(FieldReference field, TextLocation location) {
DefaultFieldAccessSite site = new DefaultFieldAccessSite(location, this, field);
if (fieldAccessSites.add(site)) {
graph.addFieldAccess(site);
@ -108,7 +108,7 @@ public class DefaultCallGraphNode implements CallGraphNode {
return safeClassAccessSites;
}
public boolean addClassAccess(String className, InstructionLocation location) {
public boolean addClassAccess(String className, TextLocation location) {
DefaultClassAccessSite site = new DefaultClassAccessSite(location, this, className);
if (classAccessSites.add(site)) {
graph.addClassAccess(site);

View File

@ -16,25 +16,25 @@
package org.teavm.callgraph;
import java.util.Objects;
import org.teavm.model.InstructionLocation;
import org.teavm.model.TextLocation;
/**
*
* @author Alexey Andreev
*/
public class DefaultCallSite implements CallSite {
private InstructionLocation location;
private TextLocation location;
private DefaultCallGraphNode callee;
private DefaultCallGraphNode caller;
DefaultCallSite(InstructionLocation location, DefaultCallGraphNode callee, DefaultCallGraphNode caller) {
DefaultCallSite(TextLocation location, DefaultCallGraphNode callee, DefaultCallGraphNode caller) {
this.location = location;
this.callee = callee;
this.caller = caller;
}
@Override
public InstructionLocation getLocation() {
public TextLocation getLocation() {
return location;
}

View File

@ -16,25 +16,25 @@
package org.teavm.callgraph;
import java.util.Objects;
import org.teavm.model.InstructionLocation;
import org.teavm.model.TextLocation;
/**
*
* @author Alexey Andreev
*/
public class DefaultClassAccessSite implements ClassAccessSite {
private InstructionLocation location;
private TextLocation location;
private CallGraphNode callee;
private String className;
DefaultClassAccessSite(InstructionLocation location, CallGraphNode callee, String className) {
DefaultClassAccessSite(TextLocation location, CallGraphNode callee, String className) {
this.location = location;
this.callee = callee;
this.className = className;
}
@Override
public InstructionLocation getLocation() {
public TextLocation getLocation() {
return location;
}

View File

@ -17,25 +17,25 @@ package org.teavm.callgraph;
import java.util.Objects;
import org.teavm.model.FieldReference;
import org.teavm.model.InstructionLocation;
import org.teavm.model.TextLocation;
/**
*
* @author Alexey Andreev
*/
public class DefaultFieldAccessSite implements FieldAccessSite {
private InstructionLocation location;
private TextLocation location;
private CallGraphNode callee;
private FieldReference field;
DefaultFieldAccessSite(InstructionLocation location, CallGraphNode callee, FieldReference field) {
DefaultFieldAccessSite(TextLocation location, CallGraphNode callee, FieldReference field) {
this.location = location;
this.callee = callee;
this.field = field;
}
@Override
public InstructionLocation getLocation() {
public TextLocation getLocation() {
return null;
}

View File

@ -16,14 +16,14 @@
package org.teavm.callgraph;
import org.teavm.model.FieldReference;
import org.teavm.model.InstructionLocation;
import org.teavm.model.TextLocation;
/**
*
* @author Alexey Andreev
*/
public interface FieldAccessSite {
InstructionLocation getLocation();
TextLocation getLocation();
CallGraphNode getCallee();

View File

@ -128,7 +128,7 @@ public class DataFlowGraphBuilder implements InstructionReader {
}
@Override
public void location(InstructionLocation location) {
public void location(TextLocation location) {
}
@Override

View File

@ -42,7 +42,7 @@ import org.teavm.model.ElementModifier;
import org.teavm.model.FieldHolder;
import org.teavm.model.FieldReader;
import org.teavm.model.FieldReference;
import org.teavm.model.InstructionLocation;
import org.teavm.model.TextLocation;
import org.teavm.model.MethodDescriptor;
import org.teavm.model.MethodHolder;
import org.teavm.model.MethodReader;
@ -273,7 +273,7 @@ public class DependencyChecker implements DependencyInfo {
return dep;
}
private boolean addClassAccess(DefaultCallGraphNode node, String className, InstructionLocation loc) {
private boolean addClassAccess(DefaultCallGraphNode node, String className, TextLocation loc) {
if (!node.addClassAccess(className, loc)) {
return false;
}

View File

@ -33,7 +33,7 @@ import org.teavm.model.FieldReference;
import org.teavm.model.Incoming;
import org.teavm.model.IncomingReader;
import org.teavm.model.Instruction;
import org.teavm.model.InstructionLocation;
import org.teavm.model.TextLocation;
import org.teavm.model.InvokeDynamicInstruction;
import org.teavm.model.MethodDescriptor;
import org.teavm.model.MethodHandle;
@ -73,7 +73,7 @@ class DependencyGraphBuilder {
private DependencyNode resultNode;
private Program program;
private DefaultCallGraphNode caller;
private InstructionLocation currentLocation;
private TextLocation currentLocation;
private ExceptionConsumer currentExceptionConsumer;
public DependencyGraphBuilder(DependencyChecker dependencyChecker) {
@ -334,13 +334,13 @@ class DependencyGraphBuilder {
private final DependencyNode[] parameters;
private final DependencyNode result;
private final DefaultCallGraphNode caller;
private final InstructionLocation location;
private final TextLocation location;
private final Set<MethodReference> knownMethods = new HashSet<>();
private ExceptionConsumer exceptionConsumer;
public VirtualCallConsumer(DependencyNode node, ClassReader filterClass,
MethodDescriptor methodDesc, DependencyChecker checker, DependencyNode[] parameters,
DependencyNode result, DefaultCallGraphNode caller, InstructionLocation location,
DependencyNode result, DefaultCallGraphNode caller, TextLocation location,
ExceptionConsumer exceptionConsumer) {
this.node = node;
this.filterClass = filterClass;
@ -392,7 +392,7 @@ class DependencyGraphBuilder {
private InstructionReader reader = new InstructionReader() {
@Override
public void location(InstructionLocation location) {
public void location(TextLocation location) {
currentLocation = location;
}

View File

@ -16,7 +16,7 @@
package org.teavm.diagnostics;
import org.teavm.model.FieldReference;
import org.teavm.model.InstructionLocation;
import org.teavm.model.TextLocation;
import org.teavm.model.MethodReference;
import org.teavm.model.ValueType;
@ -56,7 +56,7 @@ public class DefaultProblemTextConsumer implements ProblemTextConsumer {
}
@Override
public void appendLocation(InstructionLocation location) {
public void appendLocation(TextLocation location) {
sb.append(location);
}

View File

@ -132,10 +132,10 @@ public class Problem {
consumer.appendField((FieldReference) param);
break;
case LOCATION:
if (!(param instanceof InstructionLocation)) {
if (!(param instanceof TextLocation)) {
return index;
}
consumer.appendLocation((InstructionLocation) param);
consumer.appendLocation((TextLocation) param);
break;
}
next += 2;

View File

@ -16,7 +16,7 @@
package org.teavm.diagnostics;
import org.teavm.model.FieldReference;
import org.teavm.model.InstructionLocation;
import org.teavm.model.TextLocation;
import org.teavm.model.MethodReference;
import org.teavm.model.ValueType;
@ -35,5 +35,5 @@ public interface ProblemTextConsumer {
void appendField(FieldReference field);
void appendLocation(InstructionLocation location);
void appendLocation(TextLocation location);
}

View File

@ -57,7 +57,6 @@ import org.teavm.ast.NativeMethodNode;
import org.teavm.ast.NewArrayExpr;
import org.teavm.ast.NewExpr;
import org.teavm.ast.NewMultiArrayExpr;
import org.teavm.ast.NodeLocation;
import org.teavm.ast.NodeModifier;
import org.teavm.ast.OperationType;
import org.teavm.ast.PrimitiveCastExpr;
@ -101,6 +100,7 @@ import org.teavm.model.MethodDescriptor;
import org.teavm.model.MethodHolder;
import org.teavm.model.MethodReader;
import org.teavm.model.MethodReference;
import org.teavm.model.TextLocation;
import org.teavm.model.ValueType;
public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext {
@ -141,9 +141,9 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
}
private static class LocationStackEntry {
final NodeLocation location;
final TextLocation location;
LocationStackEntry(NodeLocation location) {
LocationStackEntry(TextLocation location) {
this.location = location;
}
}
@ -909,7 +909,7 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
}
}
private void pushLocation(NodeLocation location) {
private void pushLocation(TextLocation location) {
LocationStackEntry prevEntry = locationStack.peek();
if (location != null) {
if (prevEntry == null || !location.equals(prevEntry.location)) {

View File

@ -52,7 +52,7 @@ import org.teavm.model.CallLocation;
import org.teavm.model.ClassHolder;
import org.teavm.model.ClassHolderTransformer;
import org.teavm.model.ElementModifier;
import org.teavm.model.InstructionLocation;
import org.teavm.model.TextLocation;
import org.teavm.model.ListableClassHolderSource;
import org.teavm.model.MethodHolder;
import org.teavm.model.MethodReference;
@ -338,8 +338,8 @@ public class JavaScriptTarget implements TeaVMTarget, TeaVMJavaScriptHost {
}
private void emitCFG(DebugInformationEmitter emitter, Program program) {
Map<InstructionLocation, InstructionLocation[]> cfg = ProgramUtils.getLocationCFG(program);
for (Map.Entry<InstructionLocation, InstructionLocation[]> entry : cfg.entrySet()) {
Map<TextLocation, TextLocation[]> cfg = ProgramUtils.getLocationCFG(program);
for (Map.Entry<TextLocation, TextLocation[]> entry : cfg.entrySet()) {
SourceLocation location = map(entry.getKey());
SourceLocation[] successors = new SourceLocation[entry.getValue().length];
for (int i = 0; i < entry.getValue().length; ++i) {
@ -349,7 +349,7 @@ public class JavaScriptTarget implements TeaVMTarget, TeaVMJavaScriptHost {
}
}
private static SourceLocation map(InstructionLocation location) {
private static SourceLocation map(TextLocation location) {
if (location == null) {
return null;
}

View File

@ -177,7 +177,7 @@ public class BasicBlock implements BasicBlockReader {
@Override
public void readAllInstructions(InstructionReader reader) {
InstructionReadVisitor visitor = new InstructionReadVisitor(reader);
InstructionLocation location = null;
TextLocation location = null;
for (Instruction insn : instructions) {
if (!Objects.equals(location, insn.getLocation())) {
location = insn.getLocation();

View File

@ -17,19 +17,15 @@ package org.teavm.model;
import java.util.Objects;
/**
*
* @author Alexey Andreev
*/
public class CallLocation {
private MethodReference method;
private InstructionLocation sourceLocation;
private TextLocation sourceLocation;
public CallLocation(MethodReference method) {
this(method, null);
}
public CallLocation(MethodReference method, InstructionLocation sourceLocation) {
public CallLocation(MethodReference method, TextLocation sourceLocation) {
if (method == null) {
throw new IllegalArgumentException("Method must not be null");
}
@ -41,7 +37,7 @@ public class CallLocation {
return method;
}
public InstructionLocation getSourceLocation() {
public TextLocation getSourceLocation() {
return sourceLocation;
}

View File

@ -19,7 +19,7 @@ import org.teavm.model.instructions.InstructionVisitor;
public abstract class Instruction {
private BasicBlock basicBlock;
private InstructionLocation location;
private TextLocation location;
void setBasicBlock(BasicBlock basicBlock) {
this.basicBlock = basicBlock;
@ -33,11 +33,11 @@ public abstract class Instruction {
return basicBlock != null ? basicBlock.getProgram() : null;
}
public InstructionLocation getLocation() {
public TextLocation getLocation() {
return location;
}
public void setLocation(InstructionLocation location) {
public void setLocation(TextLocation location) {
this.location = location;
}

View File

@ -121,7 +121,7 @@ public class Interpreter {
private Objenesis objenesis = new ObjenesisStd();
@Override
public void location(InstructionLocation location) {
public void location(TextLocation location) {
}
@Override

View File

@ -17,15 +17,11 @@ package org.teavm.model;
import java.util.Objects;
/**
*
* @author Alexey Andreev
*/
public class InstructionLocation {
public class TextLocation {
private String fileName;
private int line = -1;
public InstructionLocation(String fileName, int line) {
public TextLocation(String fileName, int line) {
this.fileName = fileName;
this.line = line;
}
@ -52,10 +48,10 @@ public class InstructionLocation {
if (this == obj) {
return true;
}
if (!(obj instanceof InstructionLocation)) {
if (!(obj instanceof TextLocation)) {
return false;
}
InstructionLocation other = (InstructionLocation) obj;
TextLocation other = (TextLocation) obj;
return Objects.equals(fileName, other.fileName) && line == other.line;
}

View File

@ -21,7 +21,7 @@ import org.teavm.model.ClassReaderSource;
import org.teavm.model.FieldReader;
import org.teavm.model.FieldReference;
import org.teavm.model.Instruction;
import org.teavm.model.InstructionLocation;
import org.teavm.model.TextLocation;
import org.teavm.model.MethodDescriptor;
import org.teavm.model.MethodHolder;
import org.teavm.model.MethodReference;
@ -56,7 +56,7 @@ public final class ProgramEmitter {
private Program program;
private BasicBlock block;
ClassReaderSource classSource;
private InstructionLocation currentLocation;
private TextLocation currentLocation;
private ProgramEmitter(Program program, BasicBlock block, ClassReaderSource classSource) {
this.program = program;
@ -373,11 +373,11 @@ public final class ProgramEmitter {
return var(program.createVariable(), type);
}
public InstructionLocation getCurrentLocation() {
public TextLocation getCurrentLocation() {
return currentLocation;
}
public void setCurrentLocation(InstructionLocation currentLocation) {
public void setCurrentLocation(TextLocation currentLocation) {
this.currentLocation = currentLocation;
}

View File

@ -19,7 +19,7 @@ import java.util.List;
import org.teavm.model.*;
public interface InstructionReader {
void location(InstructionLocation location);
void location(TextLocation location);
void nop();

View File

@ -237,7 +237,7 @@ public class AsyncMethodFinder {
boolean async;
@Override
public void location(InstructionLocation location) {
public void location(TextLocation location) {
}
@Override

View File

@ -21,7 +21,7 @@ import org.teavm.model.BasicBlock;
import org.teavm.model.BasicBlockReader;
import org.teavm.model.FieldReference;
import org.teavm.model.Instruction;
import org.teavm.model.InstructionLocation;
import org.teavm.model.TextLocation;
import org.teavm.model.InvokeDynamicInstruction;
import org.teavm.model.MethodDescriptor;
import org.teavm.model.MethodHandle;
@ -82,7 +82,7 @@ import org.teavm.model.instructions.UnwrapArrayInstruction;
public class InstructionCopyReader implements InstructionReader {
private Instruction copy;
private Program programCopy;
private InstructionLocation location;
private TextLocation location;
public InstructionCopyReader(Program programCopy) {
this.programCopy = programCopy;
@ -97,7 +97,7 @@ public class InstructionCopyReader implements InstructionReader {
}
@Override
public void location(InstructionLocation location) {
public void location(TextLocation location) {
this.location = location;
}

View File

@ -26,19 +26,19 @@ import org.teavm.model.instructions.*;
* @author Alexey Andreev
*/
public class InstructionStringifier implements InstructionReader {
private InstructionLocation location;
private TextLocation location;
private StringBuilder sb;
public InstructionStringifier(StringBuilder sb) {
this.sb = sb;
}
public InstructionLocation getLocation() {
public TextLocation getLocation() {
return location;
}
@Override
public void location(InstructionLocation location) {
public void location(TextLocation location) {
this.location = location;
}

View File

@ -67,7 +67,7 @@ public class ListingBuilder {
sb.append("\n");
}
InstructionLocation location = null;
TextLocation location = null;
for (int j = 0; j < block.instructionCount(); ++j) {
insnSb.setLength(0);
block.readInstruction(j, stringifier);

View File

@ -19,7 +19,7 @@ import java.util.*;
import org.teavm.common.Graph;
import org.teavm.model.BasicBlock;
import org.teavm.model.Instruction;
import org.teavm.model.InstructionLocation;
import org.teavm.model.TextLocation;
import org.teavm.model.Program;
/**
@ -27,11 +27,11 @@ import org.teavm.model.Program;
* @author Alexey Andreev
*/
class LocationGraphBuilder {
private Map<InstructionLocation, Set<InstructionLocation>> graphBuilder;
private List<Set<InstructionLocation>> startLocations;
private Map<TextLocation, Set<TextLocation>> graphBuilder;
private List<Set<TextLocation>> startLocations;
private List<AdditionalConnection> additionalConnections;
public Map<InstructionLocation, InstructionLocation[]> build(Program program) {
public Map<TextLocation, TextLocation[]> build(Program program) {
graphBuilder = new HashMap<>();
Graph graph = ProgramUtils.buildControlFlowGraph(program);
dfs(graph, program);
@ -39,7 +39,7 @@ class LocationGraphBuilder {
}
private void dfs(Graph graph, Program program) {
startLocations = new ArrayList<>(Collections.<Set<InstructionLocation>>nCopies(graph.size(), null));
startLocations = new ArrayList<>(Collections.<Set<TextLocation>>nCopies(graph.size(), null));
additionalConnections = new ArrayList<>();
Deque<Step> stack = new ArrayDeque<>();
for (int i = 0; i < graph.size(); ++i) {
@ -48,7 +48,7 @@ class LocationGraphBuilder {
}
}
boolean[] visited = new boolean[graph.size()];
InstructionLocation[] blockLocations = new InstructionLocation[graph.size()];
TextLocation[] blockLocations = new TextLocation[graph.size()];
while (!stack.isEmpty()) {
Step step = stack.pop();
@ -61,7 +61,7 @@ class LocationGraphBuilder {
visited[step.block] = true;
startLocations.set(step.block, step.startLocations);
BasicBlock block = program.basicBlockAt(step.block);
InstructionLocation location = step.location;
TextLocation location = step.location;
boolean started = false;
for (Instruction insn : block.getInstructions()) {
if (insn.getLocation() != null) {
@ -80,7 +80,7 @@ class LocationGraphBuilder {
}
if (graph.outgoingEdgesCount(step.block) == 0) {
if (location != null) {
addEdge(location, new InstructionLocation(null, -1));
addEdge(location, new TextLocation(null, -1));
}
} else {
for (int next : graph.outgoingEdges(step.block)) {
@ -90,15 +90,15 @@ class LocationGraphBuilder {
}
}
private Map<InstructionLocation, InstructionLocation[]> assemble() {
private Map<TextLocation, TextLocation[]> assemble() {
for (AdditionalConnection additionalConn : additionalConnections) {
for (InstructionLocation succ : additionalConn.successors) {
for (TextLocation succ : additionalConn.successors) {
addEdge(additionalConn.location, succ);
}
}
Map<InstructionLocation, InstructionLocation[]> locationGraph = new HashMap<>();
for (Map.Entry<InstructionLocation, Set<InstructionLocation>> entry : graphBuilder.entrySet()) {
InstructionLocation[] successors = entry.getValue().toArray(new InstructionLocation[0]);
Map<TextLocation, TextLocation[]> locationGraph = new HashMap<>();
for (Map.Entry<TextLocation, Set<TextLocation>> entry : graphBuilder.entrySet()) {
TextLocation[] successors = entry.getValue().toArray(new TextLocation[0]);
for (int i = 0; i < successors.length; ++i) {
if (successors[i] != null && successors[i].getLine() < 0) {
successors[i] = null;
@ -109,8 +109,8 @@ class LocationGraphBuilder {
return locationGraph;
}
private void addEdge(InstructionLocation source, InstructionLocation dest) {
Set<InstructionLocation> successors = graphBuilder.get(source);
private void addEdge(TextLocation source, TextLocation dest) {
Set<TextLocation> successors = graphBuilder.get(source);
if (successors == null) {
successors = new HashSet<>();
graphBuilder.put(source, successors);
@ -119,10 +119,10 @@ class LocationGraphBuilder {
}
static class Step {
InstructionLocation location;
Set<InstructionLocation> startLocations;
TextLocation location;
Set<TextLocation> startLocations;
int block;
public Step(InstructionLocation location, Set<InstructionLocation> startLocations, int block) {
public Step(TextLocation location, Set<TextLocation> startLocations, int block) {
this.location = location;
this.startLocations = startLocations;
this.block = block;
@ -130,9 +130,9 @@ class LocationGraphBuilder {
}
static class AdditionalConnection {
InstructionLocation location;
Set<InstructionLocation> successors;
public AdditionalConnection(InstructionLocation location, Set<InstructionLocation> successors) {
TextLocation location;
Set<TextLocation> successors;
public AdditionalConnection(TextLocation location, Set<TextLocation> successors) {
this.location = location;
this.successors = successors;
}

View File

@ -95,7 +95,7 @@ public class MissingItemsProcessor {
block.getInstructions().addAll(instructionsToAdd);
}
private void emitExceptionThrow(InstructionLocation location, String exceptionName, String text) {
private void emitExceptionThrow(TextLocation location, String exceptionName, String text) {
Variable exceptionVar = program.createVariable();
ConstructInstruction newExceptionInsn = new ConstructInstruction();
newExceptionInsn.setType(exceptionName);
@ -125,7 +125,7 @@ public class MissingItemsProcessor {
instructionsToAdd.add(raiseInsn);
}
private boolean checkClass(InstructionLocation location, String className) {
private boolean checkClass(TextLocation location, String className) {
if (!achievableClasses.contains(className) || !dependencyInfo.getClass(className).isMissing()) {
return true;
}
@ -135,7 +135,7 @@ public class MissingItemsProcessor {
return false;
}
private boolean checkClass(InstructionLocation location, ValueType type) {
private boolean checkClass(TextLocation location, ValueType type) {
while (type instanceof ValueType.Array) {
type = ((ValueType.Array) type).getItemType();
}
@ -145,7 +145,7 @@ public class MissingItemsProcessor {
return true;
}
private boolean checkMethod(InstructionLocation location, MethodReference method) {
private boolean checkMethod(TextLocation location, MethodReference method) {
if (!checkClass(location, method.getClassName())) {
return false;
}
@ -158,7 +158,7 @@ public class MissingItemsProcessor {
return true;
}
private boolean checkField(InstructionLocation location, FieldReference field) {
private boolean checkField(TextLocation location, FieldReference field) {
if (!checkClass(location, field.getClassName())) {
return false;
}

View File

@ -25,7 +25,7 @@ import org.teavm.model.BasicBlockReader;
import org.teavm.model.Incoming;
import org.teavm.model.IncomingReader;
import org.teavm.model.Instruction;
import org.teavm.model.InstructionLocation;
import org.teavm.model.TextLocation;
import org.teavm.model.Phi;
import org.teavm.model.PhiReader;
import org.teavm.model.Program;
@ -62,7 +62,7 @@ public final class ProgramUtils {
return graphBuilder.build();
}
public static Map<InstructionLocation, InstructionLocation[]> getLocationCFG(Program program) {
public static Map<TextLocation, TextLocation[]> getLocationCFG(Program program) {
return new LocationGraphBuilder().build(program);
}

View File

@ -271,7 +271,7 @@ public class TypeInferer {
}
@Override
public void location(InstructionLocation location) {
public void location(TextLocation location) {
}
@Override

View File

@ -269,7 +269,7 @@ public class ProgramParser {
BasicBlock basicBlock = null;
Map<Integer, String> accumulatedDebugNames = new HashMap<>();
Integer lastLineNumber = null;
InstructionLocation lastLocation = null;
TextLocation lastLocation = null;
for (int i = 0; i < basicBlocks.size(); ++i) {
BasicBlock newBasicBlock = basicBlocks.get(i);
if (newBasicBlock != null) {
@ -303,7 +303,7 @@ public class ProgramParser {
Integer lineNumber = lineNumbers.get(label);
if (lineNumber != null && !lineNumber.equals(lastLineNumber)) {
lastLineNumber = lineNumber;
lastLocation = new InstructionLocation(fileName, lastLineNumber);
lastLocation = new TextLocation(fileName, lastLineNumber);
}
}
if (builtInstructions != null) {

View File

@ -45,7 +45,6 @@ import org.teavm.ast.MonitorExitStatement;
import org.teavm.ast.NewArrayExpr;
import org.teavm.ast.NewExpr;
import org.teavm.ast.NewMultiArrayExpr;
import org.teavm.ast.NodeLocation;
import org.teavm.ast.OperationType;
import org.teavm.ast.PrimitiveCastExpr;
import org.teavm.ast.QualificationExpr;
@ -65,8 +64,8 @@ import org.teavm.ast.WhileStatement;
import org.teavm.interop.Address;
import org.teavm.model.CallLocation;
import org.teavm.model.FieldReference;
import org.teavm.model.InstructionLocation;
import org.teavm.model.MethodReference;
import org.teavm.model.TextLocation;
import org.teavm.model.ValueType;
import org.teavm.model.classes.TagRegistry;
import org.teavm.model.classes.VirtualTableEntry;
@ -446,7 +445,7 @@ class WasmGenerationVisitor implements StatementVisitor, ExprVisitor {
}
}
private void storeField(Expr qualified, FieldReference field, Expr value, NodeLocation location) {
private void storeField(Expr qualified, FieldReference field, Expr value, TextLocation location) {
WasmExpression address = getAddress(qualified, field, location);
ValueType type = context.getFieldType(field);
value.acceptVisitor(this);
@ -800,9 +799,9 @@ class WasmGenerationVisitor implements StatementVisitor, ExprVisitor {
VirtualTableEntry vtableEntry = context.getVirtualTableProvider().lookup(expr.getMethod());
if (vtableEntry == null) {
result = new WasmInt32Constant(0);
InstructionLocation insnLocation = null;
TextLocation insnLocation = null;
if (expr.getLocation() != null) {
insnLocation = new InstructionLocation(expr.getLocation().getFileName(),
insnLocation = new TextLocation(expr.getLocation().getFileName(),
expr.getLocation().getLine());
}
CallLocation location = new CallLocation(method, insnLocation);
@ -891,7 +890,7 @@ class WasmGenerationVisitor implements StatementVisitor, ExprVisitor {
}
}
private WasmExpression getAddress(Expr qualified, FieldReference field, NodeLocation location) {
private WasmExpression getAddress(Expr qualified, FieldReference field, TextLocation location) {
int offset = classGenerator.getFieldOffset(field);
if (qualified == null) {
WasmExpression result = new WasmInt32Constant(offset);
@ -942,7 +941,7 @@ class WasmGenerationVisitor implements StatementVisitor, ExprVisitor {
result = allocateObject(expr.getConstructedClass(), expr.getLocation());
}
private WasmExpression allocateObject(String className, NodeLocation location) {
private WasmExpression allocateObject(String className, TextLocation location) {
int tag = classGenerator.getClassPointer(ValueType.object(className));
String allocName = WasmMangling.mangleMethod(new MethodReference(Allocator.class, "allocate",
RuntimeClass.class, Address.class));

View File

@ -15,19 +15,19 @@
*/
package org.teavm.wasm.model.expression;
import org.teavm.ast.NodeLocation;
import org.teavm.model.TextLocation;
public abstract class WasmExpression {
private NodeLocation location;
private TextLocation location;
WasmExpression() {
}
public NodeLocation getLocation() {
public TextLocation getLocation() {
return location;
}
public void setLocation(NodeLocation location) {
public void setLocation(TextLocation location) {
this.location = location;
}

View File

@ -55,7 +55,7 @@ import org.teavm.model.ClassReaderSource;
import org.teavm.model.ElementModifier;
import org.teavm.model.FieldHolder;
import org.teavm.model.Instruction;
import org.teavm.model.InstructionLocation;
import org.teavm.model.TextLocation;
import org.teavm.model.MethodDescriptor;
import org.teavm.model.MethodHolder;
import org.teavm.model.MethodReader;
@ -675,7 +675,7 @@ class JSClassProcessor {
}
private void addPropertyGet(String propertyName, Variable instance, Variable receiver,
InstructionLocation location) {
TextLocation location) {
Variable nameVar = addStringWrap(addString(propertyName, location), location);
InvokeInstruction insn = new InvokeInstruction();
insn.setType(InvocationType.SPECIAL);
@ -687,7 +687,7 @@ class JSClassProcessor {
replacement.add(insn);
}
private void addPropertySet(String propertyName, Variable instance, Variable value, InstructionLocation location) {
private void addPropertySet(String propertyName, Variable instance, Variable value, TextLocation location) {
Variable nameVar = addStringWrap(addString(propertyName, location), location);
InvokeInstruction insn = new InvokeInstruction();
insn.setType(InvocationType.SPECIAL);
@ -700,7 +700,7 @@ class JSClassProcessor {
replacement.add(insn);
}
private void addIndexerGet(Variable array, Variable index, Variable receiver, InstructionLocation location) {
private void addIndexerGet(Variable array, Variable index, Variable receiver, TextLocation location) {
InvokeInstruction insn = new InvokeInstruction();
insn.setType(InvocationType.SPECIAL);
insn.setMethod(new MethodReference(JS.class, "get", JSObject.class, JSObject.class, JSObject.class));
@ -711,7 +711,7 @@ class JSClassProcessor {
replacement.add(insn);
}
private void addIndexerSet(Variable array, Variable index, Variable value, InstructionLocation location) {
private void addIndexerSet(Variable array, Variable index, Variable value, TextLocation location) {
InvokeInstruction insn = new InvokeInstruction();
insn.setType(InvocationType.SPECIAL);
insn.setMethod(new MethodReference(JS.class, "set", JSObject.class, JSObject.class,
@ -723,7 +723,7 @@ class JSClassProcessor {
replacement.add(insn);
}
private void copyVar(Variable a, Variable b, InstructionLocation location) {
private void copyVar(Variable a, Variable b, TextLocation location) {
AssignInstruction insn = new AssignInstruction();
insn.setAssignee(a);
insn.setReceiver(b);
@ -731,11 +731,11 @@ class JSClassProcessor {
replacement.add(insn);
}
private Variable addStringWrap(Variable var, InstructionLocation location) {
private Variable addStringWrap(Variable var, TextLocation location) {
return wrap(var, ValueType.object("java.lang.String"), location);
}
private Variable addString(String str, InstructionLocation location) {
private Variable addString(String str, TextLocation location) {
Variable var = program.createVariable();
StringConstantInstruction nameInsn = new StringConstantInstruction();
nameInsn.setReceiver(var);
@ -957,7 +957,7 @@ class JSClassProcessor {
}
private Variable unwrap(Variable var, String methodName, ValueType argType, ValueType resultType,
InstructionLocation location) {
TextLocation location) {
if (!argType.isObject(JSObject.class.getName())) {
Variable castValue = program.createVariable();
CastInstruction castInsn = new CastInstruction();
@ -1013,7 +1013,7 @@ class JSClassProcessor {
return functor;
}
private Variable wrap(Variable var, ValueType type, InstructionLocation location) {
private Variable wrap(Variable var, ValueType type, TextLocation location) {
if (type instanceof ValueType.Object) {
String className = ((ValueType.Object) type).getClassName();
if (!className.equals("java.lang.String")) {

View File

@ -22,7 +22,7 @@ import java.util.stream.Collectors;
import org.teavm.common.DisjointSet;
import org.teavm.model.BasicBlockReader;
import org.teavm.model.FieldReference;
import org.teavm.model.InstructionLocation;
import org.teavm.model.TextLocation;
import org.teavm.model.MethodDescriptor;
import org.teavm.model.MethodHandle;
import org.teavm.model.MethodReference;
@ -134,7 +134,7 @@ class AliasFinder {
}
@Override
public void location(InstructionLocation location) {
public void location(TextLocation location) {
}
@Override

View File

@ -39,7 +39,7 @@ import org.teavm.model.FieldReference;
import org.teavm.model.Incoming;
import org.teavm.model.IncomingReader;
import org.teavm.model.Instruction;
import org.teavm.model.InstructionLocation;
import org.teavm.model.TextLocation;
import org.teavm.model.InvokeDynamicInstruction;
import org.teavm.model.MethodDescriptor;
import org.teavm.model.MethodHandle;
@ -103,8 +103,8 @@ import org.teavm.model.instructions.UnwrapArrayInstruction;
public class CompositeMethodGenerator {
private Diagnostics diagnostics;
Program program;
InstructionLocation location;
InstructionLocation forcedLocation;
TextLocation location;
TextLocation forcedLocation;
int blockIndex;
int returnBlockIndex;
private Variable resultVar;
@ -467,7 +467,7 @@ public class CompositeMethodGenerator {
}
@Override
public void location(InstructionLocation location) {
public void location(TextLocation location) {
CompositeMethodGenerator.this.location = location;
}

View File

@ -17,7 +17,7 @@ package org.teavm.metaprogramming.impl;
import org.teavm.metaprogramming.LazyComputation;
import org.teavm.metaprogramming.Value;
import org.teavm.model.InstructionLocation;
import org.teavm.model.TextLocation;
import org.teavm.model.ValueType;
public class LazyValueImpl<T> implements Value<T> {
@ -25,10 +25,10 @@ public class LazyValueImpl<T> implements Value<T> {
VariableContext context;
LazyComputation<T> computation;
ValueType type;
InstructionLocation forcedLocation;
TextLocation forcedLocation;
public LazyValueImpl(VariableContext context, LazyComputation<T> computation, ValueType type,
InstructionLocation forcedLocation) {
TextLocation forcedLocation) {
this.context = context;
this.computation = computation;
this.type = type;

View File

@ -39,7 +39,7 @@ import org.teavm.model.ClassHolder;
import org.teavm.model.ClassReaderSource;
import org.teavm.model.ElementModifier;
import org.teavm.model.Instruction;
import org.teavm.model.InstructionLocation;
import org.teavm.model.TextLocation;
import org.teavm.model.MethodHolder;
import org.teavm.model.MethodReader;
import org.teavm.model.MethodReference;
@ -407,7 +407,7 @@ public final class MetaprogrammingImpl {
MethodReader method = ((ReflectMethodImpl) location.getMethod()).method;
return location.getFileName() != null
? new CallLocation(method.getReference(),
new InstructionLocation(location.getFileName(), location.getLineNumber()))
new TextLocation(location.getFileName(), location.getLineNumber()))
: new CallLocation(method.getReference());
}
};

View File

@ -37,7 +37,7 @@ class InstructionLocationReader implements InstructionReader {
}
@Override
public void location(InstructionLocation location) {
public void location(TextLocation location) {
if (location != null && location.getFileName() != null) {
resources.add(location.getFileName());
}

View File

@ -22,7 +22,7 @@ import org.teavm.callgraph.CallSite;
import org.teavm.diagnostics.DefaultProblemTextConsumer;
import org.teavm.diagnostics.Problem;
import org.teavm.model.CallLocation;
import org.teavm.model.InstructionLocation;
import org.teavm.model.TextLocation;
import org.teavm.model.MethodReference;
import org.teavm.vm.TeaVM;
@ -72,7 +72,7 @@ public final class TeaVMProblemRenderer {
}
}
public static void renderCallLocation(MethodReference method, InstructionLocation location, StringBuilder sb) {
public static void renderCallLocation(MethodReference method, TextLocation location, StringBuilder sb) {
if (method != null) {
sb.append(method.getClassName() + "." + method.getName());
} else {

View File

@ -35,7 +35,7 @@ class ProgramSourceAggregator implements InstructionReader {
}
@Override
public void location(InstructionLocation location) {
public void location(TextLocation location) {
if (location != null && location.getFileName() != null && !location.getFileName().isEmpty()) {
sourceFiles.add(location.getFileName());
}