[svn] r6339: nemerle/trunk/ncc: STATELESS-TODO parsing/AST.n
parsing/Utility.n passes.n
malekith
svnadmin at nemerle.org
Fri May 26 18:09:23 CEST 2006
Log:
Unstatic Location_stack and Location. MS_NET_Runtime_type is OK. So it seems done.
Author: malekith
Date: Fri May 26 18:09:21 2006
New Revision: 6339
Removed:
nemerle/trunk/ncc/STATELESS-TODO
Modified:
nemerle/trunk/ncc/parsing/AST.n
nemerle/trunk/ncc/parsing/Utility.n
nemerle/trunk/ncc/passes.n
Modified: nemerle/trunk/ncc/parsing/AST.n
==============================================================================
--- nemerle/trunk/ncc/parsing/AST.n (original)
+++ nemerle/trunk/ncc/parsing/AST.n Fri May 26 18:09:21 2006
@@ -77,19 +77,17 @@
/** bits reserved for index of file */
static file_mask : ulong = 0b1111111111UL;
- /** mapping from index to file name */
- static file_names : array [string] = array (1024);
- static mutable file_names_amount : int;
-
- /** encountered file names with mapping to their indices */
- static file_indices : Hashtable [string, int] = Hashtable ();
+ static Manager : ManagerClass
+ {
+ get { ManagerClass.Instance }
+ }
public static Init () : void
{
- file_indices.Clear ();
- file_indices.Add ("", 0);
- file_names [0] = "";
- file_names_amount = 1;
+ Manager.Location_file_indices.Clear ();
+ Manager.Location_file_indices.Add ("", 0);
+ Manager.Location_file_names [0] = "";
+ Manager.Location_file_names_amount = 1;
}
public static ComputeToken (file_idx : int, line : int, col : int,
@@ -107,7 +105,7 @@
*/
public static AddFile (name : string) : int
{
- when (file_indices.Contains (name))
+ when (Manager.Location_file_indices.Contains (name))
Message.Error ($"file $name occured twice on the list to compile");
GetFileIndex (name)
}
@@ -115,9 +113,9 @@
/** Removes a filename from the location index */
public static RemoveFile (name : string) : void
{
- if (file_indices.Contains (name))
+ if (Manager.Location_file_indices.Contains (name))
{
- file_indices.Remove (name);
+ Manager.Location_file_indices.Remove (name);
}
else
throw System.ArgumentException ($"file $name do not exist");
@@ -128,19 +126,19 @@
*/
public static GetFileIndex (name : string) : int
{
- match (file_indices.Get (name)) {
+ match (Manager.Location_file_indices.Get (name)) {
| Some (idx) => idx
| None =>
- if (file_names_amount == file_names.Length) {
+ if (Manager.Location_file_names_amount == Manager.Location_file_names.Length) {
Message.Warning ("too many filenames... Location cache overflow");
0
}
else {
- assert (file_names_amount > 0);
- file_indices.Add (name, file_names_amount);
- file_names [file_names_amount] = name;
- ++file_names_amount;
- file_names_amount - 1
+ assert (Manager.Location_file_names_amount > 0);
+ Manager.Location_file_indices.Add (name, Manager.Location_file_names_amount);
+ Manager.Location_file_names [Manager.Location_file_names_amount] = name;
+ ++Manager.Location_file_names_amount;
+ Manager.Location_file_names_amount - 1
}
}
}
@@ -156,7 +154,7 @@
{
[Nemerle.Assertions.Ensures (value != null)]
get {
- file_names [(token %& file_mask) :> int];
+ Manager.Location_file_names [(token %& file_mask) :> int];
}
}
Modified: nemerle/trunk/ncc/parsing/Utility.n
==============================================================================
--- nemerle/trunk/ncc/parsing/Utility.n (original)
+++ nemerle/trunk/ncc/parsing/Utility.n Fri May 26 18:09:21 2006
@@ -303,31 +303,27 @@
}
}
+ [ManagerAccess (ManagerClass.Instance)]
module Location_stack
{
- mutable s : Vector [Location];
-
public push (l : Location) : void
{
- s.Add (l)
+ Manager.Location_stack.Add (l)
}
- [Nemerle.Assertions.Requires (!s.IsEmpty)]
+ [Nemerle.Assertions.Requires (!Manager.Location_stack.IsEmpty)]
public pop () : void
{
- s.RemoveLast ();
+ Manager.Location_stack.RemoveLast ();
}
public top () : Location
{
+ def s = Manager.Location_stack;
if (s.IsEmpty)
Location.Default
else
s [s.Count - 1]
}
-
- this () {
- s = Vector (32)
- }
}
}
Modified: nemerle/trunk/ncc/passes.n
==============================================================================
--- nemerle/trunk/ncc/passes.n (original)
+++ nemerle/trunk/ncc/passes.n Fri May 26 18:09:21 2006
@@ -104,6 +104,15 @@
internal mutable Message_emitted_hints : Hashtable [string, int] = Hashtable ();
internal mutable Message_output : System.IO.TextWriter;
+ internal Location_stack : Vector [Location] = Vector (32);
+
+ /** mapping from index to file name */
+ internal Location_file_names : array [string] = array (1024);
+ internal mutable Location_file_names_amount : int;
+
+ /** encountered file names with mapping to their indices */
+ internal Location_file_indices : Hashtable [string, int] = Hashtable ();
+
// won't be needed when we use this object only once
KillStatics () : void
@@ -122,6 +131,11 @@
Message_error_cnt = 0;
Message_warning_cnt = 0;
Message_emitted_hints.Clear ();
+
+ Location_file_indices.Clear ();
+ Location_file_indices.Add ("", 0);
+ Location_file_names [0] = "";
+ Location_file_names_amount = 1;
}
#endregion
@@ -137,6 +151,10 @@
SystemTypeCache = SystemTypeClass (this);
AttributeCompiler = AttributeCompilerClass (this);
Stats = StatsClass ();
+
+ Location_file_indices.Add ("", 0);
+ Location_file_names [0] = "";
+ Location_file_names_amount = 1;
}
More information about the svn
mailing list