Skip to content
Browse files

Fix miscompilation of string literal "L" after regex compiled in same…

… file
  • Loading branch information...
1 parent 4865e86 commit bd53b441f313c002bbb87daaa0eced156139caf2 @sorear committed Oct 29, 2011
Showing with 9 additions and 9 deletions.
  1. +7 −7 lib/CodeGen.cs
  2. +2 −2 lib/Kernel.cs
View
14 lib/CodeGen.cs
@@ -587,7 +587,7 @@ abstract class ClrOp {
}
protected static void TypeCheck(Type sub, Type super, object c) {
if (!super.IsAssignableFrom(sub))
- throw new Exception(sub + " not subtype of " + super + ":" + c);
+ throw new Exception(sub + " not subtype of " + super + ": " + c);
}
}
@@ -732,7 +732,7 @@ class ClrConstructorCall : ClrOp {
throw new Exception("argument list length mismatch");
for (int i = 0; i < ts.Count; i++) {
- TypeCheck(zyg[i].Returns, ts[i]);
+ TypeCheck(zyg[i].Returns, ts[i], mi);
}
}
}
@@ -1223,13 +1223,13 @@ class ClrSubyCall : ClrOp {
public ClrSubyCall(bool ismethod, string sig, ClrOp[] zyg) {
int i = 0;
- if (ismethod) TypeCheck(zyg[i++].Returns, Tokens.String);
- TypeCheck(zyg[i++].Returns, ismethod ? Tokens.Variable : Tokens.P6any);
+ if (ismethod) TypeCheck(zyg[i++].Returns, Tokens.String, "methodname");
+ TypeCheck(zyg[i++].Returns, ismethod ? Tokens.Variable : Tokens.P6any, "sub");
int j = 0;
while (j < sig.Length) {
string s = sig.Substring(j+1, sig[j]);
j += (1 + s.Length);
- TypeCheck(zyg[i++].Returns, (s == "flatcap") ? Tokens.P6any : Tokens.Variable);
+ TypeCheck(zyg[i++].Returns, (s == "flatcap") ? Tokens.P6any : Tokens.Variable, j);
}
this.ismethod = ismethod;
this.sig = sig;
@@ -1613,7 +1613,7 @@ class ClrNewArray : ClrOp {
if (r.IsValueType)
throw new ArgumentException();
foreach(ClrOp c in zyg)
- TypeCheck(c.Returns, r);
+ TypeCheck(c.Returns, r, "new-array");
HasCases = false;
this.zyg = zyg;
}
@@ -3414,7 +3414,7 @@ class NamProcessor {
Console.WriteLine("enter " + tag);
CpsOp r = handler(this, rnode);
if (Config.CGVerbose > 1)
- Console.WriteLine("exit " + tag);
+ Console.WriteLine("exit " + tag + " " + r.head.Returns);
return r;
}
}
View
4 lib/Kernel.cs
@@ -568,7 +568,7 @@ sealed class EmitUnit {
}
internal CpsOp StringListConst(string[] sl) {
- StringBuilder code = new StringBuilder("SL");
+ StringBuilder code = new StringBuilder("LS");
foreach (string s in sl) {
code.Append((char)(s.Length >> 16));
code.Append((char)(s.Length));
@@ -578,7 +578,7 @@ sealed class EmitUnit {
}
internal CpsOp CCListConst(int[][] ccl) {
- StringBuilder code = new StringBuilder("CL");
+ StringBuilder code = new StringBuilder("LC");
foreach (int[] cc in ccl) {
code.Append((char)(cc.Length >> 16));
code.Append((char)(cc.Length));

0 comments on commit bd53b44

Please sign in to comment.
Something went wrong with that request. Please try again.