Created
February 12, 2017 15:43
-
-
Save controlflow/c2b62254a57cff8c44403191db881869 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var pattern = Pattern; | |
var constantPattern = pattern as IConstantPattern; | |
if (constantPattern != null) | |
{ | |
return IsTypeFromConstantPattern(constantPattern); | |
} | |
var declarationPattern = pattern as IDeclarationPattern; | |
if (declarationPattern != null) | |
{ | |
var typeUsage = declarationPattern.TypeUsage; | |
if (typeUsage != null) | |
{ | |
return CSharpTypeFactory.CreateType(typeUsage); | |
} | |
} | |
return TypeFactory.CreateUnknownType(this); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
switch (Pattern) | |
{ | |
case IConstantPattern constantPattern: | |
return IsTypeFromConstantPattern(constantPattern); | |
case IDeclarationPattern declarationPattern when declarationPattern.TypeUsage is ITypeUsage typeUsage: | |
return CSharpTypeFactory.CreateType(typeUsage); | |
default: | |
return TypeFactory.CreateUnknownType(this); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment