[svn] r7047: nemerle/trunk/ncc/parsing/MainParser.n
nemerle/trunk/ncc/typing/LocalValue.n nemerle/trunk/nc...
IT
svnadmin at nemerle.org
Tue Dec 5 05:08:19 CET 2006
Log:
Added LocalValue.NameLocation.
Author: IT
Date: Tue Dec 5 05:08:14 2006
New Revision: 7047
Modified:
nemerle/trunk/ncc/parsing/MainParser.n
nemerle/trunk/ncc/typing/LocalValue.n
nemerle/trunk/ncc/typing/Typer.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/GotoInfo.n
Modified: nemerle/trunk/ncc/parsing/MainParser.n
==============================================================================
--- nemerle/trunk/ncc/parsing/MainParser.n (original)
+++ nemerle/trunk/ncc/parsing/MainParser.n Tue Dec 5 05:08:14 2006
@@ -1910,7 +1910,7 @@
if (lit != null) lit
else {
def tok = get_token ();
- def loc = tok.Location;
+ mutable loc = tok.Location;
match (tok) {
| Token.Keyword ("void") => PExpr.Void (loc)
@@ -2202,7 +2202,8 @@
match (maybe_parse_ellipsis ()) {
| Some (e) => PExpr.DefFunctions (loc, [Function_decl (null, e)])
| _ =>
- match (peek_token ()) {
+ def token = peek_token ();
+ match (token) {
| Token.Keyword ("_")
| Token.Operator ("$")
| Token.Identifier =>
@@ -2236,7 +2237,7 @@
def define =
match (id) {
- | Splicable.Name (name) => PExpr.Ref (loc, name)
+ | Splicable.Name (name) => PExpr.Ref (token.Location, name)
| Splicable.Expression (e) => PExpr.Spliced (loc, e)
| Splicable.HalfId (e) => PExpr.ToComplete (loc, e)
}
Modified: nemerle/trunk/ncc/typing/LocalValue.n
==============================================================================
--- nemerle/trunk/ncc/typing/LocalValue.n (original)
+++ nemerle/trunk/ncc/typing/LocalValue.n Tue Dec 5 05:08:14 2006
@@ -66,6 +66,12 @@
[Accessor (flags = WantSetter)]
mutable expanded_block_return : bool;
+ mutable name_location : Location;
+ public NameLocation : Location
+ {
+ get { if (name_location == Location.Default) Location else name_location }
+ }
+
[Nemerle.OverrideObjectEquals]
public Equals (other : LocalValue) : bool {
id == other.id
@@ -275,8 +281,15 @@
public this (defined_in : Fun_header, name : string,
ty : TyVar, kind : Kind, is_mutable : bool)
{
+ this(defined_in, name, Location.Default, ty, kind, is_mutable);
+ }
+
+ public this (defined_in : Fun_header, name : string, name_location : Location,
+ ty : TyVar, kind : Kind, is_mutable : bool)
+ {
this.defined_in = defined_in;
this.name = name;
+ this.name_location = name_location;
this.ty = ty;
this.kind = kind;
this.is_mutable = is_mutable;
Modified: nemerle/trunk/ncc/typing/Typer.n
==============================================================================
--- nemerle/trunk/ncc/typing/Typer.n (original)
+++ nemerle/trunk/ncc/typing/Typer.n Tue Dec 5 05:08:14 2006
@@ -465,13 +465,18 @@
expr.Type
}
-
DefineLocal (name : PT.Name, ty : TyVar,
kind : LocalValue.Kind, is_mutable : bool) : LocalValue
{
LocalValue (current_fun, name.Id, ty, kind, is_mutable)
}
+ DefineLocal (name : PT.Name, name_location : Location, ty : TyVar,
+ kind : LocalValue.Kind, is_mutable : bool) : LocalValue
+ {
+ LocalValue (current_fun, name.Id, name_location, ty, kind, is_mutable)
+ }
+
public AddRedirection (name : PT.Name, subst : PT.PExpr) : void
{
def kind = LocalValue.Kind.MacroRedirection (subst);
@@ -1149,16 +1154,16 @@
| PT.PExpr.DefMutable (x, null) =>
DoType (PT.PExpr.DefMutable (x, <[ $(TExpr.DefaultValue (FreshTyVar ()) : typed) ]>), expected, is_toplevel_in_seq)
- | PT.PExpr.DefMutable (PT.PExpr.Ref (name), val)
- | PT.PExpr.Define (PT.PExpr.Ref (name), val) =>
+ | PT.PExpr.DefMutable (PT.PExpr.Ref as name, val)
+ | PT.PExpr.Define (PT.PExpr.Ref as name, val) =>
def is_mutable = expression is PT.PExpr.DefMutable;
if (Expect (expected, InternalType.Void, "definition ``result''"))
if (is_toplevel_in_seq)
- TypeLocalDefinition (is_mutable, name, val)
+ TypeLocalDefinition (is_mutable, name.name, name.Location, val)
else
try {
PushLocals ();
- TypeLocalDefinition (is_mutable, name, val)
+ TypeLocalDefinition (is_mutable, name.name, name.Location, val)
} finally {
PopLocals ()
}
@@ -1787,6 +1792,11 @@
#region ,,def''
TypeLocalDefinition (is_mutable : bool, name : PT.Name, val : PT.PExpr) : TExpr.DefValIn
{
+ TypeLocalDefinition (is_mutable, name, Location.Default, val)
+ }
+
+ TypeLocalDefinition (is_mutable : bool, name : PT.Name, name_location : Location, val : PT.PExpr) : TExpr.DefValIn
+ {
// check for mutable symbol redefinitions
match (local_context.FindLocal (name)) {
| Some (l) =>
@@ -1816,7 +1826,7 @@
tv'.ForceProvide (tv);
(ImplicitCast (val, tv'), tv')
} else (val, tv);
- def decl = DefineLocal (name, decl_ty,
+ def decl = DefineLocal (name, name_location, decl_ty,
LocalValue.Kind.Plain (),
is_mutable);
AddLocal (name, decl);
@@ -1880,6 +1890,7 @@
def parents = current_fun :: current_fun.GetParents ();
def local =
DefineLocal (name_obj,
+ fn.header.name.Location,
fun_type,
LocalValue.Kind.Function (header, parents),
is_mutable = false);
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/GotoInfo.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/GotoInfo.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/GotoInfo.n Tue Dec 5 05:08:14 2006
@@ -95,7 +95,7 @@
public this(value : LocalValue)
{
- this(value.Location);
+ this(value.NameLocation)
}
public this(value : LocalValue, usageType : UsageType)
More information about the svn
mailing list