[svn] r6576: nemerle/trunk: macros/Internals.n macros/Memoize.n
macros/Nemerle.n macros/Profiling.n macros...
VladD2
svnadmin at nemerle.org
Fri Aug 25 21:58:09 CEST 2006
Log:
1. Fix bodies locations in methods with modified body.
2. Fix parsing inline comments in LexerString.
Author: VladD2
Date: Fri Aug 25 21:57:51 2006
New Revision: 6576
Modified:
nemerle/trunk/macros/Internals.n
nemerle/trunk/macros/Memoize.n
nemerle/trunk/macros/Nemerle.n
nemerle/trunk/macros/Profiling.n
nemerle/trunk/macros/assertions.n
nemerle/trunk/macros/compiler.n
nemerle/trunk/macros/concurrency.n
nemerle/trunk/macros/core.n
nemerle/trunk/ncc/generation/Typer3.n
nemerle/trunk/ncc/parsing/Lexer.n
nemerle/trunk/ncc/testsuite/positive/macrolib.n
nemerle/trunk/ncc/typing/Typer.n
nemerle/trunk/tools/contracts/Nemerle.Contracts.n
Modified: nemerle/trunk/macros/Internals.n
==============================================================================
--- nemerle/trunk/macros/Internals.n (original)
+++ nemerle/trunk/macros/Internals.n Fri Aug 25 21:57:51 2006
@@ -116,7 +116,7 @@
def inject (ctor) {
def ctor = ctor :> MethodBuilder;
def bd = ctor.Body;
- def nbody =
+ def nbody = Util.locate(ctor.Body.Location,
match (bd) {
| <[ {.. $(elems) } ]> =>
// initializer macro is a syntactic placeholder for our initialization
@@ -142,7 +142,8 @@
}
// this is our first initializer
| _ => <[ Nemerle.InternalMacros.initializer ($init); $bd ]>
- };
+ });
+
ctor.Body = nbody
};
if (!is_static && t.IsValueType)
@@ -173,15 +174,29 @@
def unique = t.ParsedName.NewName (Util.tmpname (fld_name.Id));
def set = p.GetSetter () :> MethodBuilder;
when (set != null)
- set.Body = <[ InternalMacros.RedirectName ($(fld_name : name),
+ {
+ def newBody = Util.locate(set.Body.Location,
+ <[
+ InternalMacros.RedirectName ($(fld_name : name),
$(unique : name),
- $(set.Body)) ]>;
+ $(set.Body))
+ ]>);
+
+ set.Body = newBody;
+ }
def get = p.GetGetter () :> MethodBuilder;
when (get != null)
- get.Body = <[ InternalMacros.RedirectName ($(fld_name : name),
+ {
+ def newBody = Util.locate(get.Body.Location,
+ <[
+ InternalMacros.RedirectName ($(fld_name : name),
$(unique : name),
- $(get.Body)) ]>;
+ $(get.Body))
+ ]>);
+
+ get.Body = newBody;
+ }
when (p.Attributes %&& NemerleAttributes.Static)
val.Attributes |= NemerleAttributes.Static;
@@ -207,15 +222,29 @@
def set = p.GetRemover ();
when (set != null)
- set.Body = <[ InternalMacros.RedirectName ($(fld_name : name),
+ {
+ def newBody = Util.locate(set.Body.Location,
+ <[
+ InternalMacros.RedirectName ($(fld_name : name),
$(unique : name),
- $(set.Body)) ]>;
+ $(set.Body))
+ ]>);
+
+ set.Body = newBody;
+ }
def get = p.GetAdder ();
when (get != null)
- get.Body = <[ InternalMacros.RedirectName ($(fld_name : name),
+ {
+ def newBody = Util.locate(get.Body.Location,
+ <[
+ InternalMacros.RedirectName ($(fld_name : name),
$(unique : name),
- $(get.Body)) ]>;
+ $(get.Body))
+ ]>);
+
+ get.Body = newBody;
+ }
when (p.Attributes %&& NemerleAttributes.Static)
val.Attributes |= NemerleAttributes.Static;
Modified: nemerle/trunk/macros/Memoize.n
==============================================================================
--- nemerle/trunk/macros/Memoize.n (original)
+++ nemerle/trunk/macros/Memoize.n Fri Aug 25 21:57:51 2006
@@ -55,7 +55,8 @@
| _ => () // for backwards compatibility
}
def parms = meth.GetParameters ();
- match (parms) {
+ def newBody = Util.locate(meth.Body.Location, match (parms)
+ {
| [] =>
def cached_value = Macros.NewSymbol ("cached_value");
def is_cached = Macros.NewSymbol ("is_cached");
@@ -68,7 +69,7 @@
tb.Define (<[ decl: static mutable $(is_cached : name) : bool; ]>)
| _ => () // unreachable
}
- meth.Body = <[
+ <[
when (! $(is_cached : name)) {
$(cached_value : name) = $(meth.Body);
$(is_cached : name) = true;
@@ -90,7 +91,7 @@
<[ (.. $(List.Map (parms, fun (p) { <[ $(p.name : usesite) ]> })) )]>
else
<[ $(prm.name : usesite) ]>;
- meth.Body = <[
+ <[
when ($(cache : name) == null)
// Can't this initialization by done without the additional check each time ?
$(cache : name) = Hashtable ();
@@ -107,6 +108,8 @@
ret
}
]>;
- }
+ });
+
+ meth.Body = newBody;
}
}
Modified: nemerle/trunk/macros/Nemerle.n
==============================================================================
--- nemerle/trunk/macros/Nemerle.n (original)
+++ nemerle/trunk/macros/Nemerle.n Fri Aug 25 21:57:51 2006
@@ -36,10 +36,16 @@
macro Lazy (_ : TypeBuilder, meth : ParsedMethod, parm : ParsedParameter)
{
def unique = parm.ParsedName.NewName (Util.tmpname (parm.ParsedName.Id));
- meth.Body = <[ InternalMacros.RedirectName ($(parm.ParsedName : name),
+ def newBody = Util.locate(meth.Body.Location,
+ <[
+ InternalMacros.RedirectName ($(parm.ParsedName : name),
$(unique : name).Value,
- $(meth.Body)) ]>;
+ $(meth.Body))
+ ]>);
+
+ meth.Body = newBody;
parm.name = PT.Splicable.Name (unique);
+ //TODO: May be need correct location of parm.ty.
parm.ty = <[ Nemerle.LazyValue [$(parm.ty)] ]>;
}
Modified: nemerle/trunk/macros/Profiling.n
==============================================================================
--- nemerle/trunk/macros/Profiling.n (original)
+++ nemerle/trunk/macros/Profiling.n Fri Aug 25 21:57:51 2006
@@ -182,7 +182,8 @@
{
when (dumper == null)
FinishUp (_current_type.GlobalEnv);
- method.Body = dumper;
+ def newBody = Util.locate(method.Body.Location, dumper);
+ method.Body = newBody;
}
[Nemerle.MacroUsage (Nemerle.MacroPhase.BeforeInheritance,
@@ -190,7 +191,10 @@
Inherited = false, AllowMultiple = false)]
macro Profile (current_type : TypeBuilder, method : ParsedMethod)
{
- method.Body = Wrap (current_type.FullName + "." + method.Name, method.Body)
+ def newBody = Util.locate(method.Body.Location,
+ Wrap (current_type.FullName + "." + method.Name, method.Body));
+
+ method.Body = newBody;
}
macro @profile (id, body)
Modified: nemerle/trunk/macros/assertions.n
==============================================================================
--- nemerle/trunk/macros/assertions.n (original)
+++ nemerle/trunk/macros/assertions.n Fri Aug 25 21:57:51 2006
@@ -63,11 +63,14 @@
{
def assertion = <[ $(p.ParsedName : name) : object != null ]>;
- m.Body = <[
+ def loc = m.Body.Location;
+ def newBody = Util.locate(loc, <[
assert ($assertion, "The ``NotNull'' contract of parameter `" +
$(p.ParsedName.Id : string) + "' has been violated.");
$(m.Body)
- ]>
+ ]>);
+
+ m.Body = newBody;
}
/// Example: foo ([Requires (value != 4)] i : int) : void { ... }
@@ -77,6 +80,7 @@
macro Requires (_ : TypeBuilder, m : ParsedMethod, p : ParsedParameter, assertion, other = null)
syntax ("requires", assertion, Optional ("otherwise", other))
{
+ def loc = m.Body.Location;
def check =
if (other != null)
<[ unless ($assertion) $other ]>
@@ -84,11 +88,12 @@
<[ assert ($assertion, "The ``Requires'' contract of parameter `" +
$(p.ParsedName.Id : string) + "' has been violated.") ]>;
- m.Body = <[
+ def newBody = Util.locate(loc, <[
def $("value" : usesite) = $(p.ParsedName : name);
$check;
$(m.Body)
- ]>
+ ]>);
+ m.Body = newBody;
}
/** Enforces given boolean condition at method invocation beginning.
@@ -121,10 +126,12 @@
<[ assert ($assertion, "The ``Requires'' contract of method `" +
$(m.ParsedName.Id : string) + "' has been violated.") ]>;
- m.Body = <[
+ def newBody = Util.locate(m.Body.Location, <[
$check;
$(m.Body)
- ]>
+ ]>);
+
+ m.Body = newBody;
}
/** Enforces given boolean condition at the end of method invocation.
@@ -156,17 +163,20 @@
<[ assert ($assertion, "The ``Ensures'' contract of method `" +
$(m.Name : string) + "' has been violated.") ]>;
+ def newBody = Util.locate(m.Body.Location,
if (m.ReturnType.Equals (MType.Void ()))
- m.Body = <[
+ <[
$(m.Body);
$check;
]>
- else {
- m.Body = <[
+ else
+ <[
def $("value" : usesite) = $(m.Body);
$check;
$("value" : usesite);
- ]>
+ ]>);
+
+ m.Body = newBody;
}
}
@@ -201,10 +211,11 @@
def methods = ty.GetMethods (BindingFlags.Public %|
BindingFlags.Instance %|
BindingFlags.DeclaredOnly);
- foreach (m :> MethodBuilder in methods) {
- m.Body = <[
- InvariantExpose (this, $(m.Body))
- ]>
+ foreach (m :> MethodBuilder in methods)
+ {
+ def newBody = Util.locate(m.Body.Location,
+ <[ InvariantExpose (this, $(m.Body)) ]>);
+ m.Body = newBody;
};
ty.Define ( <[ decl:
public mutable _N_invariant_lock : bool;
@@ -217,16 +228,18 @@
]> );
| Some (m) =>
def m = m :> MethodBuilder;
- m.Body = <[
+ def newBody = Util.locate(m.Body.Location, <[
$(m.Body);
assert ($body, "The class invariant has been violated.");
- ]>
+ ]>);
+ m.Body = newBody;
}
}
macro InvariantExpose (exposed, body)
- syntax ("expose", "(", exposed, ")", body) {
- def tbody = Macros.ImplicitCTX ().TypeExpr (body);
+ syntax ("expose", "(", exposed, ")", body)
+ {
+ def tbody = Nemerle.Macros.ImplicitCTX ().TypeExpr (body);
def default = Macros.DefaultValueOfType (tbody.ty.Fix ());
<[
Modified: nemerle/trunk/macros/compiler.n
==============================================================================
--- nemerle/trunk/macros/compiler.n (original)
+++ nemerle/trunk/macros/compiler.n Fri Aug 25 21:57:51 2006
@@ -143,7 +143,7 @@
Nemerle.MacroTargets.Method)]
macro PossiblyLooping (_ : TypeBuilder, m : ParsedMethod, solver)
{
- m.Body = <[
+ def newBody = Util.locate(m.Body.Location, <[
if ($solver.CanEnterPossiblyLooping ())
try {
$(m.Body)
@@ -151,6 +151,8 @@
$solver.LeavePossiblyLooping ()
}
else false
- ]>
+ ]>);
+
+ m.Body = newBody;
}
}
Modified: nemerle/trunk/macros/concurrency.n
==============================================================================
--- nemerle/trunk/macros/concurrency.n (original)
+++ nemerle/trunk/macros/concurrency.n Fri Aug 25 21:57:51 2006
@@ -43,11 +43,12 @@
module Helper {
public MakeAsync (expr : PT.PExpr) : PT.PExpr
{
+ Util.locate (expr.Location,
<[
def threadBody () { $expr };
def thread = Thread (ThreadStart (threadBody));
thread.Start ();
- ]>
+ ]>)
}
AddInit (t : TypeBuilder, is_static : bool, init : PT.PExpr) : void
@@ -71,7 +72,7 @@
{
def ctor = ctor :> MethodBuilder;
def bd = ctor.Body;
- ctor.Body =
+ def newBody = Util.locate (ctor.Body.Location,
if (after) <[ $bd; $init ]>
else match (bd) {
| <[ {.. $(e :: rest) } ]> =>
@@ -81,7 +82,9 @@
| _ => <[ $init; $bd ]>
}
| _ => <[ $init; $bd ]>
- }
+ });
+
+ ctor.Body = newBody;
}
match (mems) {
@@ -129,7 +132,7 @@
match (tb.LookupMember ("__Chord_Scan")) {
| [m] =>
def m = (m :> MethodBuilder);
- m.Body = <[
+ def newBody = Util.locate (m.Body.Location, <[
if (this.__Chord_Mask.Match ($(mask : name)))
{
this.$(queue : name).Wakeup ()
@@ -138,7 +141,10 @@
{
$(m.Body)
}
- ]>
+ ]>);
+
+ m.Body = newBody;
+
| _ =>
assert (false)
}
@@ -340,7 +346,7 @@
later ()
]>);
- m.Body = <[
+ def newBody = Util.locate (m.Body.Location, <[
def later ()
{
this.$(qsymb : name).Yield (this.__Chord_Lock);
@@ -363,7 +369,9 @@
{
now ()
}
- ]>
+ ]>);
+
+ m.Body = newBody;
}
}
#endregion Helper module of Nemerle.Concurrency implementation
@@ -396,7 +404,8 @@
{
// we temporarily set body of method, so methods with abstract like
// body could be allowed
- m.Body = <[ () ]>
+ def newBody = Util.locate(m.Body.Location, <[ () ]>);
+ m.Body = newBody;
}
@@ -405,12 +414,14 @@
Inherited = true)]
macro ChordMember (tb : TypeBuilder, m : MethodBuilder)
{
+ def loc = m.Body.Location;
Helper.CreateChordCommonMembers (tb);
def qsymb = Helper.CreateChordMethodQueue (tb, m);
def methodValue = Helper.CreateChordMaskMethodValue (tb, m);
def paramslist = List.FoldRight (m.GetParameters (), [], fun (p : TT.Fun_parm, acc) {
<[ $(p.name : usesite) ]> :: acc
});
+
match (paramslist) {
| [] =>
m.Body = <[
@@ -429,7 +440,8 @@
this.$(qsymb : name).Add ($(tuple))
]>
}
- m.Body = <[
+
+ def newBody = Util.locate(loc, <[
lock (this.__Chord_Lock)
{
$(m.Body);
@@ -439,7 +451,9 @@
this.__Chord_Scan ()
}
}
- ]>
+ ]>);
+
+ m.Body = newBody;
}
// FIXME: if one of the members is declared after the Chord body, things can go wrong.
Modified: nemerle/trunk/macros/core.n
==============================================================================
--- nemerle/trunk/macros/core.n (original)
+++ nemerle/trunk/macros/core.n Fri Aug 25 21:57:51 2006
@@ -719,13 +719,16 @@
Nemerle.MacroTargets.Method,
Inherited = true, AllowMultiple = false)]
macro Hygienic (_ : TypeBuilder, m : ParsedMethod) {
- m.Body = <[
+ def newBody = Util.locate(m.Body.Location,
+ <[
def colors = ManagerClass.Instance.MacroColors;
colors.PushNewColor (colors.UseColor, colors.UseContext);
def result = $(m.Body);
colors.PopColor ();
result
- ]>;
+ ]>);
+
+ m.Body = newBody;
}
@@ -1080,11 +1083,13 @@
}
};
def bod = Macros.TraverseExpr (None (), m.Body, false, add);
- m.Body = <[
+ def newBody = Util.locate(m.Body.Location, <[
def $("_file" : usesite) = $(m.Body.loc.File : string);
def $("_method" : usesite) = $(m.Name : string);
$bod;
- ]>
+ ]>);
+
+ m.Body = newBody;
}
@@ -1123,10 +1128,12 @@
});
def message = "Method `" + m.name.GetName ().Id + "' in type `" +
t.FullName + "' is not implemented yet.";
- m.Body = <[
+ def newBody = Util.locate(m.Body.Location, <[
{ ..$ignores };
throw System.NotImplementedException ($(message : string))
- ]>
+ ]>);
+
+ m.Body = newBody;
}
[Nemerle.MacroUsage (Nemerle.MacroPhase.BeforeInheritance,
@@ -1167,9 +1174,11 @@
<[ $(x.name.GetName () : name) ]>
});
- m.Body = <[
+ def newBody = Util.locate(m.Body.Location, <[
$this_expr . $(meth : name) ( .. $parms )
- ]>
+ ]>);
+
+ m.Body = newBody;
}
}
Modified: nemerle/trunk/ncc/generation/Typer3.n
==============================================================================
--- nemerle/trunk/ncc/generation/Typer3.n (original)
+++ nemerle/trunk/ncc/generation/Typer3.n Fri Aug 25 21:57:51 2006
@@ -870,7 +870,8 @@
def assigns = meth.Body :: parm_field_names.Map (fun (name) {
<[ this . $(name : dyn) = other . $(name : dyn) ]>
});
- meth.Body = <[ { .. $assigns } ]>;
+ def newBody = Util.locate(meth.Body.Location, <[ { .. $assigns } ]>);
+ meth.Body = newBody;
}
current_local_fun.body = FunBody.Typed (PlainRef (current_closure));
Modified: nemerle/trunk/ncc/parsing/Lexer.n
==============================================================================
--- nemerle/trunk/ncc/parsing/Lexer.n (original)
+++ nemerle/trunk/ncc/parsing/Lexer.n Fri Aug 25 21:57:51 2006
@@ -1615,8 +1615,10 @@
();
}
catch { _ is LexerBase.Error => () };
- // pass whitespace, so next read would be eof checked
- ' '
+
+ white_beginning = true;
+
+ ' ' // pass whitespace, so next read would be eof checked
| '*' =>
// multiline comment
Modified: nemerle/trunk/ncc/testsuite/positive/macrolib.n
==============================================================================
--- nemerle/trunk/ncc/testsuite/positive/macrolib.n (original)
+++ nemerle/trunk/ncc/testsuite/positive/macrolib.n Fri Aug 25 21:57:51 2006
@@ -278,7 +278,10 @@
macro MyRequire (_ : TypeBuilder, m : ParsedMethod, expr, thor = null)
syntax ("requ", expr, Optional ("otherwise", thor))
{
- m.Body = <[ assert ($expr, "requ"); $(if (thor != null) <[ $thor ]> else m.Body) ]>
+ def newBody = Util.locate(m.Body.Location,
+ <[ assert ($expr, "requ"); $(if (thor != null) <[ $thor ]> else m.Body) ]>);
+
+ m.Body = newBody;
}
[Nemerle.MacroUsage (Nemerle.MacroPhase.BeforeInheritance, Nemerle.MacroTargets.Method,
@@ -286,8 +289,10 @@
macro MyAsync (_ : TypeBuilder, m : ParsedMethod)
syntax ("asyn")
{
- m.Body = <[ System.Console.WriteLine ("I could be asynced");
- $(m.Body); ]>
+ def newBody = Util.locate(m.Body.Location,
+ <[ System.Console.WriteLine ("I could be asynced"); $(m.Body); ]>);
+
+ m.Body = newBody;
}
[Nemerle.MacroUsage (Nemerle.MacroPhase.WithTypedMembers, Nemerle.MacroTargets.Method,
@@ -295,8 +300,11 @@
macro MyAsync (_ : TypeBuilder, m : MethodBuilder)
syntax ("asyn")
{
- m.Body = <[ System.Console.WriteLine ("I could be asynced with members");
- $(m.Body); ]>
+ def newBody = Util.locate(m.Body.Location,
+ <[ System.Console.WriteLine ("I could be asynced with members");
+ $(m.Body); ]>);
+
+ m.Body = newBody;
}
macro MyExprAsync (expr)
Modified: nemerle/trunk/ncc/typing/Typer.n
==============================================================================
--- nemerle/trunk/ncc/typing/Typer.n (original)
+++ nemerle/trunk/ncc/typing/Typer.n Fri Aug 25 21:57:51 2006
@@ -169,7 +169,8 @@
def errcnt = Message.ErrorCount;
// just in case
put_in_error_mode ();
- m.Body = WrapYieldingFunction (m.Body);
+ def newBody = Util.locate(m.Body.Location, WrapYieldingFunction (m.Body));
+ m.Body = newBody;
inside_yielding_function = true;
when (errcnt == Message.ErrorCount) {
assert (solver.IsTopLevel);
Modified: nemerle/trunk/tools/contracts/Nemerle.Contracts.n
==============================================================================
--- nemerle/trunk/tools/contracts/Nemerle.Contracts.n (original)
+++ nemerle/trunk/tools/contracts/Nemerle.Contracts.n Fri Aug 25 21:57:51 2006
@@ -138,11 +138,14 @@
def init =
ty.LookupMember ("SpecSharp::InitGuardSets").Head :> MethodBuilder;
- init.Body = <[
+ def newBody = Util.locate(init.Body.Location,
+ <[
$(init.Body);
this.$("SpecSharp::FrameGuard" : dyn).AddRepFrame (
this, typeof ( $(ty.BaseType.GetMemType () : typed) ) );
- ]>
+ ]>);
+
+ init.Body = newBody;
}
mutable methods = ty.GetMethods (BindingFlags.Public %|
@@ -162,7 +165,8 @@
foreach (m :> MethodBuilder in methods)
{
- m.Body = <[
+ def newBody = Util.locate(m.Body.Location,
+ <[
//check whether the checked exceptions are declared at method's signature
//CheckExceptions ();
@@ -177,7 +181,9 @@
}
$(m.Body)
- ]>;
+ ]>);
+
+ m.Body = newBody;
}
def instanceCtors = ty.GetConstructors (BindingFlags.Public %|
@@ -185,7 +191,8 @@
foreach (c :> MethodBuilder in instanceCtors)
{
- c.Body = <[
+ def newBody = Util.locate(m.Body.Location,
+ <[
//check whether the checked exceptions are declared at method's signature
//CheckExceptions ();
@@ -201,7 +208,9 @@
| _ is MC.ContractMarkerException => throw
}
this.$("SpecSharp::FrameGuard" : dyn).EndWriting ()
- ]>;
+ ]>);
+
+ c.Body = newBody;
}
mutable staticCtors = ty.GetConstructors (
@@ -220,7 +229,8 @@
foreach (c :> MethodBuilder in staticCtors)
{
- c.Body = <[
+ def newBody = Util.locate(m.Body.Location,
+ <[
//check whether the checked exceptions are declared at method's signature
//CheckExceptions ();
@@ -237,7 +247,9 @@
}
$(c.Body);
- ]>;
+ ]>);
+
+ m.Body = newBody;
}
}
@@ -273,11 +285,13 @@
macro Requires (_ : TypeBuilder, m : ParsedMethod, assertion, other = null)
syntax ("requires", assertion, Optional("otherwise", other))
{
- m.Body =
+ def newBody = Util.locate(m.Body.Location,
<[
__Requires ($assertion, $other);
$(m.Body)
- ]>
+ ]>);
+
+ m.Body = newBody;
}
macro __Requires (assertion, other = null)
@@ -407,12 +421,14 @@
macro Ensures (_ : TypeBuilder, m : ParsedMethod, assertion, other = null)
syntax ("ensures", assertion, Optional("otherwise", other))
{
- m.Body =
+ def newBody = Util.locate(m.Body.Location,
<[
maybeHasOld ($assertion);
$(m.Body);
__Ensures ($assertion, $other)
- ]>;
+ ]>);
+
+ m.Body = newBody;
}
macro __Ensures (assertion, other)
@@ -550,7 +566,8 @@
Inherited = true, AllowMultiple = false)]
macro NotNull (_ : TypeBuilder, m : ParsedMethod, p : ParsedParameter)
{
- m.Body = <[
+ def newBody = Util.locate(m.Body.Location,
+ <[
try
{
when ($(p.ParsedName : name) == null)
@@ -562,7 +579,9 @@
}
$(m.Body)
- ]>
+ ]>);
+
+ m.Body = newBody;
}
[Nemerle.MacroUsage (Nemerle.MacroPhase.WithTypedMembers,
@@ -582,10 +601,13 @@
def result = Macros.NewSymbol ("result");
- m.Body = <[
+ def newBody = Util.locate(m.Body.Location,
+ <[
def $(result : name) = { $(m.Body) };
$(result : name) : $(m.fun_header.ret_type : typed)
- ]>;
+ ]>);
+
+ m.Body = newBody;
}
[Nemerle.MacroUsage (Nemerle.MacroPhase.WithTypedMembers,
@@ -613,17 +635,21 @@
getter.fun_header.ret_type_optional_modifiers ::= typeof (MC.NonNullType);
def result = Macros.NewSymbol ("result");
- getter.Body = <[
+ def newBody = Util.locate(getter.Body.Location,
+ <[
def $(result : name) = MC.NonNullType.IsNonNullGeneric ($(getter.Body));
$(result : name)// : $(getter.fun_header.ret_type : typed)
- ]>;
+ ]>);
+
+ getter.Body = newBody;
}
unless (setter == null)
{
setter.fun_header.parms.Head.optional_modifiers ::= typeof (MC.NonNullType);
- setter.Body = <[
+ def newBody = Util.locate(getter.Body.Location,
+ <[
try
{
when ( $("value" : dyn) == null)
@@ -635,7 +661,9 @@
}
$(setter.Body)
- ]>
+ ]>);
+
+ setter.Body = newBody;
}
}
@@ -916,7 +944,8 @@
macro Throws (_ : TypeBuilder, m : MethodBuilder, exc)
syntax ("throws", exc)
{
- m.Body = <[ AddException ($exc); $(m.Body); ]>;
+ def newBody = Util.locate(m.Body.Location, <[ AddException ($exc); $(m.Body); ]>);
+ m.Body = newBody;
}
/**
More information about the svn
mailing list