C# Class Mono.CSharp.Constant

Base class for constants and literals.
Inheritance: Mono.CSharp.Expression
显示文件 Open project: vargaz/mono Class Usage Examples

Public Methods

Method Description
Clone ( CloneContext clonectx ) : Mono.CSharp.Expression
ContainsEmitWithAwait ( ) : bool
ConvertExplicitly ( bool in_checked_context, System.TypeSpec target_type ) : Constant

Maybe ConvertTo name is better. It tries to convert `this' constant to target_type. It throws OverflowException

ConvertImplicitly ( System.TypeSpec type ) : Constant
CreateConstantFromValue ( System.TypeSpec t, object v, Mono.CSharp.Location loc ) : Constant
CreateExpressionTree ( ResolveContext ec ) : Mono.CSharp.Expression
EmitSideEffect ( EmitContext ec ) : void
Error_ValueCannotBeConverted ( ResolveContext ec, System.TypeSpec target, bool expl ) : void
ExtractConstantFromValue ( System.TypeSpec t, object v, Mono.CSharp.Location loc ) : Constant
GetTypedValue ( ) : object
GetValue ( ) : object

This is used to obtain the actual value of the literal cast into an object.

GetValueAsLiteral ( ) : string
GetValueAsLong ( ) : long
ImplicitConversionRequired ( ResolveContext ec, System.TypeSpec type ) : Constant
IsDefaultInitializer ( System.TypeSpec type ) : bool

Need to pass type as the constant can require a boxing and in such case no optimization is possible

MakeExpression ( BuilderContext ctx ) : System.Linq.Expressions.Expression
Reduce ( ResolveContext ec, System.TypeSpec target_type ) : Constant
Resolve ( ResolveContext rc ) : bool
ToString ( ) : string
TryReduce ( ResolveContext rc, System.TypeSpec targetType ) : Constant

Protected Methods

Method Description
CloneTo ( CloneContext clonectx, Mono.CSharp.Expression target ) : void
Constant ( Mono.CSharp.Location loc ) : System
DoResolve ( ResolveContext rc ) : Mono.CSharp.Expression

Private Methods

Method Description
ChangeType ( object value, System.TypeSpec targetType, bool &error ) : object
TryReduceConstant ( ResolveContext ec, System.TypeSpec target_type ) : Constant

Method Details

Clone() public final method

public final Clone ( CloneContext clonectx ) : Mono.CSharp.Expression
clonectx CloneContext
return Mono.CSharp.Expression

CloneTo() protected method

protected CloneTo ( CloneContext clonectx, Mono.CSharp.Expression target ) : void
clonectx CloneContext
target Mono.CSharp.Expression
return void

Constant() protected method

protected Constant ( Mono.CSharp.Location loc ) : System
loc Mono.CSharp.Location
return System

ContainsEmitWithAwait() public method

public ContainsEmitWithAwait ( ) : bool
return bool

ConvertExplicitly() public abstract method

Maybe ConvertTo name is better. It tries to convert `this' constant to target_type. It throws OverflowException
public abstract ConvertExplicitly ( bool in_checked_context, System.TypeSpec target_type ) : Constant
in_checked_context bool
target_type System.TypeSpec
return Constant

ConvertImplicitly() public method

public ConvertImplicitly ( System.TypeSpec type ) : Constant
type System.TypeSpec
return Constant

CreateConstantFromValue() public static method

public static CreateConstantFromValue ( System.TypeSpec t, object v, Mono.CSharp.Location loc ) : Constant
t System.TypeSpec
v object
loc Mono.CSharp.Location
return Constant

CreateExpressionTree() public method

public CreateExpressionTree ( ResolveContext ec ) : Mono.CSharp.Expression
ec ResolveContext
return Mono.CSharp.Expression

DoResolve() protected method

protected DoResolve ( ResolveContext rc ) : Mono.CSharp.Expression
rc ResolveContext
return Mono.CSharp.Expression

EmitSideEffect() public method

public EmitSideEffect ( EmitContext ec ) : void
ec EmitContext
return void

Error_ValueCannotBeConverted() public method

public Error_ValueCannotBeConverted ( ResolveContext ec, System.TypeSpec target, bool expl ) : void
ec ResolveContext
target System.TypeSpec
expl bool
return void

ExtractConstantFromValue() public static method

public static ExtractConstantFromValue ( System.TypeSpec t, object v, Mono.CSharp.Location loc ) : Constant
t System.TypeSpec
v object
loc Mono.CSharp.Location
return Constant

GetTypedValue() public method

public GetTypedValue ( ) : object
return object

GetValue() public abstract method

This is used to obtain the actual value of the literal cast into an object.
public abstract GetValue ( ) : object
return object

GetValueAsLiteral() public abstract method

public abstract GetValueAsLiteral ( ) : string
return string

GetValueAsLong() public abstract method

public abstract GetValueAsLong ( ) : long
return long

ImplicitConversionRequired() public method

public ImplicitConversionRequired ( ResolveContext ec, System.TypeSpec type ) : Constant
ec ResolveContext
type System.TypeSpec
return Constant

IsDefaultInitializer() public method

Need to pass type as the constant can require a boxing and in such case no optimization is possible
public IsDefaultInitializer ( System.TypeSpec type ) : bool
type System.TypeSpec
return bool

MakeExpression() public method

public MakeExpression ( BuilderContext ctx ) : System.Linq.Expressions.Expression
ctx BuilderContext
return System.Linq.Expressions.Expression

Reduce() public method

public Reduce ( ResolveContext ec, System.TypeSpec target_type ) : Constant
ec ResolveContext
target_type System.TypeSpec
return Constant

Resolve() public method

public Resolve ( ResolveContext rc ) : bool
rc ResolveContext
return bool

ToString() public method

public ToString ( ) : string
return string

TryReduce() public method

public TryReduce ( ResolveContext rc, System.TypeSpec targetType ) : Constant
rc ResolveContext
targetType System.TypeSpec
return Constant