[svn] r6674: nemerle/trunk/ncc: completion/CodeCompletionEngine.n
hierarchy/ClassMembers.n hierarchy/TypeB...
VladD2
svnadmin at nemerle.org
Fri Sep 22 03:34:51 CEST 2006
Log:
Work on relocation.
Author: VladD2
Date: Fri Sep 22 03:34:49 2006
New Revision: 6674
Modified:
nemerle/trunk/ncc/completion/CodeCompletionEngine.n
nemerle/trunk/ncc/hierarchy/ClassMembers.n
nemerle/trunk/ncc/hierarchy/TypeBuilder.n
Modified: nemerle/trunk/ncc/completion/CodeCompletionEngine.n
==============================================================================
--- nemerle/trunk/ncc/completion/CodeCompletionEngine.n (original)
+++ nemerle/trunk/ncc/completion/CodeCompletionEngine.n Fri Sep 22 03:34:49 2006
@@ -64,6 +64,33 @@
public module Completion
{
+ /// Shift Location.
+ public static Relocate(loc : Location, fileIndex : int, line : int, ch : int, lineOffset : int, chOffset : int) : Location
+ {
+ if (loc.FileIndex == fileIndex)
+ Relocate(loc, line, ch, lineOffset, chOffset)
+ else
+ loc
+ }
+
+ /// Shift Location.
+ public static Relocate(loc : Location, line : int, ch : int, lineOffset : int, chOffset : int) : Location
+ {
+ def relocatePoint(oldLn, oldCh)
+ {
+ if (oldLn > line) (oldLn + lineOffset, oldCh)
+ else if (oldLn == line && oldCh >= ch)
+ if (lineOffset == 0) (oldLn, oldCh + chOffset)
+ else (oldLn + lineOffset, chOffset)
+ else (oldLn, oldCh)
+ }
+
+ def (newLn, newCh) = relocatePoint(loc.Line, loc.Column);
+ def (newEndLn, newEndCh) = relocatePoint(loc.EndLine, loc.EndColumn);
+
+ Location(loc.FileIndex, newLn, newCh, newEndLn, newEndCh);
+ }
+
CmpOptins = System.StringComparison.InvariantCultureIgnoreCase;
/// extract information about types/namespaces and add it to 'elems' list.
Modified: nemerle/trunk/ncc/hierarchy/ClassMembers.n
==============================================================================
--- nemerle/trunk/ncc/hierarchy/ClassMembers.n (original)
+++ nemerle/trunk/ncc/hierarchy/ClassMembers.n Fri Sep 22 03:34:49 2006
@@ -160,7 +160,7 @@
public override GlobalEnv : GlobalEnv
{
- get { declaring_type.GlobalEnv }
+ get { Env }
}
[Nemerle.OverrideObjectEquals]
@@ -379,6 +379,18 @@
internal abstract CreateEmitBuilder (emit_tb : SRE.TypeBuilder) : void;
internal abstract Compile () : void;
+
+ internal virtual Relocate(
+ fileIndex : int,
+ line : int,
+ ch : int,
+ lineOffset : int,
+ chOffset : int
+ )
+ : void
+ {
+ loc = Completion.Relocate(loc, fileIndex, line, ch, lineOffset, chOffset);
+ }
}
public partial class FieldBuilder : MemberBuilder, IField
Modified: nemerle/trunk/ncc/hierarchy/TypeBuilder.n
==============================================================================
--- nemerle/trunk/ncc/hierarchy/TypeBuilder.n (original)
+++ nemerle/trunk/ncc/hierarchy/TypeBuilder.n Fri Sep 22 03:34:49 2006
@@ -2574,6 +2574,20 @@
Message.FatalError (loc, title () + "s are not allowed to be abstract and sealed at the same time: " +
FullName)
}
-}
+ public Relocate(
+ fileIndex : int,
+ line : int,
+ ch : int,
+ lineOffset : int,
+ chOffset : int
+ )
+ : void
+ {
+ loc = Completion.Relocate(loc, fileIndex, line, ch, lineOffset, chOffset);
+ parts_location = parts_location.Map(Completion.Relocate(_, fileIndex, line, ch, lineOffset, chOffset));
+ foreach (member :> MemberBuilder in member_list)
+ member.Relocate(fileIndex, line, ch, lineOffset, chOffset);
+ }
+}
} // ns
More information about the svn
mailing list