[svn] r7686: nemerle/trunk/ncc: passes.n typing/Typer-PatternTyper.n
VladD2
svnadmin at nemerle.org
Fri May 18 04:07:12 CEST 2007
Log:
Prevent clear some variables in InitCompiler().
Author: VladD2
Date: Fri May 18 04:07:10 2007
New Revision: 7686
Modified:
nemerle/trunk/ncc/passes.n
nemerle/trunk/ncc/typing/Typer-PatternTyper.n
Modified: nemerle/trunk/ncc/passes.n
==============================================================================
--- nemerle/trunk/ncc/passes.n (original)
+++ nemerle/trunk/ncc/passes.n Fri May 18 04:07:10 2007
@@ -170,10 +170,11 @@
insideEnv, bodyLocation);
}
-
- // won't be needed when we use this object only once
- protected KillStatics () : void
+ /// Clearing all variables used in typing process.
+ /// Use this method only if we destroy NamespaceTree
+ protected virtual FullResetNamespaceTree () : void
{
+ Hierarchy = null;
Typer_checked_macro = null;
Typer_unchecked_macro = null;
Typer_yield_macro = null;
@@ -184,11 +185,8 @@
TyVar_reuse_queue = null;
Util_Id = 0;
AttributeMacroExpansion_global_nr = 0;
- Macros_in_pattern = false;
- Message_error_cnt = 0;
- Message_warning_cnt = 0;
- Message_emitted_hints.Clear ();
}
+
#endregion
/// initialize pipelines with default values
@@ -322,8 +320,11 @@
}
protected InitCompiler () : void {
- KillStatics ();
Stats.Reset ();
+ Message_emitted_hints.Clear ();
+ Macros_in_pattern = false;
+ Message_error_cnt = 0;
+ Message_warning_cnt = 0;
MacroColors = MacroColorizator ();
if (shouldCreate (NameTree))
NameTree = NamespaceTree (this);
@@ -333,9 +334,12 @@
MacrosRegistry = MacroRegistry (this);
when (shouldCreate (LibrariesManager))
LibrariesManager = ComponentsFactory.CreateLibraryReferenceManager (this, Options.LibraryPaths);
+
Options.Validate ();
+
this.Solver = Solver (this);
this.emptyTEnv = TyVarEnv (this);
+
if (Options.LexerStoreComments)
DocComments = Map ();
else
@@ -348,9 +352,9 @@
when (LexingPipeline == null)
if (Options.IndentationSyntax)
LexingPipeline = fun (fn) {
- def l = LexerFile (this, fn);
- l.SwitchToIndentationMode ();
- l
+ def lexer = LexerFile (this, fn);
+ lexer.SwitchToIndentationMode ();
+ lexer
}
else
LexingPipeline = LexerFile (this, _);
Modified: nemerle/trunk/ncc/typing/Typer-PatternTyper.n
==============================================================================
--- nemerle/trunk/ncc/typing/Typer-PatternTyper.n (original)
+++ nemerle/trunk/ncc/typing/Typer-PatternTyper.n Fri May 18 04:07:10 2007
@@ -753,6 +753,8 @@
| PT.PExpr.Quoted (parse_element) =>
// we use Macros functions to translate quoted element
Manager.Macros_in_pattern = true;
+ try
+ {
def lifted =
match (parse_element) {
| PT.SyntaxElement.Expression (e) => Macros.quoted_expr (e)
@@ -771,9 +773,10 @@
| PT.SyntaxElement.ParameterBuilder =>
Util.ice ("strange syntax element appeared in quotation")
};
- Manager.Macros_in_pattern = false;
- TypePattern (matched_value_type, Macros.patternize_quotation (lifted))
+ TypePattern (matched_value_type, Macros.patternize_quotation (lifted))
+ }
+ finally { Manager.Macros_in_pattern = false; }
| PT.PExpr.Spliced =>
ReportError (messenger,
More information about the svn
mailing list