internal static void VerifyLocal <TMethodSymbol>(
            this CompilationTestData testData,
            string typeName,
            LocalAndMethod localAndMethod,
            string expectedMethodName,
            string expectedLocalName,
            string expectedLocalDisplayName,
            DkmClrCompilationResultFlags expectedFlags,
            Action <TMethodSymbol> verifyTypeParameters,
            string expectedILOpt,
            bool expectedGeneric,
            string expectedValueSourcePath,
            int expectedValueSourceLine)
            where TMethodSymbol : IMethodSymbolInternal
        {
            Assert.Equal(expectedLocalName, localAndMethod.LocalName);
            Assert.Equal(expectedLocalDisplayName, localAndMethod.LocalDisplayName);
            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.GetCciAdapter()).CallingConvention, expectedGeneric ? Cci.CallingConvention.Generic : Cci.CallingConvention.Default);
        }
示例#2
0
 internal static void VerifyLocal(
     CompilationTestData testData,
     string typeName,
     LocalAndMethod localAndMethod,
     string expectedMethodName,
     string expectedLocalName,
     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,
         expectedFlags,
         VerifyTypeParameters,
         expectedILOpt,
         expectedGeneric,
         expectedValueSourcePath,
         expectedValueSourceLine);
 }
示例#3
0
 private static void VerifyCustomTypeInfo(LocalAndMethod localAndMethod, params byte[] expectedBytes)
 {
     VerifyCustomTypeInfo(localAndMethod.GetCustomTypeInfo(), expectedBytes);
 }