提交 51a6eda6 编写于 作者: M Manish Vasani

Merge remote-tracking branch 'upstream/master' into ShareSyntaxFacts

......@@ -3,9 +3,9 @@
<ProductDependencies>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="5.0.0-beta.20126.7">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="5.0.0-beta.20127.9">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>cd4164e1f3f7daf2a6f8dbd012210c93521bd82f</Sha>
<Sha>9c66925c608f3c0ee3e1f66c05943865b64590e1</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
......@@ -63,7 +63,7 @@ case $cpuname in
amd64|x86_64)
buildarch=x64
;;
armv7l)
armv*l)
buildarch=arm
;;
i686)
......
......@@ -34,6 +34,14 @@ while (($# > 0)); do
force=true
shift 1
;;
--donotabortonfailure)
donotabortonfailure=true
shift 1
;;
--donotdisplaywarnings)
donotdisplaywarnings=true
shift 1
;;
--downloadretries)
download_retries=$2
shift 2
......@@ -52,6 +60,8 @@ while (($# > 0)); do
echo " - (default) %USERPROFILE%/.netcoreeng/native"
echo ""
echo " --clean Switch specifying not to install anything, but cleanup native asset folders"
echo " --donotabortonfailure Switch specifiying whether to abort native tools installation on failure"
echo " --donotdisplaywarnings Switch specifiying whether to display warnings during native tools installation on failure"
echo " --force Clean and then install tools"
echo " --help Print help and exit"
echo ""
......@@ -92,6 +102,7 @@ if [[ -z $install_directory ]]; then
fi
install_bin="${native_base_dir}/bin"
installed_any=false
ReadGlobalJsonNativeTools
......@@ -103,8 +114,8 @@ else
for tool in "${!native_assets[@]}"
do
tool_version=${native_assets[$tool]}
installer_name="install-$tool.sh"
installer_command="$native_installer_dir/$installer_name"
installer_path="$native_installer_dir/install-$tool.sh"
installer_command="$installer_path"
installer_command+=" --baseuri $base_uri"
installer_command+=" --installpath $install_bin"
installer_command+=" --version $tool_version"
......@@ -118,11 +129,29 @@ else
installer_command+=" --clean"
fi
$installer_command
if [[ $? != 0 ]]; then
Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Execution Failed"
exit 1
if [[ -a $installer_path ]]; then
$installer_command
if [[ $? != 0 ]]; then
if [[ $donotabortonfailure = true ]]; then
if [[ $donotdisplaywarnings != true ]]; then
Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Execution Failed"
fi
else
Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Execution Failed"
exit 1
fi
else
$installed_any = true
fi
else
if [[ $donotabortonfailure == true ]]; then
if [[ $donotdisplaywarnings != true ]]; then
Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Execution Failed: no install script"
fi
else
Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Execution Failed: no install script"
exit 1
fi
fi
done
fi
......@@ -135,8 +164,10 @@ if [[ -d $install_bin ]]; then
echo "Native tools are available from $install_bin"
echo "##vso[task.prependpath]$install_bin"
else
Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Native tools install directory does not exist, installation failed"
exit 1
if [[ $installed_any = true ]]; then
Write-PipelineTelemetryError -category 'NativeToolsBootstrap' "Native tools install directory does not exist, installation failed"
exit 1
fi
fi
exit 0
......@@ -7,6 +7,6 @@
"xcopy-msbuild": "16.4.0-alpha"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20126.7"
"Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20127.9"
}
}
......@@ -10,5 +10,6 @@
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)CSharpAnalyzersResources.resx" GenerateSource="true" Link="CSharpAnalyzersResources.resx" />
<None Include="$(MSBuildThisFileDirectory)CSharpAnalyzersResources.resx" />
</ItemGroup>
</Project>
\ No newline at end of file
......@@ -10,5 +10,6 @@
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)CSharpCodeFixesResources.resx" GenerateSource="true" Link="CSharpCodeFixesResources.resx" />
<None Include="$(MSBuildThisFileDirectory)CSharpCodeFixesResources.resx" />
</ItemGroup>
</Project>
\ No newline at end of file
......@@ -10,6 +10,7 @@
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)AnalyzersResources.resx" GenerateSource="true" Link="AnalyzersResources.resx" />
<None Include="$(MSBuildThisFileDirectory)AnalyzersResources.resx" />
</ItemGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)AbstractBuiltInCodeStyleDiagnosticAnalyzer.cs" />
......
......@@ -10,6 +10,7 @@
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)CodeFixesResources.resx" GenerateSource="true" Link="CodeFixesResources.resx" />
<None Include="$(MSBuildThisFileDirectory)CodeFixesResources.resx" />
</ItemGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)PredefinedCodeFixProviderNames.cs" />
......
......@@ -10,5 +10,6 @@
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)VisualBasicAnalyzersResources.resx" GenerateSource="true" Link="VisualBasicAnalyzersResources.resx" />
<None Include="$(MSBuildThisFileDirectory)VisualBasicAnalyzersResources.resx" />
</ItemGroup>
</Project>
\ No newline at end of file
......@@ -10,5 +10,6 @@
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)VisualBasicCodeFixesResources.resx" GenerateSource="true" Link="VisualBasicCodeFixesResources.resx" />
<None Include="$(MSBuildThisFileDirectory)VisualBasicCodeFixesResources.resx" />
</ItemGroup>
</Project>
\ No newline at end of file
......@@ -6007,4 +6007,13 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ
<data name="ERR_ImplicitRangeIndexerWithName" xml:space="preserve">
<value>Invocation of implicit Range Indexer cannot name the argument.</value>
</data>
<data name="ERR_ExpressionTreeContainsPatternIndexOrRangeIndexer" xml:space="preserve">
<value>An expression tree may not contain a pattern System.Index or System.Range indexer access</value>
</data>
<data name="ERR_ExpressionTreeContainsFromEndIndexExpression" xml:space="preserve">
<value>An expression tree may not contain a from-end index ('^') expression.</value>
</data>
<data name="ERR_ExpressionTreeContainsRangeExpression" xml:space="preserve">
<value>An expression tree may not contain a range ('..') expression.</value>
</data>
</root>
......@@ -2020,7 +2020,6 @@ private void EmitAssignmentExpression(BoundAssignmentOperator assignmentOperator
{
if (TryEmitAssignmentInPlace(assignmentOperator, useKind != UseKind.Unused))
{
Debug.Assert(!assignmentOperator.IsRef);
return;
}
......@@ -2087,6 +2086,14 @@ private void EmitAssignmentExpression(BoundAssignmentOperator assignmentOperator
// i.e. target must not be on the heap and we should not be in a try block.
private bool TryEmitAssignmentInPlace(BoundAssignmentOperator assignmentOperator, bool used)
{
// If the left hand is itself a ref, then we can't use in-place assignment
// because we need to spill the creation. This code can't be written in C#, but
// can be produced by lowering.
if (assignmentOperator.IsRef)
{
return false;
}
var left = assignmentOperator.Left;
// if result is used, and lives on heap, we must keep RHS value on the stack.
......
......@@ -1761,6 +1761,10 @@ internal enum ErrorCode
ERR_ConditionalOnLocalFunction = 8783,
ERR_ExpressionTreeContainsPatternIndexOrRangeIndexer = 8790,
ERR_ExpressionTreeContainsFromEndIndexExpression = 8791,
ERR_ExpressionTreeContainsRangeExpression = 8792,
// Note: you will need to re-generate compiler code after adding warnings (eng\generate-compiler-code.cmd)
}
}
......@@ -79,6 +79,48 @@ public override BoundNode VisitArrayCreation(BoundArrayCreation node)
return base.VisitArrayCreation(node);
}
public override BoundNode VisitArrayAccess(BoundArrayAccess node)
{
if (_inExpressionLambda &&
node.Indices.Length == 1 &&
node.Indices[0].Type!.SpecialType == SpecialType.None)
{
Error(ErrorCode.ERR_ExpressionTreeContainsPatternIndexOrRangeIndexer, node);
}
return base.VisitArrayAccess(node);
}
public override BoundNode VisitIndexOrRangePatternIndexerAccess(BoundIndexOrRangePatternIndexerAccess node)
{
if (_inExpressionLambda)
{
Error(ErrorCode.ERR_ExpressionTreeContainsPatternIndexOrRangeIndexer, node);
}
return base.VisitIndexOrRangePatternIndexerAccess(node);
}
public override BoundNode VisitFromEndIndexExpression(BoundFromEndIndexExpression node)
{
if (_inExpressionLambda)
{
Error(ErrorCode.ERR_ExpressionTreeContainsFromEndIndexExpression, node);
}
return base.VisitFromEndIndexExpression(node);
}
public override BoundNode VisitRangeExpression(BoundRangeExpression node)
{
if (_inExpressionLambda)
{
Error(ErrorCode.ERR_ExpressionTreeContainsRangeExpression, node);
}
return base.VisitRangeExpression(node);
}
public override BoundNode VisitSizeOfOperator(BoundSizeOfOperator node)
{
if (_inExpressionLambda && node.ConstantValue == null)
......
......@@ -177,6 +177,21 @@
<target state="translated">Strom výrazu nemůže obsahovat hodnotu struktury REF ani zakázaný typ {0}.</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsFromEndIndexExpression">
<source>An expression tree may not contain a from-end index ('^') expression.</source>
<target state="new">An expression tree may not contain a from-end index ('^') expression.</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsPatternIndexOrRangeIndexer">
<source>An expression tree may not contain a pattern System.Index or System.Range indexer access</source>
<target state="new">An expression tree may not contain a pattern System.Index or System.Range indexer access</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsRangeExpression">
<source>An expression tree may not contain a range ('..') expression.</source>
<target state="new">An expression tree may not contain a range ('..') expression.</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsSwitchExpression">
<source>An expression tree may not contain a switch expression.</source>
<target state="translated">Strom výrazů nesmí obsahovat výraz switch.</target>
......
......@@ -177,6 +177,21 @@
<target state="translated">Eine Ausdrucksstruktur darf keinen Wert vom Typ "ref struct" oder vom eingeschränkten Typ "{0}" enthalten.</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsFromEndIndexExpression">
<source>An expression tree may not contain a from-end index ('^') expression.</source>
<target state="new">An expression tree may not contain a from-end index ('^') expression.</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsPatternIndexOrRangeIndexer">
<source>An expression tree may not contain a pattern System.Index or System.Range indexer access</source>
<target state="new">An expression tree may not contain a pattern System.Index or System.Range indexer access</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsRangeExpression">
<source>An expression tree may not contain a range ('..') expression.</source>
<target state="new">An expression tree may not contain a range ('..') expression.</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsSwitchExpression">
<source>An expression tree may not contain a switch expression.</source>
<target state="translated">Eine Ausdrucksstruktur darf keinen switch-Ausdruck enthalten.</target>
......
......@@ -177,6 +177,21 @@
<target state="translated">Un árbol de expresión no puede contener un valor de estructura ref ni el tipo restringido “{0}”.</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsFromEndIndexExpression">
<source>An expression tree may not contain a from-end index ('^') expression.</source>
<target state="new">An expression tree may not contain a from-end index ('^') expression.</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsPatternIndexOrRangeIndexer">
<source>An expression tree may not contain a pattern System.Index or System.Range indexer access</source>
<target state="new">An expression tree may not contain a pattern System.Index or System.Range indexer access</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsRangeExpression">
<source>An expression tree may not contain a range ('..') expression.</source>
<target state="new">An expression tree may not contain a range ('..') expression.</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsSwitchExpression">
<source>An expression tree may not contain a switch expression.</source>
<target state="translated">Un árbol de expresión no puede contener una expresión switch.</target>
......
......@@ -177,6 +177,21 @@
<target state="translated">Une arborescence de l'expression ne peut pas contenir de valeur de struct par référence ou de type restreint '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsFromEndIndexExpression">
<source>An expression tree may not contain a from-end index ('^') expression.</source>
<target state="new">An expression tree may not contain a from-end index ('^') expression.</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsPatternIndexOrRangeIndexer">
<source>An expression tree may not contain a pattern System.Index or System.Range indexer access</source>
<target state="new">An expression tree may not contain a pattern System.Index or System.Range indexer access</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsRangeExpression">
<source>An expression tree may not contain a range ('..') expression.</source>
<target state="new">An expression tree may not contain a range ('..') expression.</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsSwitchExpression">
<source>An expression tree may not contain a switch expression.</source>
<target state="translated">Une arborescence de l'expression ne peut pas contenir d'expression switch.</target>
......
......@@ -177,6 +177,21 @@
<target state="translated">L'albero delle espressioni non può contenere il valore '{0}' per lo struct ref o il tipo limitato.</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsFromEndIndexExpression">
<source>An expression tree may not contain a from-end index ('^') expression.</source>
<target state="new">An expression tree may not contain a from-end index ('^') expression.</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsPatternIndexOrRangeIndexer">
<source>An expression tree may not contain a pattern System.Index or System.Range indexer access</source>
<target state="new">An expression tree may not contain a pattern System.Index or System.Range indexer access</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsRangeExpression">
<source>An expression tree may not contain a range ('..') expression.</source>
<target state="new">An expression tree may not contain a range ('..') expression.</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsSwitchExpression">
<source>An expression tree may not contain a switch expression.</source>
<target state="translated">Un albero delle espressioni non può contenere un'espressione switch.</target>
......
......@@ -177,6 +177,21 @@
<target state="translated">式ツリーに ref 構造体または制限がある型 '{0}' の値を含めることはできません。</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsFromEndIndexExpression">
<source>An expression tree may not contain a from-end index ('^') expression.</source>
<target state="new">An expression tree may not contain a from-end index ('^') expression.</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsPatternIndexOrRangeIndexer">
<source>An expression tree may not contain a pattern System.Index or System.Range indexer access</source>
<target state="new">An expression tree may not contain a pattern System.Index or System.Range indexer access</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsRangeExpression">
<source>An expression tree may not contain a range ('..') expression.</source>
<target state="new">An expression tree may not contain a range ('..') expression.</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsSwitchExpression">
<source>An expression tree may not contain a switch expression.</source>
<target state="translated">式ツリーに switch 式を含めることはできません。</target>
......
......@@ -177,6 +177,21 @@
<target state="translated">식 트리에는 ref struct 값 또는 제한된 형식 '{0}'을(를) 사용할 수 없습니다.</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsFromEndIndexExpression">
<source>An expression tree may not contain a from-end index ('^') expression.</source>
<target state="new">An expression tree may not contain a from-end index ('^') expression.</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsPatternIndexOrRangeIndexer">
<source>An expression tree may not contain a pattern System.Index or System.Range indexer access</source>
<target state="new">An expression tree may not contain a pattern System.Index or System.Range indexer access</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsRangeExpression">
<source>An expression tree may not contain a range ('..') expression.</source>
<target state="new">An expression tree may not contain a range ('..') expression.</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsSwitchExpression">
<source>An expression tree may not contain a switch expression.</source>
<target state="translated">식 트리에는 switch 식이 포함될 수 없습니다.</target>
......
......@@ -177,6 +177,21 @@
<target state="translated">Drzewo wyrażeń nie może zawierać wartości elementu ref struct ani typu ograniczonego „{0}”.</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsFromEndIndexExpression">
<source>An expression tree may not contain a from-end index ('^') expression.</source>
<target state="new">An expression tree may not contain a from-end index ('^') expression.</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsPatternIndexOrRangeIndexer">
<source>An expression tree may not contain a pattern System.Index or System.Range indexer access</source>
<target state="new">An expression tree may not contain a pattern System.Index or System.Range indexer access</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsRangeExpression">
<source>An expression tree may not contain a range ('..') expression.</source>
<target state="new">An expression tree may not contain a range ('..') expression.</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsSwitchExpression">
<source>An expression tree may not contain a switch expression.</source>
<target state="translated">Drzewo wyrażeń nie może zawierać wyrażenia switch.</target>
......
......@@ -177,6 +177,21 @@
<target state="translated">A árvore de expressão não pode conter um valor de struct de referência ou o tipo restrito '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsFromEndIndexExpression">
<source>An expression tree may not contain a from-end index ('^') expression.</source>
<target state="new">An expression tree may not contain a from-end index ('^') expression.</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsPatternIndexOrRangeIndexer">
<source>An expression tree may not contain a pattern System.Index or System.Range indexer access</source>
<target state="new">An expression tree may not contain a pattern System.Index or System.Range indexer access</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsRangeExpression">
<source>An expression tree may not contain a range ('..') expression.</source>
<target state="new">An expression tree may not contain a range ('..') expression.</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsSwitchExpression">
<source>An expression tree may not contain a switch expression.</source>
<target state="translated">Uma árvore de expressão não pode conter uma expressão switch.</target>
......
......@@ -177,6 +177,21 @@
<target state="translated">Дерево выражений не может содержать значение ref struct или ограниченный тип "{0}".</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsFromEndIndexExpression">
<source>An expression tree may not contain a from-end index ('^') expression.</source>
<target state="new">An expression tree may not contain a from-end index ('^') expression.</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsPatternIndexOrRangeIndexer">
<source>An expression tree may not contain a pattern System.Index or System.Range indexer access</source>
<target state="new">An expression tree may not contain a pattern System.Index or System.Range indexer access</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsRangeExpression">
<source>An expression tree may not contain a range ('..') expression.</source>
<target state="new">An expression tree may not contain a range ('..') expression.</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsSwitchExpression">
<source>An expression tree may not contain a switch expression.</source>
<target state="translated">Дерево выражений не может содержать выражение switch.</target>
......
......@@ -177,6 +177,21 @@
<target state="translated">İfade ağacı, ref yapısında veya kısıtlanmış '{0}' türünde değer içeremez.</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsFromEndIndexExpression">
<source>An expression tree may not contain a from-end index ('^') expression.</source>
<target state="new">An expression tree may not contain a from-end index ('^') expression.</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsPatternIndexOrRangeIndexer">
<source>An expression tree may not contain a pattern System.Index or System.Range indexer access</source>
<target state="new">An expression tree may not contain a pattern System.Index or System.Range indexer access</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsRangeExpression">
<source>An expression tree may not contain a range ('..') expression.</source>
<target state="new">An expression tree may not contain a range ('..') expression.</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsSwitchExpression">
<source>An expression tree may not contain a switch expression.</source>
<target state="translated">İfade ağacı, switch ifadesi içeremez.</target>
......
......@@ -177,6 +177,21 @@
<target state="translated">表达式树不能包含 ref 结构或受限类型“{0}”的值。</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsFromEndIndexExpression">
<source>An expression tree may not contain a from-end index ('^') expression.</source>
<target state="new">An expression tree may not contain a from-end index ('^') expression.</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsPatternIndexOrRangeIndexer">
<source>An expression tree may not contain a pattern System.Index or System.Range indexer access</source>
<target state="new">An expression tree may not contain a pattern System.Index or System.Range indexer access</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsRangeExpression">
<source>An expression tree may not contain a range ('..') expression.</source>
<target state="new">An expression tree may not contain a range ('..') expression.</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsSwitchExpression">
<source>An expression tree may not contain a switch expression.</source>
<target state="translated">表达式树不能包含 switch 表达式。</target>
......
......@@ -177,6 +177,21 @@
<target state="translated">運算式樹狀架構不可包含 ref 結構或限制型別 '{0}' 的值。</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsFromEndIndexExpression">
<source>An expression tree may not contain a from-end index ('^') expression.</source>
<target state="new">An expression tree may not contain a from-end index ('^') expression.</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsPatternIndexOrRangeIndexer">
<source>An expression tree may not contain a pattern System.Index or System.Range indexer access</source>
<target state="new">An expression tree may not contain a pattern System.Index or System.Range indexer access</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsRangeExpression">
<source>An expression tree may not contain a range ('..') expression.</source>
<target state="new">An expression tree may not contain a range ('..') expression.</target>
<note />
</trans-unit>
<trans-unit id="ERR_ExpressionTreeContainsSwitchExpression">
<source>An expression tree may not contain a switch expression.</source>
<target state="translated">運算式樹狀結構不可包含 switch 運算式。</target>
......
......@@ -40,6 +40,76 @@ private static void VerifyIndexCall(IMethodSymbol symbol, string methodName, str
Assert.Equal(containingTypeName, symbol.ContainingType.Name);
}
[Fact]
public void ExpressionTreePatternIndexAndRange()
{
var src = @"
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
struct S
{
public int Length => 0;
public S Slice(int start, int length) => default;
}
class Program
{
static void Main()
{
Expression<Func<int[], int>> e = (int[] a) => a[new Index(0, true)]; // 1
Expression<Func<List<int>, int>> e2 = (List<int> a) => a[new Index(0, true)]; // 2
Expression<Func<int[], int[]>> e3 = (int[] a) => a[new Range(0, 1)]; // 3
Expression<Func<S, S>> e4 = (S s) => s[new Range(0, 1)]; // 4
}
}";
var comp = CreateCompilationWithIndexAndRange(
new[] { src, TestSources.GetSubArray, });
comp.VerifyEmitDiagnostics(
// (16,55): error CS8790: An expression tree may not contain a pattern System.Index or System.Range indexer access
// Expression<Func<int[], int>> e = (int[] a) => a[new Index(0, true)]; // 1
Diagnostic(ErrorCode.ERR_ExpressionTreeContainsPatternIndexOrRangeIndexer, "a[new Index(0, true)]").WithLocation(16, 55),
// (17,64): error CS8790: An expression tree may not contain a pattern System.Index or System.Range indexer access
// Expression<Func<List<int>, int>> e2 = (List<int> a) => a[new Index(0, true)]; // 2
Diagnostic(ErrorCode.ERR_ExpressionTreeContainsPatternIndexOrRangeIndexer, "a[new Index(0, true)]").WithLocation(17, 64),
// (19,58): error CS8790: An expression tree may not contain a pattern System.Index or System.Range indexer access
// Expression<Func<int[], int[]>> e3 = (int[] a) => a[new Range(0, 1)]; // 3
Diagnostic(ErrorCode.ERR_ExpressionTreeContainsPatternIndexOrRangeIndexer, "a[new Range(0, 1)]").WithLocation(19, 58),
// (20,46): error CS8790: An expression tree may not contain a pattern System.Index or System.Range indexer access
// Expression<Func<S, S>> e4 = (S s) => s[new Range(0, 1)]; // 4
Diagnostic(ErrorCode.ERR_ExpressionTreeContainsPatternIndexOrRangeIndexer, "s[new Range(0, 1)]").WithLocation(20, 46)
);
}
[Fact]
public void ExpressionTreeFromEndIndexAndRange()
{
var src = @"
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
class Program
{
static void Main()
{
Expression<Func<Index>> e = () => ^1;
Expression<Func<Range>> e2 = () => 1..2;
}
}";
var comp = CreateCompilationWithIndexAndRange(src);
comp.VerifyEmitDiagnostics(
// (10,43): error CS8791: An expression tree may not contain a from-end index ('^') expression.
// Expression<Func<Index>> e = () => ^1;
Diagnostic(ErrorCode.ERR_ExpressionTreeContainsFromEndIndexExpression, "^1").WithLocation(10, 43),
// (11,44): error CS8792: An expression tree may not contain a range ('..') expression.
// Expression<Func<Range>> e2 = () => 1..2;
Diagnostic(ErrorCode.ERR_ExpressionTreeContainsRangeExpression, "1..2").WithLocation(11, 44)
);
}
[Fact]
public void PatternIndexArray()
{
......@@ -1660,6 +1730,82 @@ .maxstack 3
}");
}
[Fact, WorkItem(40776, "https://github.com/dotnet/roslyn/issues/40776")]
public void FakeIndexIndexerOnDefaultStruct()
{
var verifier = CompileAndVerifyWithIndexAndRange(@"
using System;
struct NotASpan
{
public int Length => 1;
public int this[int index] => 0;
}
class C
{
static int Repro() => default(NotASpan)[^0];
static void Main() => Repro();
}");
verifier.VerifyIL("C.Repro", @"
{
// Code size 25 (0x19)
.maxstack 3
.locals init (int V_0,
NotASpan V_1)
IL_0000: ldloca.s V_1
IL_0002: dup
IL_0003: initobj ""NotASpan""
IL_0009: dup
IL_000a: call ""int NotASpan.Length.get""
IL_000f: ldc.i4.0
IL_0010: sub
IL_0011: stloc.0
IL_0012: ldloc.0
IL_0013: call ""int NotASpan.this[int].get""
IL_0018: ret
}");
}
[Fact, WorkItem(40776, "https://github.com/dotnet/roslyn/issues/40776")]
public void FakeIndexIndexerOnStructConstructor()
{
var comp = CreateCompilationWithIndexAndRangeAndSpan(@"
using System;
class C
{
static byte Repro() => new Span<byte>(new byte[] { })[^1];
}");
var verifier = CompileAndVerify(comp);
verifier.VerifyIL("C.Repro", @"
{
// Code size 31 (0x1f)
.maxstack 3
.locals init (int V_0,
System.Span<byte> V_1)
IL_0000: ldc.i4.0
IL_0001: newarr ""byte""
IL_0006: newobj ""System.Span<byte>..ctor(byte[])""
IL_000b: stloc.1
IL_000c: ldloca.s V_1
IL_000e: dup
IL_000f: call ""int System.Span<byte>.Length.get""
IL_0014: ldc.i4.1
IL_0015: sub
IL_0016: stloc.0
IL_0017: ldloc.0
IL_0018: call ""ref byte System.Span<byte>.this[int].get""
IL_001d: ldind.u1
IL_001e: ret
}");
}
[Fact]
public void FakeRangeIndexerStringOpenEnd()
{
......
......@@ -17,7 +17,7 @@ internal class CSharpResolveConflictMarkerCodeFixProvider : AbstractResolveConfl
[ImportingConstructor]
public CSharpResolveConflictMarkerCodeFixProvider()
: base(CSharpSyntaxKindsService.Instance, CS8300)
: base(CSharpSyntaxKinds.Instance, CS8300)
{
}
}
......
......@@ -17,7 +17,7 @@ internal class CSharpConvertAnonymousTypeToTupleDiagnosticAnalyzer
AnonymousObjectCreationExpressionSyntax>
{
public CSharpConvertAnonymousTypeToTupleDiagnosticAnalyzer()
: base(CSharpSyntaxKindsService.Instance)
: base(CSharpSyntaxKinds.Instance)
{
}
......
......@@ -20,10 +20,10 @@ internal abstract class AbstractResolveConflictMarkerCodeFixProvider : CodeFixPr
{
private static readonly int s_mergeConflictLength = "<<<<<<<".Length;
private readonly ISyntaxKindsService _syntaxKinds;
private readonly ISyntaxKinds _syntaxKinds;
protected AbstractResolveConflictMarkerCodeFixProvider(
ISyntaxKindsService syntaxKinds, string diagnosticId)
ISyntaxKinds syntaxKinds, string diagnosticId)
{
FixableDiagnosticIds = ImmutableArray.Create(diagnosticId);
_syntaxKinds = syntaxKinds;
......
......@@ -17,9 +17,9 @@ internal abstract class AbstractConvertAnonymousTypeToTupleDiagnosticAnalyzer<
where TSyntaxKind : struct
where TAnonymousObjectCreationExpressionSyntax : SyntaxNode
{
private readonly ISyntaxKindsService _syntaxKinds;
private readonly ISyntaxKinds _syntaxKinds;
protected AbstractConvertAnonymousTypeToTupleDiagnosticAnalyzer(ISyntaxKindsService syntaxKinds)
protected AbstractConvertAnonymousTypeToTupleDiagnosticAnalyzer(ISyntaxKinds syntaxKinds)
: base(IDEDiagnosticIds.ConvertAnonymousTypeToTupleDiagnosticId,
option: null,
new LocalizableResourceString(nameof(FeaturesResources.Convert_to_tuple), FeaturesResources.ResourceManager, typeof(FeaturesResources)),
......
......@@ -15,7 +15,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.ConflictMarkerResolution
<ImportingConstructor>
Public Sub New()
MyBase.New(VisualBasicSyntaxKindsService.Instance, BC37284)
MyBase.New(VisualBasicSyntaxKinds.Instance, BC37284)
End Sub
End Class
End Namespace
......@@ -13,7 +13,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.ConvertAnonymousTypeToTuple
SyntaxKind, AnonymousObjectCreationExpressionSyntax)
Public Sub New()
MyBase.New(VisualBasicSyntaxKindsService.Instance)
MyBase.New(VisualBasicSyntaxKinds.Instance)
End Sub
Protected Overrides Function GetInitializerCount(anonymousType As AnonymousObjectCreationExpressionSyntax) As Integer
......
......@@ -71,9 +71,9 @@
<Compile Include="$(MSBuildThisFileDirectory)Formatting\Rules\TokenBasedFormattingRule.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Formatting\Rules\WrappingFormattingRule.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helpers\RemoveUnnecessaryImports\CSharpUnnecessaryImportsProvider.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Services\SyntaxFacts\CSharpSyntaxKinds.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Services\SyntaxFacts\CSharpDocumentationCommentService.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Services\SyntaxFacts\CSharpSyntaxFacts.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Services\SyntaxFacts\CSharpSyntaxKindsService.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Utilities\FormattingRangeHelper.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Utilities\TypeStyle\CSharpTypeStyleHelper.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Utilities\TypeStyle\CSharpTypeStyleHelper.State.cs" />
......@@ -82,5 +82,6 @@
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)CSharpCompilerExtensionsResources.resx" GenerateSource="true" Link="CSharpCompilerExtensionsResources.resx" />
<None Include="$(MSBuildThisFileDirectory)CSharpCompilerExtensionsResources.resx" />
</ItemGroup>
</Project>
\ No newline at end of file
......@@ -38,7 +38,7 @@ public SyntaxTrivia ElasticMarker
public SyntaxTrivia ElasticCarriageReturnLineFeed
=> SyntaxFactory.ElasticCarriageReturnLineFeed;
public override ISyntaxKindsService SyntaxKinds { get; } = CSharpSyntaxKindsService.Instance;
public override ISyntaxKinds SyntaxKinds { get; } = CSharpSyntaxKinds.Instance;
protected override IDocumentationCommentService DocumentationCommentService
=> CSharpDocumentationCommentService.Instance;
......
......@@ -6,11 +6,11 @@
namespace Microsoft.CodeAnalysis.CSharp
{
internal sealed class CSharpSyntaxKindsService : ISyntaxKindsService
internal class CSharpSyntaxKinds : ISyntaxKinds
{
public static readonly CSharpSyntaxKindsService Instance = new CSharpSyntaxKindsService();
public static readonly CSharpSyntaxKinds Instance = new CSharpSyntaxKinds();
private CSharpSyntaxKindsService()
protected CSharpSyntaxKinds()
{
}
......
......@@ -276,7 +276,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Services\SyntaxFacts\IDocumentationCommentService.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Services\SyntaxFacts\ISyntaxFacts.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Services\SyntaxFacts\ISyntaxFactsExtensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Services\SyntaxFacts\ISyntaxKindsService.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Services\SyntaxFacts\ISyntaxKinds.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Simplification\AliasAnnotation.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Simplification\DoNotAddImportsAnnotation.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Simplification\DoNotAllowVarAnnotation.cs" />
......@@ -404,5 +404,6 @@
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)CompilerExtensionsResources.resx" GenerateSource="true" Link="CompilerExtensionsResources.resx" />
<None Include="$(MSBuildThisFileDirectory)CompilerExtensionsResources.resx" />
</ItemGroup>
</Project>
\ No newline at end of file
......@@ -22,7 +22,7 @@ internal abstract class AbstractSyntaxFacts
private readonly static ObjectPool<Stack<(SyntaxNodeOrToken nodeOrToken, bool leading, bool trailing)>> s_stackPool
= SharedPools.Default<Stack<(SyntaxNodeOrToken nodeOrToken, bool leading, bool trailing)>>();
public abstract ISyntaxKindsService SyntaxKinds { get; }
public abstract ISyntaxKinds SyntaxKinds { get; }
// Matches the following:
//
......
......@@ -19,7 +19,7 @@ internal partial interface ISyntaxFacts
SyntaxTrivia ElasticMarker { get; }
SyntaxTrivia ElasticCarriageReturnLineFeed { get; }
ISyntaxKindsService SyntaxKinds { get; }
ISyntaxKinds SyntaxKinds { get; }
bool SupportsIndexingInitializer(ParseOptions options);
bool SupportsThrowExpression(ParseOptions options);
......
......@@ -10,7 +10,7 @@ namespace Microsoft.CodeAnalysis
/// Provides a uniform view of SyntaxKinds over C# and VB for constructs they have
/// in common.
/// </summary>
internal partial interface ISyntaxKindsService
internal interface ISyntaxKinds
{
TSyntaxKind Convert<TSyntaxKind>(int kind) where TSyntaxKind : struct;
......
......@@ -46,7 +46,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Get
End Property
Public Overrides ReadOnly Property SyntaxKinds As ISyntaxKindsService = VisualBasicSyntaxKindsService.Instance Implements ISyntaxFacts.SyntaxKinds
Public Overrides ReadOnly Property SyntaxKinds As ISyntaxKinds = VisualBasicSyntaxKinds.Instance Implements ISyntaxFacts.SyntaxKinds
Protected Overrides ReadOnly Property DocumentationCommentService As IDocumentationCommentService
Get
......
......@@ -3,84 +3,84 @@
' See the LICENSE file in the project root for more information.
Namespace Microsoft.CodeAnalysis.VisualBasic
Friend NotInheritable Class VisualBasicSyntaxKindsService
Implements ISyntaxKindsService
Friend Class VisualBasicSyntaxKinds
Implements ISyntaxKinds
Public Shared ReadOnly Instance As New VisualBasicSyntaxKindsService()
Public Shared ReadOnly Instance As New VisualBasicSyntaxKinds()
Private Sub New()
Protected Sub New()
End Sub
Public Function Convert(Of TSyntaxKind As Structure)(kind As Integer) As TSyntaxKind Implements ISyntaxKindsService.Convert
Public Function Convert(Of TSyntaxKind As Structure)(kind As Integer) As TSyntaxKind Implements ISyntaxKinds.Convert
' Boxing/Unboxing casts from Object to TSyntaxKind will be erased by jit.
Return CType(CType(CType(kind, SyntaxKind), Object), TSyntaxKind)
End Function
Public ReadOnly Property ConflictMarkerTrivia As Integer = SyntaxKind.ConflictMarkerTrivia Implements ISyntaxKindsService.ConflictMarkerTrivia
Public ReadOnly Property DisabledTextTrivia As Integer = SyntaxKind.DisabledTextTrivia Implements ISyntaxKindsService.DisabledTextTrivia
Public ReadOnly Property EndOfLineTrivia As Integer = SyntaxKind.EndOfLineTrivia Implements ISyntaxKindsService.EndOfLineTrivia
Public ReadOnly Property SkippedTokensTrivia As Integer = SyntaxKind.SkippedTokensTrivia Implements ISyntaxKindsService.SkippedTokensTrivia
Public ReadOnly Property WhitespaceTrivia As Integer = SyntaxKind.WhitespaceTrivia Implements ISyntaxKindsService.WhitespaceTrivia
Public ReadOnly Property CharacterLiteralToken As Integer = SyntaxKind.CharacterLiteralToken Implements ISyntaxKindsService.CharacterLiteralToken
Public ReadOnly Property DotToken As Integer = SyntaxKind.DotToken Implements ISyntaxKindsService.DotToken
Public ReadOnly Property InterpolatedStringTextToken As Integer = SyntaxKind.InterpolatedStringTextToken Implements ISyntaxKindsService.InterpolatedStringTextToken
Public ReadOnly Property QuestionToken As Integer = SyntaxKind.QuestionToken Implements ISyntaxKindsService.QuestionToken
Public ReadOnly Property StringLiteralToken As Integer = SyntaxKind.StringLiteralToken Implements ISyntaxKindsService.StringLiteralToken
Public ReadOnly Property IfKeyword As Integer = SyntaxKind.IfKeyword Implements ISyntaxKindsService.IfKeyword
Public ReadOnly Property GenericName As Integer = SyntaxKind.GenericName Implements ISyntaxKindsService.GenericName
Public ReadOnly Property IdentifierName As Integer = SyntaxKind.IdentifierName Implements ISyntaxKindsService.IdentifierName
Public ReadOnly Property QualifiedName As Integer = SyntaxKind.QualifiedName Implements ISyntaxKindsService.QualifiedName
Public ReadOnly Property TupleType As Integer = SyntaxKind.TupleType Implements ISyntaxKindsService.TupleType
Public ReadOnly Property CharacterLiteralExpression As Integer = SyntaxKind.CharacterLiteralExpression Implements ISyntaxKindsService.CharacterLiteralExpression
Public ReadOnly Property DefaultLiteralExpression As Integer = SyntaxKind.NothingLiteralExpression Implements ISyntaxKindsService.DefaultLiteralExpression
Public ReadOnly Property FalseLiteralExpression As Integer = SyntaxKind.FalseLiteralExpression Implements ISyntaxKindsService.FalseLiteralExpression
Public ReadOnly Property NullLiteralExpression As Integer = SyntaxKind.NothingLiteralExpression Implements ISyntaxKindsService.NullLiteralExpression
Public ReadOnly Property StringLiteralExpression As Integer = SyntaxKind.StringLiteralExpression Implements ISyntaxKindsService.StringLiteralExpression
Public ReadOnly Property TrueLiteralExpression As Integer = SyntaxKind.TrueLiteralExpression Implements ISyntaxKindsService.TrueLiteralExpression
Public ReadOnly Property AnonymousObjectCreationExpression As Integer = SyntaxKind.AnonymousObjectCreationExpression Implements ISyntaxKindsService.AnonymousObjectCreationExpression
Public ReadOnly Property AwaitExpression As Integer = SyntaxKind.AwaitExpression Implements ISyntaxKindsService.AwaitExpression
Public ReadOnly Property BaseExpression As Integer = SyntaxKind.MyBaseExpression Implements ISyntaxKindsService.BaseExpression
Public ReadOnly Property ConditionalAccessExpression As Integer = SyntaxKind.ConditionalAccessExpression Implements ISyntaxKindsService.ConditionalAccessExpression
Public ReadOnly Property InvocationExpression As Integer = SyntaxKind.InvocationExpression Implements ISyntaxKindsService.InvocationExpression
Public ReadOnly Property LogicalAndExpression As Integer = SyntaxKind.AndAlsoExpression Implements ISyntaxKindsService.LogicalAndExpression
Public ReadOnly Property LogicalOrExpression As Integer = SyntaxKind.OrElseExpression Implements ISyntaxKindsService.LogicalOrExpression
Public ReadOnly Property LogicalNotExpression As Integer = SyntaxKind.NotExpression Implements ISyntaxKindsService.LogicalNotExpression
Public ReadOnly Property ObjectCreationExpression As Integer = SyntaxKind.ObjectCreationExpression Implements ISyntaxKindsService.ObjectCreationExpression
Public ReadOnly Property ParenthesizedExpression As Integer = SyntaxKind.ParenthesizedExpression Implements ISyntaxKindsService.ParenthesizedExpression
Public ReadOnly Property QueryExpression As Integer = SyntaxKind.QueryExpression Implements ISyntaxKindsService.QueryExpression
Public ReadOnly Property ReferenceEqualsExpression As Integer = SyntaxKind.IsExpression Implements ISyntaxKindsService.ReferenceEqualsExpression
Public ReadOnly Property ReferenceNotEqualsExpression As Integer = SyntaxKind.IsNotExpression Implements ISyntaxKindsService.ReferenceNotEqualsExpression
Public ReadOnly Property SimpleMemberAccessExpression As Integer = SyntaxKind.SimpleMemberAccessExpression Implements ISyntaxKindsService.SimpleMemberAccessExpression
Public ReadOnly Property TernaryConditionalExpression As Integer = SyntaxKind.TernaryConditionalExpression Implements ISyntaxKindsService.TernaryConditionalExpression
Public ReadOnly Property ThisExpression As Integer = SyntaxKind.MeExpression Implements ISyntaxKindsService.ThisExpression
Public ReadOnly Property TupleExpression As Integer = SyntaxKind.TupleExpression Implements ISyntaxKindsService.TupleExpression
Public ReadOnly Property EndOfFileToken As Integer = SyntaxKind.EndOfFileToken Implements ISyntaxKindsService.EndOfFileToken
Public ReadOnly Property AwaitKeyword As Integer = SyntaxKind.AwaitKeyword Implements ISyntaxKindsService.AwaitKeyword
Public ReadOnly Property IdentifierToken As Integer = SyntaxKind.IdentifierToken Implements ISyntaxKindsService.IdentifierToken
Public ReadOnly Property GlobalKeyword As Integer = SyntaxKind.GlobalKeyword Implements ISyntaxKindsService.GlobalKeyword
Public ReadOnly Property IncompleteMember As Integer = SyntaxKind.IncompleteMember Implements ISyntaxKindsService.IncompleteMember
Public ReadOnly Property HashToken As Integer = SyntaxKind.HashToken Implements ISyntaxKindsService.HashToken
Public ReadOnly Property ExpressionStatement As Integer = SyntaxKind.ExpressionStatement Implements ISyntaxKindsService.ExpressionStatement
Public ReadOnly Property ForEachStatement As Integer = SyntaxKind.ForEachStatement Implements ISyntaxKindsService.ForEachStatement
Public ReadOnly Property LocalDeclarationStatement As Integer = SyntaxKind.LocalDeclarationStatement Implements ISyntaxKindsService.LocalDeclarationStatement
Public ReadOnly Property LockStatement As Integer = SyntaxKind.SyncLockStatement Implements ISyntaxKindsService.LockStatement
Public ReadOnly Property ReturnStatement As Integer = SyntaxKind.ReturnStatement Implements ISyntaxKindsService.ReturnStatement
Public ReadOnly Property UsingStatement As Integer = SyntaxKind.UsingStatement Implements ISyntaxKindsService.UsingStatement
Public ReadOnly Property Attribute As Integer = SyntaxKind.Attribute Implements ISyntaxKindsService.Attribute
Public ReadOnly Property Parameter As Integer = SyntaxKind.Parameter Implements ISyntaxKindsService.Parameter
Public ReadOnly Property TypeConstraint As Integer = SyntaxKind.TypeConstraint Implements ISyntaxKindsService.TypeConstraint
Public ReadOnly Property VariableDeclarator As Integer = SyntaxKind.VariableDeclarator Implements ISyntaxKindsService.VariableDeclarator
Public ReadOnly Property TypeArgumentList As Integer = SyntaxKind.TypeArgumentList Implements ISyntaxKindsService.TypeArgumentList
Public ReadOnly Property ConflictMarkerTrivia As Integer = SyntaxKind.ConflictMarkerTrivia Implements ISyntaxKinds.ConflictMarkerTrivia
Public ReadOnly Property DisabledTextTrivia As Integer = SyntaxKind.DisabledTextTrivia Implements ISyntaxKinds.DisabledTextTrivia
Public ReadOnly Property EndOfLineTrivia As Integer = SyntaxKind.EndOfLineTrivia Implements ISyntaxKinds.EndOfLineTrivia
Public ReadOnly Property SkippedTokensTrivia As Integer = SyntaxKind.SkippedTokensTrivia Implements ISyntaxKinds.SkippedTokensTrivia
Public ReadOnly Property WhitespaceTrivia As Integer = SyntaxKind.WhitespaceTrivia Implements ISyntaxKinds.WhitespaceTrivia
Public ReadOnly Property CharacterLiteralToken As Integer = SyntaxKind.CharacterLiteralToken Implements ISyntaxKinds.CharacterLiteralToken
Public ReadOnly Property DotToken As Integer = SyntaxKind.DotToken Implements ISyntaxKinds.DotToken
Public ReadOnly Property InterpolatedStringTextToken As Integer = SyntaxKind.InterpolatedStringTextToken Implements ISyntaxKinds.InterpolatedStringTextToken
Public ReadOnly Property QuestionToken As Integer = SyntaxKind.QuestionToken Implements ISyntaxKinds.QuestionToken
Public ReadOnly Property StringLiteralToken As Integer = SyntaxKind.StringLiteralToken Implements ISyntaxKinds.StringLiteralToken
Public ReadOnly Property IfKeyword As Integer = SyntaxKind.IfKeyword Implements ISyntaxKinds.IfKeyword
Public ReadOnly Property GenericName As Integer = SyntaxKind.GenericName Implements ISyntaxKinds.GenericName
Public ReadOnly Property IdentifierName As Integer = SyntaxKind.IdentifierName Implements ISyntaxKinds.IdentifierName
Public ReadOnly Property QualifiedName As Integer = SyntaxKind.QualifiedName Implements ISyntaxKinds.QualifiedName
Public ReadOnly Property TupleType As Integer = SyntaxKind.TupleType Implements ISyntaxKinds.TupleType
Public ReadOnly Property CharacterLiteralExpression As Integer = SyntaxKind.CharacterLiteralExpression Implements ISyntaxKinds.CharacterLiteralExpression
Public ReadOnly Property DefaultLiteralExpression As Integer = SyntaxKind.NothingLiteralExpression Implements ISyntaxKinds.DefaultLiteralExpression
Public ReadOnly Property FalseLiteralExpression As Integer = SyntaxKind.FalseLiteralExpression Implements ISyntaxKinds.FalseLiteralExpression
Public ReadOnly Property NullLiteralExpression As Integer = SyntaxKind.NothingLiteralExpression Implements ISyntaxKinds.NullLiteralExpression
Public ReadOnly Property StringLiteralExpression As Integer = SyntaxKind.StringLiteralExpression Implements ISyntaxKinds.StringLiteralExpression
Public ReadOnly Property TrueLiteralExpression As Integer = SyntaxKind.TrueLiteralExpression Implements ISyntaxKinds.TrueLiteralExpression
Public ReadOnly Property AnonymousObjectCreationExpression As Integer = SyntaxKind.AnonymousObjectCreationExpression Implements ISyntaxKinds.AnonymousObjectCreationExpression
Public ReadOnly Property AwaitExpression As Integer = SyntaxKind.AwaitExpression Implements ISyntaxKinds.AwaitExpression
Public ReadOnly Property BaseExpression As Integer = SyntaxKind.MyBaseExpression Implements ISyntaxKinds.BaseExpression
Public ReadOnly Property ConditionalAccessExpression As Integer = SyntaxKind.ConditionalAccessExpression Implements ISyntaxKinds.ConditionalAccessExpression
Public ReadOnly Property InvocationExpression As Integer = SyntaxKind.InvocationExpression Implements ISyntaxKinds.InvocationExpression
Public ReadOnly Property LogicalAndExpression As Integer = SyntaxKind.AndAlsoExpression Implements ISyntaxKinds.LogicalAndExpression
Public ReadOnly Property LogicalOrExpression As Integer = SyntaxKind.OrElseExpression Implements ISyntaxKinds.LogicalOrExpression
Public ReadOnly Property LogicalNotExpression As Integer = SyntaxKind.NotExpression Implements ISyntaxKinds.LogicalNotExpression
Public ReadOnly Property ObjectCreationExpression As Integer = SyntaxKind.ObjectCreationExpression Implements ISyntaxKinds.ObjectCreationExpression
Public ReadOnly Property ParenthesizedExpression As Integer = SyntaxKind.ParenthesizedExpression Implements ISyntaxKinds.ParenthesizedExpression
Public ReadOnly Property QueryExpression As Integer = SyntaxKind.QueryExpression Implements ISyntaxKinds.QueryExpression
Public ReadOnly Property ReferenceEqualsExpression As Integer = SyntaxKind.IsExpression Implements ISyntaxKinds.ReferenceEqualsExpression
Public ReadOnly Property ReferenceNotEqualsExpression As Integer = SyntaxKind.IsNotExpression Implements ISyntaxKinds.ReferenceNotEqualsExpression
Public ReadOnly Property SimpleMemberAccessExpression As Integer = SyntaxKind.SimpleMemberAccessExpression Implements ISyntaxKinds.SimpleMemberAccessExpression
Public ReadOnly Property TernaryConditionalExpression As Integer = SyntaxKind.TernaryConditionalExpression Implements ISyntaxKinds.TernaryConditionalExpression
Public ReadOnly Property ThisExpression As Integer = SyntaxKind.MeExpression Implements ISyntaxKinds.ThisExpression
Public ReadOnly Property TupleExpression As Integer = SyntaxKind.TupleExpression Implements ISyntaxKinds.TupleExpression
Public ReadOnly Property EndOfFileToken As Integer = SyntaxKind.EndOfFileToken Implements ISyntaxKinds.EndOfFileToken
Public ReadOnly Property AwaitKeyword As Integer = SyntaxKind.AwaitKeyword Implements ISyntaxKinds.AwaitKeyword
Public ReadOnly Property IdentifierToken As Integer = SyntaxKind.IdentifierToken Implements ISyntaxKinds.IdentifierToken
Public ReadOnly Property GlobalKeyword As Integer = SyntaxKind.GlobalKeyword Implements ISyntaxKinds.GlobalKeyword
Public ReadOnly Property IncompleteMember As Integer = SyntaxKind.IncompleteMember Implements ISyntaxKinds.IncompleteMember
Public ReadOnly Property HashToken As Integer = SyntaxKind.HashToken Implements ISyntaxKinds.HashToken
Public ReadOnly Property ExpressionStatement As Integer = SyntaxKind.ExpressionStatement Implements ISyntaxKinds.ExpressionStatement
Public ReadOnly Property ForEachStatement As Integer = SyntaxKind.ForEachStatement Implements ISyntaxKinds.ForEachStatement
Public ReadOnly Property LocalDeclarationStatement As Integer = SyntaxKind.LocalDeclarationStatement Implements ISyntaxKinds.LocalDeclarationStatement
Public ReadOnly Property LockStatement As Integer = SyntaxKind.SyncLockStatement Implements ISyntaxKinds.LockStatement
Public ReadOnly Property ReturnStatement As Integer = SyntaxKind.ReturnStatement Implements ISyntaxKinds.ReturnStatement
Public ReadOnly Property UsingStatement As Integer = SyntaxKind.UsingStatement Implements ISyntaxKinds.UsingStatement
Public ReadOnly Property Attribute As Integer = SyntaxKind.Attribute Implements ISyntaxKinds.Attribute
Public ReadOnly Property Parameter As Integer = SyntaxKind.Parameter Implements ISyntaxKinds.Parameter
Public ReadOnly Property TypeConstraint As Integer = SyntaxKind.TypeConstraint Implements ISyntaxKinds.TypeConstraint
Public ReadOnly Property VariableDeclarator As Integer = SyntaxKind.VariableDeclarator Implements ISyntaxKinds.VariableDeclarator
Public ReadOnly Property TypeArgumentList As Integer = SyntaxKind.TypeArgumentList Implements ISyntaxKinds.TypeArgumentList
End Class
End Namespace
......@@ -22,11 +22,12 @@
<Compile Include="$(MSBuildThisFileDirectory)Helpers\RemoveUnnecessaryImports\VisualBasicUnnecessaryImportsProvider.vb" />
<Compile Include="$(MSBuildThisFileDirectory)Services\SyntaxFacts\VisualBasicDocumentationCommentService.vb" />
<Compile Include="$(MSBuildThisFileDirectory)Services\SyntaxFacts\VisualBasicSyntaxFacts.vb" />
<Compile Include="$(MSBuildThisFileDirectory)Services\SyntaxFacts\VisualBasicSyntaxKindsService.vb" />
<Compile Include="$(MSBuildThisFileDirectory)Utilities\DirectiveSyntaxEqualityComparer.vb" />
<Compile Include="$(MSBuildThisFileDirectory)Utilities\DirectiveWalker.vb" />
<Compile Include="$(MSBuildThisFileDirectory)Services\SyntaxFacts\VisualBasicSyntaxKinds.vb" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)VisualBasicCompilerExtensionsResources.resx" GenerateSource="true" Link="VisualBasicCompilerExtensionsResources.resx" />
<None Include="$(MSBuildThisFileDirectory)VisualBasicCompilerExtensionsResources.resx" />
</ItemGroup>
</Project>
\ No newline at end of file
......@@ -51,6 +51,7 @@
<Compile Include="$(MSBuildThisFileDirectory)LanguageServices\CSharpSymbolDeclarationService.cs" />
<Compile Include="$(MSBuildThisFileDirectory)LanguageServices\CSharpSyntaxFactsService.cs" />
<Compile Include="$(MSBuildThisFileDirectory)LanguageServices\CSharpSyntaxFactsServiceFactory.cs" />
<Compile Include="$(MSBuildThisFileDirectory)LanguageServices\CSharpSyntaxKindsServiceFactory.cs" />
<Compile Include="$(MSBuildThisFileDirectory)LanguageServices\CSharpTypeInferenceService.cs" />
<Compile Include="$(MSBuildThisFileDirectory)LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs" />
<Compile Include="$(MSBuildThisFileDirectory)LanguageServices\CSharpGeneratedCodeRecognitionService.cs" />
......@@ -70,5 +71,6 @@
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)CSharpWorkspaceExtensionsResources.resx" GenerateSource="true" Link="CSharpWorkspaceExtensionsResources.resx" />
<None Include="$(MSBuildThisFileDirectory)CSharpWorkspaceExtensionsResources.resx" />
</ItemGroup>
</Project>
\ No newline at end of file
......@@ -5,6 +5,7 @@
using System.Composition;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.LanguageServices;
namespace Microsoft.CodeAnalysis.CSharp
{
......@@ -13,5 +14,10 @@ internal class CSharpSyntaxKindsServiceFactory : ILanguageServiceFactory
{
public ILanguageService CreateLanguageService(HostLanguageServices languageServices)
=> CSharpSyntaxKindsService.Instance;
private sealed class CSharpSyntaxKindsService : CSharpSyntaxKinds, ISyntaxKindsService
{
public static readonly new CSharpSyntaxKindsService Instance = new CSharpSyntaxKindsService();
}
}
}
......@@ -6,13 +6,13 @@
using Microsoft.CodeAnalysis.Host;
namespace Microsoft.CodeAnalysis
namespace Microsoft.CodeAnalysis.LanguageServices
{
/// <summary>
/// Provides a uniform view of SyntaxKinds over C# and VB for constructs they have
/// in common.
/// </summary>
internal partial interface ISyntaxKindsService : ILanguageService
internal partial interface ISyntaxKindsService : ISyntaxKinds, ILanguageService
{
}
}
......@@ -34,6 +34,7 @@
<Compile Include="$(MSBuildThisFileDirectory)LanguageServices\Precedence\PrecedenceKind.cs" />
<Compile Include="$(MSBuildThisFileDirectory)LanguageServices\RemoveUnnecessaryImports\AbstractRemoveUnnecessaryImportsService.cs" />
<Compile Include="$(MSBuildThisFileDirectory)LanguageServices\RemoveUnnecessaryImports\IRemoveUnnecessaryImportsService.cs" />
<Compile Include="$(MSBuildThisFileDirectory)LanguageServices\SyntaxFactsService\ISyntaxKindsService.cs" />
<Compile Include="$(MSBuildThisFileDirectory)LanguageServices\TypeInferenceService\AbstractTypeInferenceService.AbstractTypeInferrer.cs" />
<Compile Include="$(MSBuildThisFileDirectory)LanguageServices\TypeInferenceService\AbstractTypeInferenceService.cs" />
<Compile Include="$(MSBuildThisFileDirectory)LanguageServices\TypeInferenceService\ITypeInferenceService.cs" />
......@@ -77,5 +78,6 @@
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)WorkspaceExtensionsResources.resx" GenerateSource="true" Link="WorkspaceExtensionsResources.resx" />
<None Include="$(MSBuildThisFileDirectory)WorkspaceExtensionsResources.resx" />
</ItemGroup>
</Project>
\ No newline at end of file
......@@ -5,6 +5,7 @@
Imports System.Composition
Imports Microsoft.CodeAnalysis.Host
Imports Microsoft.CodeAnalysis.Host.Mef
Imports Microsoft.CodeAnalysis.LanguageServices
Namespace Microsoft.CodeAnalysis.VisualBasic
<ExportLanguageServiceFactory(GetType(ISyntaxKindsService), LanguageNames.VisualBasic), [Shared]>
......@@ -14,5 +15,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Public Function CreateLanguageService(languageServices As HostLanguageServices) As ILanguageService Implements ILanguageServiceFactory.CreateLanguageService
Return VisualBasicSyntaxKindsService.Instance
End Function
Private NotInheritable Class VisualBasicSyntaxKindsService
Inherits VisualBasicSyntaxKinds
Implements ISyntaxKindsService
Public Shared Shadows ReadOnly Instance As New VisualBasicSyntaxKindsService
End Class
End Class
End Namespace
......@@ -52,6 +52,7 @@
<Compile Include="$(MSBuildThisFileDirectory)LanguageServices\VisualBasicSymbolDeclarationService.vb" />
<Compile Include="$(MSBuildThisFileDirectory)LanguageServices\VisualBasicSyntaxFactsService.vb" />
<Compile Include="$(MSBuildThisFileDirectory)LanguageServices\VisualBasicSyntaxFactsServiceFactory.vb" />
<Compile Include="$(MSBuildThisFileDirectory)LanguageServices\VisualBasicSyntaxKindsServiceFactory.vb" />
<Compile Include="$(MSBuildThisFileDirectory)LanguageServices\VisualBasicTypeInferenceService.TypeInferrer.vb" />
<Compile Include="$(MSBuildThisFileDirectory)LanguageServices\VisualBasicTypeInferenceService.vb" />
<Compile Include="$(MSBuildThisFileDirectory)Utilities\VisualBasicSimplificationHelpers.vb" />
......@@ -78,5 +79,6 @@
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)VisualBasicWorkspaceExtensionsResources.resx" GenerateSource="true" Link="VisualBasicWorkspaceExtensionsResources.resx" />
<None Include="$(MSBuildThisFileDirectory)VisualBasicWorkspaceExtensionsResources.resx" />
</ItemGroup>
</Project>
\ No newline at end of file
......@@ -41,7 +41,7 @@
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="VBWorkspaceResources.resx" GenerateSource="true" NAmespace="Microsoft.CodeAnalysis.VisualBasic"/>
<EmbeddedResource Update="VBWorkspaceResources.resx" GenerateSource="true" NAmespace="Microsoft.CodeAnalysis.VisualBasic" />
</ItemGroup>
<ItemGroup>
<Folder Include="Workspace\LanguageServices\" />
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册