**** Merged from MCS ****
[mono.git] / mcs / gmcs / anonymous.cs
1 //
2 // anonymous.cs: Support for anonymous methods
3 //
4 // Author:
5 //   Miguel de Icaza (miguel@ximain.com)
6 //
7 // (C) 2003 Ximian, Inc.
8 //
9
10 using System;
11 using System.Collections;
12 using System.Reflection;
13 using System.Reflection.Emit;
14
15 namespace Mono.CSharp {
16
17         public class AnonymousMethod : Expression {
18                 // An array list of AnonymousMethodParameter or null
19                 Parameters parameters;
20                 Block block;
21                 
22                 public AnonymousMethod (Parameters parameters, Block block, Location l)
23                 {
24                         this.parameters = parameters;
25                         this.block = block;
26                         loc = l;
27                 }
28
29                 public override Expression DoResolve (EmitContext ec)
30                 {
31                         //
32                         // Set class type, set type
33                         //
34
35                         eclass = ExprClass.Value;
36
37                         //
38                         // This hack means `The type is not accessible
39                         // anywhere', we depend on special conversion
40                         // rules.
41                         // 
42                         type = typeof (AnonymousMethod);
43                         return this;
44                 }
45
46                 public override void Emit (EmitContext ec)
47                 {
48                         // nothing, as we only exist to not do anything.
49                 }
50         }
51 }
52