summaryrefslogtreecommitdiff
path: root/BCT/BytecodeTranslator/MetadataTraverser.cs
diff options
context:
space:
mode:
authorGravatar Unknown <t-espave@A3479886.redmond.corp.microsoft.com>2011-06-09 16:23:47 -0700
committerGravatar Unknown <t-espave@A3479886.redmond.corp.microsoft.com>2011-06-09 16:23:47 -0700
commit784a683b04ac390c1660a714e82720a172c5af1b (patch)
tree249766c90201d3dbb1bee79bcf78a4d74ce41740 /BCT/BytecodeTranslator/MetadataTraverser.cs
parent85b0325b1134ff7070d3e71c965d48a6bf1007c6 (diff)
solved
-- conflict between int and short -- method calls type definitions -- exception returning outvar count (?) -- nested addressing issue in parameters -- enum arguments as literals -- initially declared boogie procedures are public now
Diffstat (limited to 'BCT/BytecodeTranslator/MetadataTraverser.cs')
-rw-r--r--BCT/BytecodeTranslator/MetadataTraverser.cs34
1 files changed, 20 insertions, 14 deletions
diff --git a/BCT/BytecodeTranslator/MetadataTraverser.cs b/BCT/BytecodeTranslator/MetadataTraverser.cs
index 5b61a6ca..eb1aa8c5 100644
--- a/BCT/BytecodeTranslator/MetadataTraverser.cs
+++ b/BCT/BytecodeTranslator/MetadataTraverser.cs
@@ -326,20 +326,26 @@ namespace BytecodeTranslator {
var mdc = c as IMetadataConstant;
if (mdc != null) {
object o;
- switch (mdc.Type.TypeCode) {
- case PrimitiveTypeCode.Boolean:
- o = (bool)mdc.Value ? Bpl.Expr.True : Bpl.Expr.False;
- break;
- case PrimitiveTypeCode.Int32:
- var lit = Bpl.Expr.Literal((int)mdc.Value);
- lit.Type = Bpl.Type.Int;
- o = lit;
- break;
- case PrimitiveTypeCode.String:
- o = mdc.Value;
- break;
- default:
- throw new InvalidCastException("Invalid metadata constant type");
+ if (mdc.Type.IsEnum) {
+ var lit = Bpl.Expr.Literal((int) mdc.Value);
+ lit.Type = Bpl.Type.Int;
+ o = lit;
+ } else {
+ switch (mdc.Type.TypeCode) {
+ case PrimitiveTypeCode.Boolean:
+ o = (bool) mdc.Value ? Bpl.Expr.True : Bpl.Expr.False;
+ break;
+ case PrimitiveTypeCode.Int32:
+ var lit = Bpl.Expr.Literal((int) mdc.Value);
+ lit.Type = Bpl.Type.Int;
+ o = lit;
+ break;
+ case PrimitiveTypeCode.String:
+ o = mdc.Value;
+ break;
+ default:
+ throw new InvalidCastException("Invalid metadata constant type");
+ }
}
args[argIndex++] = o;
}