internal static void VerifyLocal <TMethodSymbol>(
            this CompilationTestData testData,
            string typeName,
            LocalAndMethod localAndMethod,
            string expectedMethodName,
            string expectedLocalName,
            DkmClrCompilationResultFlags expectedFlags,
            Action <TMethodSymbol> verifyTypeParameters,
            string expectedILOpt,
            bool expectedGeneric,
            string expectedValueSourcePath,
            int expectedValueSourceLine)
            where TMethodSymbol : IMethodSymbol
        {
            Assert.Equal(expectedLocalName, localAndMethod.LocalName);
            Assert.True(expectedMethodName.StartsWith(localAndMethod.MethodName, StringComparison.Ordinal), expectedMethodName + " does not start with " + localAndMethod.MethodName); // Expected name may include type arguments and parameters.
            Assert.Equal(expectedFlags, localAndMethod.Flags);
            var methodData = testData.GetMethodData(typeName + "." + expectedMethodName);

            verifyTypeParameters((TMethodSymbol)methodData.Method);
            if (expectedILOpt != null)
            {
                string actualIL = methodData.GetMethodIL();
                AssertEx.AssertEqualToleratingWhitespaceDifferences(
                    expectedILOpt,
                    actualIL,
                    escapeQuotes: true,
                    expectedValueSourcePath: expectedValueSourcePath,
                    expectedValueSourceLine: expectedValueSourceLine);
            }

            Assert.Equal(((Cci.IMethodDefinition)methodData.Method).CallingConvention, expectedGeneric ? Cci.CallingConvention.Generic : Cci.CallingConvention.Default);
        }
Esempio n. 2
0
 private static DkmClrLocalVariableInfo ToLocalVariableInfo(LocalAndMethod local)
 {
     return(DkmClrLocalVariableInfo.Create(
                local.LocalDisplayName,
                local.LocalName,
                local.MethodName,
                local.Flags,
                DkmEvaluationResultCategory.Data,
                local.GetCustomTypeInfo().ToDkmClrCustomTypeInfo()));
 }
Esempio n. 3
0
        private static DkmClrLocalVariableInfo ToLocalVariableInfo(LocalAndMethod local)
        {
            ReadOnlyCollection <byte> customTypeInfo;
            Guid customTypeInfoId = local.GetCustomTypeInfo(out customTypeInfo);

            return(DkmClrLocalVariableInfo.Create(
                       local.LocalDisplayName,
                       local.LocalName,
                       local.MethodName,
                       local.Flags,
                       DkmEvaluationResultCategory.Data,
                       customTypeInfo.ToCustomTypeInfo(customTypeInfoId)));
        }
Esempio n. 4
0
 private static void VerifyCustomTypeInfo(LocalAndMethod localAndMethod, string expectedName, params byte[] expectedBytes)
 {
     Assert.Equal(localAndMethod.LocalName, expectedName);
     VerifyCustomTypeInfo(localAndMethod.GetCustomTypeInfo(), expectedBytes);
 }
 internal static void VerifyLocal(
     CompilationTestData testData,
     string typeName,
     LocalAndMethod localAndMethod,
     string expectedMethodName,
     string expectedLocalName,
     string expectedLocalDisplayName = null,
     DkmClrCompilationResultFlags expectedFlags = DkmClrCompilationResultFlags.None,
     string expectedILOpt = null,
     bool expectedGeneric = false,
     [CallerFilePath]string expectedValueSourcePath = null,
     [CallerLineNumber]int expectedValueSourceLine = 0)
 {
     ExpressionCompilerTestHelpers.VerifyLocal<MethodSymbol>(
         testData,
         typeName,
         localAndMethod,
         expectedMethodName,
         expectedLocalName,
         expectedLocalDisplayName ?? expectedLocalName,
         expectedFlags,
         VerifyTypeParameters,
         expectedILOpt,
         expectedGeneric,
         expectedValueSourcePath,
         expectedValueSourceLine);
 }
Esempio n. 6
0
 private static void VerifyCustomTypeInfo(LocalAndMethod localAndMethod, params byte[] expectedBytes)
 {
     VerifyCustomTypeInfo(localAndMethod.GetCustomTypeInfo(), expectedBytes);
 }
Esempio n. 7
0
 private static DkmClrLocalVariableInfo ToLocalVariableInfo(LocalAndMethod local)
 {
     return(DkmClrLocalVariableInfo.Create(local.LocalName, local.MethodName, local.Flags, DkmEvaluationResultCategory.Data));
 }
Esempio n. 8
0
 private static void VerifyCustomTypeInfo(LocalAndMethod localAndMethod, string expectedName, params byte[] expectedBytes)
 {
     Assert.Equal(localAndMethod.LocalName, expectedName);
     ReadOnlyCollection<byte> customTypeInfo;
     Guid customTypeInfoId = localAndMethod.GetCustomTypeInfo(out customTypeInfo);
     VerifyCustomTypeInfo(customTypeInfoId, customTypeInfo, expectedBytes);
 }