Skip to content

Commit

Permalink
Merge PR #65: Various minor improves of debugging experience
Browse files Browse the repository at this point in the history
  • Loading branch information
smarr committed Nov 28, 2016
2 parents f8cad7e + 7ae8eb0 commit 79ac2eb
Show file tree
Hide file tree
Showing 114 changed files with 377 additions and 317 deletions.
1 change: 1 addition & 0 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="src" path="src_gen">
<attributes>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
Expand Down
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ jdk:
- oraclejdk8
sudo: false
env:
matrix:
- TASK=tests
- TASK=checkstyle
- TASK=kompos
global:
secure: PrFbSr/qjhVXrpiOzrcEMUZrnjEWJmvx5DC9QdaAmnUKpG9/7mJBQVgNziVj+GWfW84WJpkOsQf+I2lx7/cQsWQKad/t8wtypl30wGesSTpAgl5fCiKLOBAbOghKXir+WIaxtcATPPffur9OLh3ogEcmIQbVi682YUKmA5zF11JZdpCR4QONc/u+DqB29FuHru/cFiesYP0Oz82A+M0UtMcYsurKIxdKMD4YK/uSG892PUrcZU6STXlukhgQuy3PitSWkYV2KGxXMVKzWGM7dJvRggN05r/S871pscuRwZ+Doxqr9b17B3umCHi3i4KXmNH+Esb0p1mvegs0iS/b7RyA5SENre+H24n3SOeXTa3wSpTnF90XxQrDEBbY5wV7lN7MJG+pHxkOvoZt6pS3f7x2VYR8Joa4J+Gf6IDvxZMiCd1v3N1kc9ygyvJmHf5wDmLMdupk0/frojApDXfJT6bqiVL3S0FqZpXSPGAsKYf8wfn30Xz/YUBsnfUQ/a21Zz52+OTqPbt32Hf1FGYIEJSkZJUN90Q8rHVJt9zPg37xKCDuf6bxlvT040KSzuuXtizLkOnHq2rhg4Oad/JTw3d4NzPoRVzUI9qDKPrA7RdUAjmrB04Z1f3g/I6w3h2B9JTSFAzBcMZ5NYZhIqE31GQukgStaqC98y32/zo9xFs=
- secure: PrFbSr/qjhVXrpiOzrcEMUZrnjEWJmvx5DC9QdaAmnUKpG9/7mJBQVgNziVj+GWfW84WJpkOsQf+I2lx7/cQsWQKad/t8wtypl30wGesSTpAgl5fCiKLOBAbOghKXir+WIaxtcATPPffur9OLh3ogEcmIQbVi682YUKmA5zF11JZdpCR4QONc/u+DqB29FuHru/cFiesYP0Oz82A+M0UtMcYsurKIxdKMD4YK/uSG892PUrcZU6STXlukhgQuy3PitSWkYV2KGxXMVKzWGM7dJvRggN05r/S871pscuRwZ+Doxqr9b17B3umCHi3i4KXmNH+Esb0p1mvegs0iS/b7RyA5SENre+H24n3SOeXTa3wSpTnF90XxQrDEBbY5wV7lN7MJG+pHxkOvoZt6pS3f7x2VYR8Joa4J+Gf6IDvxZMiCd1v3N1kc9ygyvJmHf5wDmLMdupk0/frojApDXfJT6bqiVL3S0FqZpXSPGAsKYf8wfn30Xz/YUBsnfUQ/a21Zz52+OTqPbt32Hf1FGYIEJSkZJUN90Q8rHVJt9zPg37xKCDuf6bxlvT040KSzuuXtizLkOnHq2rhg4Oad/JTw3d4NzPoRVzUI9qDKPrA7RdUAjmrB04Z1f3g/I6w3h2B9JTSFAzBcMZ5NYZhIqE31GQukgStaqC98y32/zo9xFs=
matrix:
- TASK=tests
- TASK=checkstyle
- TASK=kompos
script:
- if [ "$TASK" = "tests" ]; then ant tests; ./som -G --coveralls $COVERALLS_REPO_TOKEN core-lib/TestSuite/TestRunner.som; fi
- if [ "$TASK" = "tests" ]; then ant tests; ./som -G --coveralls "$COVERALLS_REPO_TOKEN" core-lib/TestSuite/TestRunner.som; fi
- if [ "$TASK" = "checkstyle" ]; then ant checkstyle; fi
- if [ "$TASK" = "kompos" ]; then nvm install 6 && ant && cd tools/kompos && npm install && npm test; fi
4 changes: 2 additions & 2 deletions src/som/VMOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private String[] processVmArguments(final String[] arguments) {

while (parsedArgument) {
if (currentArg >= arguments.length) {
return null;
return new String[0];
} else {
if (arguments[currentArg].equals("--platform")) {
platformFile = arguments[currentArg + 1];
Expand Down Expand Up @@ -75,7 +75,7 @@ private String[] processVmArguments(final String[] arguments) {
if (currentArg < arguments.length) {
return Arrays.copyOfRange(arguments, currentArg, arguments.length);
} else {
return null;
return new String[0];
}
}

Expand Down
19 changes: 17 additions & 2 deletions src/som/compiler/MethodBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import som.VM;
import som.compiler.MixinBuilder.MixinDefinitionError;
import som.compiler.MixinBuilder.MixinDefinitionId;
import som.compiler.ProgramDefinitionError.SemanticDefinitionError;
import som.compiler.Variable.Argument;
import som.compiler.Variable.Local;
import som.interpreter.LexicalScope.MethodScope;
Expand Down Expand Up @@ -111,6 +112,14 @@ private MethodBuilder(final MixinBuilder holder, final MixinScope clsScope,
embeddedBlockMethods = new ArrayList<SInvokable>();
}

public static class MethodDefinitionError extends SemanticDefinitionError {
private static final long serialVersionUID = 3901992766649011815L;

MethodDefinitionError(final String message, final SourceSection source) {
super(message, source);
}
}

public Collection<Argument> getArguments() {
return arguments.values();
}
Expand Down Expand Up @@ -264,15 +273,21 @@ public void addArgumentIfAbsent(final String arg, final SourceSection source) {
addArgument(arg, source);
}

public void addLocalIfAbsent(final String local, final SourceSection source) {
public void addLocalIfAbsent(final String local, final SourceSection source)
throws MethodDefinitionError {
if (locals.containsKey(local)) {
return;
}

addLocal(local, source);
}

public Local addLocal(final String local, final SourceSection source) {
public Local addLocal(final String local, final SourceSection source)
throws MethodDefinitionError {
if (arguments.containsKey(local)) {
throw new MethodDefinitionError("Method already defines argument " + local + ". Can't define local variable with same name.", source);
}

Local l = new Local(
local, currentScope.getFrameDescriptor().addFrameSlot(local), source);
assert !locals.containsKey(local);
Expand Down
16 changes: 4 additions & 12 deletions src/som/compiler/MixinBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import som.compiler.MixinDefinition.ClassSlotDefinition;
import som.compiler.MixinDefinition.SlotDefinition;
import som.compiler.MixinDefinition.SlotMutator;
import som.compiler.ProgramDefinitionError.SemanticDefinitionError;
import som.compiler.Variable.Argument;
import som.interpreter.LexicalScope.MixinScope;
import som.interpreter.Method;
Expand Down Expand Up @@ -151,20 +152,11 @@ public MixinBuilder(final MixinBuilder outerBuilder,
this.structuralProbe = structuralProbe;
}

public static class MixinDefinitionError extends Exception {
private static final long serialVersionUID = 9200967710874738189L;
private final String message;
private final SourceSection source;
public static class MixinDefinitionError extends SemanticDefinitionError {
private static final long serialVersionUID = 5030639383869198851L;

MixinDefinitionError(final String message, final SourceSection source) {
this.message = message;
this.source = source;
}

@Override
public String toString() {
return source.getSource().getName() + ":" + source.getStartLine() + ":" +
source.getStartColumn() + ":error: " + message;
super(message, source);
}
}

Expand Down
Loading

0 comments on commit 79ac2eb

Please sign in to comment.