diff --git a/java/runtime/Rakudo/Metamodel/SharedTable.java b/java/runtime/Rakudo/Metamodel/SharedTable.java
index f22b9e6..2c6db69 100644
--- a/java/runtime/Rakudo/Metamodel/SharedTable.java
+++ b/java/runtime/Rakudo/Metamodel/SharedTable.java
@@ -27,7 +27,7 @@ public final class SharedTable // C# has public sealed
public RakudoObject HOW;
///
- /// The type-object. If we do $obj.WHAT then it will refer to a
+ /// The type-object. If we do $obj.WHAT then it will refer to a
/// getting of this field.
///
public RakudoObject WHAT;
@@ -71,7 +71,10 @@ public RakudoObject FindMethod(ThreadContext tc, RakudoObject obj, String name,
// Otherwise, try method cache.
else if (MethodCache != null && MethodCache.containsKey(name))
- { cachedMethod = MethodCache.get(name); return cachedMethod; }
+ {
+ cachedMethod = MethodCache.get(name);
+ return cachedMethod;
+ }
// Otherwise, go ask the meta-object.
else
@@ -84,7 +87,11 @@ else if (MethodCache != null && MethodCache.containsKey(name))
tc, HOW, "find_method", Hints.NO_HINT);
// Call it.
- RakudoObject capture = CaptureHelper.FormWith(new RakudoObject[] { HOW, obj, Ops.box_str(tc, name, tc.DefaultStrBoxType) });
+ RakudoObject capture = CaptureHelper.FormWith(new RakudoObject[] {
+ HOW,
+ obj,
+ Ops.box_str(tc, name, tc.DefaultStrBoxType)
+ } );
return method.getSTable().Invoke(tc, method, capture);
}
}
@@ -111,7 +118,12 @@ public RakudoObject Invoke(ThreadContext threadContext, RakudoObject method, Rak
if (SpecialInvoke != null)
return SpecialInvoke.Invoke(threadContext, method, capture);
SharedTable sharedTable = method.getSTable();
- RakudoObject invokable = sharedTable.CachedInvoke; if (invokable == null) { invokable = sharedTable.CachedInvoke = method.getSTable().FindMethod(threadContext, method, "postcircumfix:<( )>", Hints.NO_HINT); }
+ RakudoObject invokable = sharedTable.CachedInvoke;
+ if (invokable == null)
+ { invokable
+ = sharedTable.CachedInvoke
+ = method.getSTable().FindMethod(threadContext, method, "postcircumfix:<( )>", Hints.NO_HINT);
+ }
return invokable.getSTable().Invoke(threadContext, method, capture);
}
@@ -184,4 +196,3 @@ public long getTypeCacheID () {
private static long TypeCacheIDSource = 4;
}
-
diff --git a/java/runtime/Rakudo/Runtime/CaptureHelper.java b/java/runtime/Rakudo/Runtime/CaptureHelper.java
index 2bef22d..076cdf5 100644
--- a/java/runtime/Rakudo/Runtime/CaptureHelper.java
+++ b/java/runtime/Rakudo/Runtime/CaptureHelper.java
@@ -97,7 +97,7 @@ public static RakudoObject GetPositional(RakudoObject capture, int pos)
if (nativeCapture != null)
{
RakudoObject[] possies = nativeCapture.Positionals;
- if (possies != null && pos < possies.length)
+ if (possies != null && pos < possies.length && pos >= 0)
return possies[pos];
else
return null;
diff --git a/java/runtime/Rakudo/Runtime/MultiDispatch/LexicalCandidateFinder.java b/java/runtime/Rakudo/Runtime/MultiDispatch/LexicalCandidateFinder.java
index 54f5022..d308894 100644
--- a/java/runtime/Rakudo/Runtime/MultiDispatch/LexicalCandidateFinder.java
+++ b/java/runtime/Rakudo/Runtime/MultiDispatch/LexicalCandidateFinder.java
@@ -31,12 +31,12 @@ public static ArrayList FindCandidates(Context callerSco
break;
// Any candidates here?
- if (curScope.LexPad.SlotMapping != null && curScope.LexPad.SlotMapping.containsKey(candidateHolderName)) {
+ if (curScope.LexPad.SlotMapping != null && curScope.LexPad.SlotMapping.containsKey(candidateHolderName))
+ {
Integer index = curScope.LexPad.SlotMapping.get(candidateHolderName);
P6list.Instance p6listInstance = (P6list.Instance)curScope.LexPad.Storage[index];
- for (RakudoObject candidate : p6listInstance.Storage) {
+ for (RakudoObject candidate : p6listInstance.Storage)
result.add((RakudoCodeRef.Instance)candidate);
- }
}
} while (curScope != protoScope);
return result;
diff --git a/java/runtime/Rakudo/Runtime/MultiDispatch/MultiDispatcher.java b/java/runtime/Rakudo/Runtime/MultiDispatch/MultiDispatcher.java
index f61559b..e114438 100644
--- a/java/runtime/Rakudo/Runtime/MultiDispatch/MultiDispatcher.java
+++ b/java/runtime/Rakudo/Runtime/MultiDispatch/MultiDispatcher.java
@@ -93,7 +93,7 @@ else if (possiblesList.size() > 1)
continue;
}
}
-
+
/* Check if it's admissible by arity. */
int numArgs = nativeCapture.Positionals.length;
if (numArgs < candidate.Sig.NumRequiredPositionals ||
@@ -142,9 +142,9 @@ else if (possiblesList.size() > 1)
private static ArrayList candidateSort(RakudoObject[] unsorted)
{
ArrayList sorted = new ArrayList();
- for (RakudoObject obj : unsorted) {
+ for (RakudoObject obj : unsorted)
sorted.add(obj);
- }
+
sorted.add(null); // XXX does this actually sort?
return sorted;
}
@@ -171,7 +171,8 @@ else if (a.Sig.NumRequiredPositionals == b.Sig.NumRequiredPositionals)
return 0;
/* Analyse each parameter in the two candidates. */
- for (i = 0; i < TypesToCheck; i++) {
+ for (i = 0; i < TypesToCheck; i++)
+ {
RakudoObject TypeObjA = a.Sig.Parameters[i].Type;
RakudoObject TypeObjB = b.Sig.Parameters[i].Type;
if (TypeObjA == TypeObjB)
@@ -216,4 +217,3 @@ public static boolean IsNarrowerType(RakudoObject A, RakudoObject B)
return true;
}
}
-
diff --git a/java/runtime/Rakudo/Runtime/Ops.java b/java/runtime/Rakudo/Runtime/Ops.java
index 5007b69..a1a1152 100644
--- a/java/runtime/Rakudo/Runtime/Ops.java
+++ b/java/runtime/Rakudo/Runtime/Ops.java
@@ -1116,13 +1116,13 @@ public static RakudoObject load_module(ThreadContext tc, RakudoObject path)
// Load the assembly and grab the first type in it.
//var assembly = AppDomain.CurrentDomain.Load(Ops.unbox_str(tc, path));
//var class = Assembly.GetTypes()[0];
-
+
// Call the Load method, passing along the current thread context
// and the setting to use with it. What's returned is what the main
// body of the compilation unit evaluates to.
//var method = class.GetMethod("Load", BindingFlags.NonPublic | BindingFlags.Static);
if (true) // sneak by the "unreachable code" monster
- throw new UnsupportedOperationException("load_module NYI");
+ throw new UnsupportedOperationException("load_module NYI");
return (RakudoObject)null;
//return (RakudoObject)method.Invoke.Invoke(null, new Object[] { tc, tc.Domain.Setting });
}
@@ -1136,7 +1136,8 @@ public static RakudoObject get_lex(ThreadContext tc, String name)
{
Context curContext = tc.CurrentContext;
while (curContext != null) {
- if (curContext.LexPad.SlotMapping.containsKey(name)) {
+ if (curContext.LexPad.SlotMapping.containsKey(name))
+ {
int index = curContext.LexPad.SlotMapping.get(name);
return curContext.LexPad.Storage[index];
}
@@ -1157,7 +1158,8 @@ public static RakudoObject get_lex_skip_current(ThreadContext tc, String name)
Context curContext = tc.CurrentContext.Outer;
while (curContext != null)
{
- if (curContext.LexPad.SlotMapping.containsKey(name)) {
+ if (curContext.LexPad.SlotMapping.containsKey(name))
+ {
int index = curContext.LexPad.SlotMapping.get(name);
return curContext.LexPad.Storage[index];
}
@@ -1179,7 +1181,7 @@ public static RakudoObject bind_lex(ThreadContext tc, String name, RakudoObject
{
if (curContext.LexPad.SlotMapping.containsKey(name))
{
- int index = curContext.LexPad.SlotMapping.get(name);
+ int index = curContext.LexPad.SlotMapping.get(name);
curContext.LexPad.Storage[index] = value;
return value;
}
@@ -1198,7 +1200,8 @@ public static RakudoObject get_dynamic(ThreadContext tc, String name)
{
Context curContext = tc.CurrentContext;
while (curContext != null) {
- if (curContext.LexPad.SlotMapping.containsKey(name)) {
+ if (curContext.LexPad.SlotMapping.containsKey(name))
+ {
int index = curContext.LexPad.SlotMapping.get(name);
return curContext.LexPad.Storage[index];
}
@@ -1230,4 +1233,3 @@ public static RakudoObject bind_dynamic(ThreadContext tc, String name, RakudoObj
}
}
-