fix #1408
This commit is contained in:
parent
25c623a0d6
commit
1dbf625c33
|
|
@ -89,13 +89,32 @@ namespace SyntaxVisitors.SugarVisitors
|
|||
//AddDefinitionsInUpperStatementList(matchWith, new[] { new var_statement(cachedExpression, matchWith.expr) });
|
||||
|
||||
// Преобразование из сахара в известную конструкцию каждого case
|
||||
var usedDeconstructionTypes = new HashSet<string>();
|
||||
foreach (var patternCase in matchWith.case_list.elements)
|
||||
{
|
||||
if (patternCase == null)
|
||||
continue;
|
||||
|
||||
if (patternCase.pattern is deconstructor_pattern)
|
||||
{
|
||||
// Проверяем встречался ли уже такой тип при деконструкции
|
||||
var deconstructionType = (patternCase.pattern as deconstructor_pattern).
|
||||
type as named_type_reference;
|
||||
if (deconstructionType != null &&
|
||||
deconstructionType.names != null &&
|
||||
deconstructionType.names.Count != 0)
|
||||
{
|
||||
var deconstructionTypeName = deconstructionType.names[0].name;
|
||||
if (usedDeconstructionTypes.Contains(deconstructionTypeName))
|
||||
{
|
||||
throw new SyntaxVisitorError("REPEATED_DECONSTRUCTION_TYPE",
|
||||
patternCase.pattern.source_context);
|
||||
}
|
||||
usedDeconstructionTypes.Add(deconstructionTypeName);
|
||||
}
|
||||
|
||||
DesugarDeconstructorPatternCase(matchWith.expr, patternCase);
|
||||
}
|
||||
}
|
||||
|
||||
if (matchWith.defaultAction != null)
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ Utils\ReplaceInFiles\ReplaceInFiles.exe Configuration\Version.defs Configuration
|
|||
|
||||
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe" (
|
||||
"%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe" /t:rebuild /property:Configuration=Release PascalABCNET.sln
|
||||
) else if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe" (
|
||||
"%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe" /t:rebuild /property:Configuration=Release PascalABCNET.sln
|
||||
) else (
|
||||
"%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe" /t:rebuild /property:Configuration=Release PascalABCNET.sln
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe" (
|
||||
"%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe" /t:rebuild /verbosity:d /property:Configuration=Release PascalABCNET.sln
|
||||
) else if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe" (
|
||||
"%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe" /t:rebuild /verbosity:d /property:Configuration=Release PascalABCNET.sln
|
||||
) else (
|
||||
"%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe" /t:rebuild /verbosity:d /property:Configuration=Release PascalABCNET.sln
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe" (
|
||||
"%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe" /t:rebuild /property:Configuration=Release /p:Platform="Any CPU" PascalABCNET.sln
|
||||
) else if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe" (
|
||||
"%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe" /t:rebuild /property:Configuration=Release /p:Platform="Any CPU" PascalABCNET.sln
|
||||
) else (
|
||||
"%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe" /t:rebuild /property:Configuration=Release /p:Platform="Any CPU" PascalABCNET.sln
|
||||
)
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ LAMBDA_EXPRESSIONS_CANNOT_CONTAIN_YIELD=Лямбда-выражения не м
|
|||
|
||||
PATTERN_MATHING_IS_NOT_SUPPORTED_IN_THIS_CONTEXT=Сопоставление с образцом не поддерживается в данном контексте
|
||||
ONLY_ONE_DECONSTRUCT_ALLOWED=Можно определить только один пользовательский деконструктор
|
||||
REPEATED_DECONSTRUCTION_TYPE=Повторение типов при сопоставлении с образцом
|
||||
|
||||
Var_{0}_is_already_defined=Переменная {0} уже определена
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue