[svn] r7672: nemerle/trunk/ncc/typing/Typer.n
VladD2
svnadmin at nemerle.org
Sat May 12 18:41:29 CEST 2007
Log:
Continue Typer refactoring. Move init of local context from RunTyper() to ctors.
Author: VladD2
Date: Sat May 12 18:41:27 2007
New Revision: 7672
Modified:
nemerle/trunk/ncc/typing/Typer.n
Modified: nemerle/trunk/ncc/typing/Typer.n
==============================================================================
--- nemerle/trunk/ncc/typing/Typer.n (original)
+++ nemerle/trunk/ncc/typing/Typer.n Sat May 12 18:41:27 2007
@@ -133,7 +133,6 @@
// copy from parent
current_method_builder = parent.current_method_builder;
current_type = parent.current_type;
- local_context = parent.local_context;
is_method = parent.is_method;
is_instance_ctor = parent.is_instance_ctor;
env = parent.env;
@@ -142,6 +141,7 @@
current_fun = fn;
tenv = current_fun.tenv;
+ InitLocalContext (parent.local_context);
}
private this (mng : ManagerClass) {
@@ -154,13 +154,13 @@
this (mng);
current_type = tb;
parent_typer = None ();
- local_context = LocalContext.Empty;
messenger = solver.CurrentMessenger;
current_method_builder = mb;
when (mb != null) {
current_fun = mb.Header;
is_instance_ctor = mb.MemberKind == MemberKinds.Constructor && !mb.IsStatic;
is_method = mb.MemberKind == MemberKinds.Method && !mb.IsStatic || is_instance_ctor;
+ InitLocalContext (LocalContext.Empty);
}
}
@@ -240,7 +240,7 @@
assert (messenger.IsTopLevel);
messenger.InErrorMode = true;
assert (!typer_done);
- local_context = LocalContext.Empty;
+ InitLocalContext (LocalContext.Empty);
}
internal TriggerObsoleteWarning : bool
@@ -273,22 +273,28 @@
}
}
+ /// Init local_context and copy parametrs into it.
+ InitLocalContext(localContext : LocalContext) : void
+ {
+ local_context = localContext;
- RunTyper () : void
+ foreach (p : Fun_parm in current_fun.parms)
{
- foreach (p : Fun_parm in current_fun.parms) {
Util.locate (p.loc, {
def is_mutable =
p.modifiers.mods %&& NemerleAttributes.Mutable ||
p.kind != ParmKind.Normal;
- def l = LocalValue (current_fun, p.name, StripRefOut (p.ty),
+ def local = LocalValue (current_fun, p.name, StripRefOut (p.ty),
LocalValue.Kind.FunParm (p.kind),
is_mutable = is_mutable);
- AddLocal (PT.Name (p.name, p.color, null), l);
- p.decl = l;
+ AddLocal (PT.Name (p.name, p.color, null), local);
+ p.decl = local;
})
}
+ }
+ RunTyper () : void
+ {
when (inside_yielding_function &&
current_fun.name == "_N_yielding_function") {
Util.cassert (yield_labels == null);
More information about the svn
mailing list