[svn] r6819: vs-plugin/trunk/Nemerle.Compiler.Utils:
Nemerle.Compiler.Utils.nproj Nemerle.Completion2/Code...
IT
svnadmin at nemerle.org
Thu Nov 2 06:06:21 CET 2006
Log:
Quick tips for enumerators.
Author: IT
Date: Thu Nov 2 06:06:19 2006
New Revision: 6819
Modified:
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Compiler.Utils.nproj
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ExprFinder.n
vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/QuickTipInfo.n
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Compiler.Utils.nproj
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Compiler.Utils.nproj (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Compiler.Utils.nproj Thu Nov 2 06:06:19 2006
@@ -9,6 +9,7 @@
<Folder Include="Nemerle.Completion2\Engine\" />
<Folder Include="Nemerle.Completion2\Tests\" />
<Folder Include="Nemerle.Completion2\Tests\Content\" />
+ <Folder Include="Nemerle.Completion2\TextManagement\" />
<Folder Include="Properties\" />
</ItemGroup>
</Project>
\ No newline at end of file
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ExprFinder.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ExprFinder.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/ExprFinder.n Thu Nov 2 06:06:19 2006
@@ -118,6 +118,34 @@
else
tt
+ | Literal(Enum(value, ty, null)) =>
+
+ def members = ty.GetMembers();
+ def field = members.Find(f =>
+ {
+ match (f)
+ {
+ | f is IField when f.IsStatic && f.IsLiteral =>
+
+ match (f.GetValue())
+ {
+ | Integer as val
+ | Literal.Enum(val, _, _) => val.ToString() == value.ToString()
+ | _ => false
+ }
+
+ | _ => false
+ }
+ });
+
+ match (field)
+ {
+ | Some(f) => f
+ | None => expression : object
+ }
+
+ | Literal(Enum(_, _, field)) => _debug(field); field
+
| ConstantObjectRef(_, o : object) // { from : MType.Class; mem : IField; }
| StaticPropertyRef(_, o : object) // { from : MType.Class; prop : IProperty; }
| StaticEventRef (_, o : object) // { from : MType.Class; ev : IEvent; }
@@ -148,7 +176,7 @@
| expr is TExpr => match (expr)
{
| LocalRef(LocalValue where (ValKind = ClosurisedThisPointer)) => expr.Location == _texprLocation
- | TypeConversion => _Debug(obj); true
+ | TypeConversion => true
| Literal => expr.ToString() != PExprName
// | StaticRef => _texprObject is TExpr.Call
| Error => true
@@ -296,7 +324,7 @@
ignore(level);
}
- _Debug[T](o : T) : void
+ _debug[T](o : T) : void
{
_ = o.ToString();
}
Modified: vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/QuickTipInfo.n
==============================================================================
--- vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/QuickTipInfo.n (original)
+++ vs-plugin/trunk/Nemerle.Compiler.Utils/Nemerle.Completion2/CodeModel/QuickTipInfo.n Thu Nov 2 06:06:19 2006
@@ -182,12 +182,15 @@
| _ => ()
}
+ _text += GetDocText(member, member.Location);
+
match (member)
{
- | fb is FieldBuilder when fb.IsLiteral && fb.DeclaringType.IsEnum =>
+ | fb is IField when fb.IsLiteral && fb.DeclaringType.IsEnum =>
- match (fb.const_value)
+ match (fb.GetValue())
{
+ | Enum(Integer(val, is_negative, _), _, _)
| Integer(val, is_negative, _) =>
def toHex(val)
@@ -206,12 +209,12 @@
if (fb.DeclaringType.HasAttribute(manager.InternalType.FlagsAttribute_tc))
{
mutable n = val;
- def fields = fb.DeclaringType.GetMembers(BindingFlags.Static %| BindingFlags.Public);
+ def fields = fb.DeclaringType.GetMembers(BindingFlags.Static);
def fields = fields.Filter(f =>
{
match (f)
{
- | f is FieldBuilder when fb.IsLiteral =>
+ | f is FieldBuilder when f.IsLiteral =>
match (f.const_value)
{
| Integer(f_val, f_is_negative, _) =>
@@ -254,7 +257,7 @@
| _ => ()
}
- _text += GetDocText(member, member.Location) + GetLocationText(member.Location);
+ _text += GetLocationText(member.Location);
}
private SetText(value : LocalValue) : void
More information about the svn
mailing list