[svn] r7737: nemerle/trunk/ncc: generation/Typer3.n
parsing/Utility.n passes.n typing/TypedTree.n typing/T...
IT
svnadmin at nemerle.org
Fri Jul 6 06:22:34 CEST 2007
Log:
Working on debugging in match.
Author: IT
Date: Fri Jul 6 06:22:30 2007
New Revision: 7737
Modified:
nemerle/trunk/ncc/generation/Typer3.n
nemerle/trunk/ncc/parsing/Utility.n
nemerle/trunk/ncc/passes.n
nemerle/trunk/ncc/typing/TypedTree.n
nemerle/trunk/ncc/typing/Typer.n
nemerle/trunk/ncc/typing/Typer2.n
Modified: nemerle/trunk/ncc/generation/Typer3.n
==============================================================================
--- nemerle/trunk/ncc/generation/Typer3.n (original)
+++ nemerle/trunk/ncc/generation/Typer3.n Fri Jul 6 06:22:30 2007
@@ -1309,7 +1309,8 @@
)
| TExpr.DebugInfo (e, pe) =>
- TExpr.DebugInfo (o.loc, null, inject(e), pe);
+ def e = inject(e);
+ TExpr.DebugInfo (o.loc, e.ty, e, pe);
//invalid things
| TExpr.PropertyMember
Modified: nemerle/trunk/ncc/parsing/Utility.n
==============================================================================
--- nemerle/trunk/ncc/parsing/Utility.n (original)
+++ nemerle/trunk/ncc/parsing/Utility.n Fri Jul 6 06:22:30 2007
@@ -326,11 +326,7 @@
if (s.IsEmpty)
Location.Default
else
- if (mng.IsIntelliSenseMode)
s [s.Count - 1].AsGenerated ()
- else
- s [s.Count - 1]//IT.TEMP
- .AsGenerated ()
}
}
}
Modified: nemerle/trunk/ncc/passes.n
==============================================================================
Modified: nemerle/trunk/ncc/typing/TypedTree.n
==============================================================================
--- nemerle/trunk/ncc/typing/TypedTree.n (original)
+++ nemerle/trunk/ncc/typing/TypedTree.n Fri Jul 6 06:22:30 2007
@@ -608,7 +608,9 @@
| _ => Util.ice ()
}
- | DebugInfo (e, pe) => TExpr.DebugInfo (expr.loc, null, get_ref (unfold (e)), pe)
+ | DebugInfo (e, pe) =>
+ def e = get_ref (unfold (e));
+ TExpr.DebugInfo (expr.loc, e.ty, e, pe)
| _ => Util.ice ($ "invalid cached expr: $expr")
}
@@ -710,7 +712,7 @@
| Switch { indexing_expr : TExpr;
default : option [TExpr];
cases : list [int * TExpr]; }
- | DebugInfo { expr : TExpr; pexpr : Nemerle.Compiler.Parsetree.PExpr}
+ | DebugInfo { expr : TExpr; pexpr : Nemerle.Compiler.Parsetree.PExpr }
public mutable ty : TyVar;
@@ -817,6 +819,10 @@
public Type : TyVar
{
get {
+ match (this)
+ {
+ | DebugInfo (e, _) => ty = e.Type
+ | _ =>
when (ty == null) {
def InternalType = ManagerClass.Instance.InternalType;
match (this) {
@@ -832,8 +838,6 @@
ty = InternalType.Boolean
| MacroEnvelope (_, _, e) =>
ty = e.Type
- | DebugInfo (e, _) =>
- ty = e.Type
| Cache as c =>
assert (c.body != null, $ "when trying to determin type, body is null: $this");
ty = c.body.Type
@@ -847,11 +851,23 @@
Util.ice ($"type is null for $loc, $this");
}
}
+ }
Util.cassert (ty != null, $ "still null, $loc, $this");
ty
}
+
+ internal set
+ {
+ match (this)
+ {
+ | DebugInfo (e, _) => e.ty = value;
+ | _ => ()
+ }
+
+ ty = value;
+ }
}
public MType : MType
@@ -1144,7 +1160,7 @@
if (e' : object == e)
null
else
- DebugInfo (expr.loc, null, e', pe)
+ DebugInfo (expr.loc, e'.ty, e', pe)
| Sequence (e1, e2) =>
Modified: nemerle/trunk/ncc/typing/Typer.n
==============================================================================
--- nemerle/trunk/ncc/typing/Typer.n (original)
+++ nemerle/trunk/ncc/typing/Typer.n Fri Jul 6 06:22:30 2007
@@ -1082,7 +1082,7 @@
$ "done typing: $e --> $res [$(res.GetHashCode())] : $(if (res.ty != null) res.Type else null))");
when (res.ty == null)
- res.ty = expected;
+ res.Type = expected;
res
| (e, Some ((orig, im))) =>
@@ -1105,7 +1105,7 @@
if (debugLocation.IsEmpty)
res
else
- TExpr.DebugInfo (debugLocation, null, res, expr);
+ TExpr.DebugInfo (debugLocation, res.ty, res, expr);
}
}
} catch {
@@ -1772,7 +1772,7 @@
if (debugLocation.IsEmpty)
texpr
else
- TExpr.DebugInfo (debugLocation, null, texpr, expression)
+ TExpr.DebugInfo (debugLocation, texpr.ty, texpr, expression)
}
private mutable debugInfos : list[Location * PT.PExpr] = [];
@@ -1785,8 +1785,7 @@
}
//IT.TEMP
- _ =
- if (!Manager.Options.EmitDebug || pexpr.loc.IsGeneratedOrEmpty || skip(pexpr.loc))
+ _ = if (!Manager.Options.EmitDebug || pexpr.loc.IsGeneratedOrEmpty || skip(pexpr.loc))
Location.Default
else
{
@@ -1794,30 +1793,30 @@
def truncateLoc()
{
- mutable isTruncated = false;
+ mutable findPrevExpr = false;
// Truncate DebugInfo location to inner exprs.
//
ExprWalker().Walk(pexpr, info =>
{
- def truncate(line, col)
+ def truncate(line, col, findPrev)
{
when (line < loc.EndLine || line == loc.EndLine && col < loc.EndColumn)
{
loc = Location(loc.FileIndex, loc.Line, loc.Column, line, col);
- isTruncated = true;
+ findPrevExpr = findPrev;
}
}
match (info.Node)
{
- | PT.PExpr.Sequence as s when !s.loc.IsGeneratedOrEmpty => truncate(s.loc.Line, s.loc.Column);
- | PT.PExpr.Match(_, _, l) when !l.IsGeneratedOrEmpty => truncate(l.EndLine, l.EndColumn);
+ | PT.PExpr.Sequence as s when !s.loc.IsGeneratedOrEmpty => truncate(s.loc.Line, s.loc.Column, true);
+ | PT.PExpr.Match(_, _, l) when !l.IsGeneratedOrEmpty => truncate(l.EndLine, l.EndColumn, false);
| _ => ()
}
});
- when (isTruncated)
+ when (findPrevExpr)
{
// Here we store the location of the last element,
// which ends on the same line where the original pexpr starts.
@@ -1871,6 +1870,7 @@
loc;
}
+ //IT.TEMP
Location.Default;
}
Modified: nemerle/trunk/ncc/typing/Typer2.n
==============================================================================
--- nemerle/trunk/ncc/typing/Typer2.n (original)
+++ nemerle/trunk/ncc/typing/Typer2.n Fri Jul 6 06:22:30 2007
@@ -1352,7 +1352,8 @@
| TExpr.Error => null
| TExpr.DebugInfo (e, pe) =>
- TExpr.DebugInfo (expr.loc, null, Walk (ctx, e), pe);
+ def e = Walk (ctx, e);
+ TExpr.DebugInfo (expr.loc, e.ty, e, pe);
| TExpr.Goto =>
unless (ctx %&& Context.AllowGoto)
More information about the svn
mailing list