2002-11-08 Miguel de Icaza <miguel@ximian.com>
authorMiguel de Icaza <miguel@gnome.org>
Fri, 8 Nov 2002 05:36:14 +0000 (05:36 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Fri, 8 Nov 2002 05:36:14 +0000 (05:36 -0000)
* expression.cs: tiny optimization, avoid calling IsConstant,
because it effectively performs the lookup twice.

svn path=/trunk/mcs/; revision=8881

mcs/mcs/ChangeLog
mcs/mcs/expression.cs

index b765ed610a8fb7e156198d6fb7704457a33dc36c..0a949e44181147c5dd2e679418826d98a8926fb2 100755 (executable)
@@ -1,3 +1,8 @@
+2002-11-08  Miguel de Icaza  <miguel@ximian.com>
+
+       * expression.cs: tiny optimization, avoid calling IsConstant,
+       because it effectively performs the lookup twice.
+
 2002-11-06  Miguel de Icaza  <miguel@ximian.com>
 
        But a bogus return here to keep the semantics of the old code
index 7004640a1b64e5b82daf3c31eac9acd9d0f7752d..46d12259ab97ceb165ffe3cec0a9bb09ecf5a06e 100755 (executable)
@@ -2859,10 +2859,10 @@ namespace Mono.CSharp {
                public override Expression DoResolve (EmitContext ec)
                {
                        VariableInfo vi = VariableInfo;
-
-                       if (Block.IsConstant (Name)) {
-                               Expression e = Block.GetConstantExpression (Name);
-
+                       Expression e;
+                       
+                       e = Block.GetConstantExpression (Name);
+                       if (e != null) {
                                vi.Used = true;
                                return e;
                        }