summaryrefslogtreecommitdiff
path: root/src/msil/ch/epfl/lamp/compiler/msil/ParameterInfo.java
blob: 877d7aa8a5bc583441122b4602b8fae092899a0b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
 * System.Reflection-like API for access to .NET assemblies (DLL & EXE)
 */


package ch.epfl.lamp.compiler.msil;

/**
 * Discovers the attributes of a parameter and provides access to
 * parameter metadata.
 *
 * @author Nikolay Mihaylov
 * @version 1.0
 */
public class ParameterInfo extends CustomAttributeProvider {

    //##########################################################################

    /** Attributes of the parameter. */
    public final short Attributes;

    /** Name of the parameter. */
    public final String Name;

    /** Type of the parameter. */
    public final Type ParameterType;

    /** Position of the parameter in the parameter list. */
    public final int Position;

    //##########################################################################

    /** Is this an input parameter? */
    public final boolean IsIn() {
        return (Attributes & ParameterAttributes.In) != 0;
    }

    /** Is this an output parameter? */
    public final boolean IsOut() {
        return (Attributes & ParameterAttributes.Out) != 0;
    }

    /** Is this an Lcid? */
    public final boolean IsLcid() {
        return (Attributes & ParameterAttributes.Lcid) != 0;
    }

    /** Is this a return value? */
    public final boolean IsRetval() {
        return (Attributes & ParameterAttributes.Retval) != 0;
    }

    /** Is this an optional parameter? */
    public final boolean IsOptional() {
        return (Attributes & ParameterAttributes.Optional) != 0;
    }

    //##########################################################################
    // members not part of the public Reflection.ParameterInfo interface

    /** Initializes a new instance of the ParameterInfo class. */
    protected ParameterInfo(String name, Type type, int attr, int pos) {
	Name = name;
	ParameterType = type;
	Attributes = (short)attr;
	Position = pos;
    }

    public String toString() {
        return ParameterAttributes.toString(Attributes) + ParameterType + " "
            + Name;
    }

    //##########################################################################

}  // class ParameterInfo