提交 08d4f343 编写于 作者: D Dustin Campbell

Change internal property name from IsScript to IsScriptCommandLineParser

上级 b74c5293
......@@ -18,12 +18,12 @@ namespace Microsoft.CodeAnalysis.CSharp
public class CSharpCommandLineParser : CommandLineParser
{
public static CSharpCommandLineParser Default { get; } = new CSharpCommandLineParser();
public static CSharpCommandLineParser Script { get; } = new CSharpCommandLineParser(isScript: true);
public static CSharpCommandLineParser Script { get; } = new CSharpCommandLineParser(isScriptCommandLineParser: true);
private readonly static char[] s_quoteOrEquals = new[] { '"', '=' };
internal CSharpCommandLineParser(bool isScript = false)
: base(CSharp.MessageProvider.Instance, isScript)
internal CSharpCommandLineParser(bool isScriptCommandLineParser = false)
: base(CSharp.MessageProvider.Instance, isScriptCommandLineParser)
{
}
......@@ -47,8 +47,8 @@ public new CSharpCommandLineArguments Parse(IEnumerable<string> args, string bas
{
List<Diagnostic> diagnostics = new List<Diagnostic>();
List<string> flattenedArgs = new List<string>();
List<string> scriptArgs = IsScript ? new List<string>() : null;
List<string> responsePaths = IsScript ? new List<string>() : null;
List<string> scriptArgs = IsScriptCommandLineParser ? new List<string>() : null;
List<string> responsePaths = IsScriptCommandLineParser ? new List<string>() : null;
FlattenArgs(args, diagnostics, flattenedArgs, scriptArgs, baseDirectory, responsePaths);
string appConfigPath = null;
......@@ -65,7 +65,7 @@ public new CSharpCommandLineArguments Parse(IEnumerable<string> args, string bas
DebugInformationFormat debugInformationFormat = PathUtilities.IsUnixLikePlatform ? DebugInformationFormat.PortablePdb : DebugInformationFormat.Pdb;
bool debugPlus = false;
string pdbPath = null;
bool noStdLib = IsScript; // don't add mscorlib from sdk dir when running scripts
bool noStdLib = IsScriptCommandLineParser; // don't add mscorlib from sdk dir when running scripts
string outputDirectory = baseDirectory;
ImmutableArray<KeyValuePair<string, string>> pathMap = ImmutableArray<KeyValuePair<string, string>>.Empty;
string outputFileName = null;
......@@ -129,7 +129,7 @@ public new CSharpCommandLineArguments Parse(IEnumerable<string> args, string bas
// Process ruleset files first so that diagnostic severity settings specified on the command line via
// /nowarn and /warnaserror can override diagnostic severity settings specified in the ruleset file.
if (!IsScript)
if (!IsScriptCommandLineParser)
{
foreach (string arg in flattenedArgs)
{
......@@ -207,7 +207,7 @@ public new CSharpCommandLineArguments Parse(IEnumerable<string> args, string bas
#endif
}
if (IsScript)
if (IsScriptCommandLineParser)
{
switch (name)
{
......@@ -1193,7 +1193,7 @@ public new CSharpCommandLineArguments Parse(IEnumerable<string> args, string bas
AddDiagnostic(diagnostics, diagnosticOptions, ErrorCode.ERR_NoNetModuleOutputWhenRefOutOrRefOnly);
}
if (!IsScript && !sourceFilesSpecified && (outputKind.IsNetModule() || !resourcesOrModulesSpecified))
if (!IsScriptCommandLineParser && !sourceFilesSpecified && (outputKind.IsNetModule() || !resourcesOrModulesSpecified))
{
AddDiagnostic(diagnostics, diagnosticOptions, ErrorCode.WRN_NoSources);
}
......@@ -1261,7 +1261,7 @@ public new CSharpCommandLineArguments Parse(IEnumerable<string> args, string bas
languageVersion: languageVersion,
preprocessorSymbols: defines.ToImmutableAndFree(),
documentationMode: parseDocumentationComments ? DocumentationMode.Diagnose : DocumentationMode.None,
kind: IsScript ? SourceCodeKind.Script : SourceCodeKind.Regular,
kind: IsScriptCommandLineParser ? SourceCodeKind.Script : SourceCodeKind.Regular,
features: parsedFeatures
);
......@@ -1318,8 +1318,8 @@ public new CSharpCommandLineArguments Parse(IEnumerable<string> args, string bas
return new CSharpCommandLineArguments
{
IsScriptRunner = IsScript,
InteractiveMode = interactiveMode || IsScript && sourceFiles.Count == 0,
IsScriptRunner = IsScriptCommandLineParser,
InteractiveMode = interactiveMode || IsScriptCommandLineParser && sourceFiles.Count == 0,
BaseDirectory = baseDirectory,
PathMap = pathMap,
Errors = diagnostics.AsImmutable(),
......@@ -1432,7 +1432,7 @@ private static string GetWin32Setting(string arg, string value, List<Diagnostic>
// names from the files containing their entrypoints and libraries derive their names from
// their first input files.
if (!IsScript && !sourceFilesSpecified)
if (!IsScriptCommandLineParser && !sourceFilesSpecified)
{
AddDiagnostic(diagnostics, ErrorCode.ERR_OutputNeedsName);
simpleName = null;
......@@ -1466,7 +1466,7 @@ private static string GetWin32Setting(string arg, string value, List<Diagnostic>
if (outputKind.IsNetModule())
{
Debug.Assert(!IsScript);
Debug.Assert(!IsScriptCommandLineParser);
compilationName = moduleAssemblyName;
}
......@@ -1508,7 +1508,7 @@ private ImmutableArray<string> BuildSearchPaths(string sdkDirectoryOpt, List<str
// with references relative to csi.exe (e.g. System.ValueTuple.dll).
if (responsePathsOpt != null)
{
Debug.Assert(IsScript);
Debug.Assert(IsScriptCommandLineParser);
builder.AddRange(responsePathsOpt);
}
......
......@@ -17,14 +17,14 @@ namespace Microsoft.CodeAnalysis
public abstract class CommandLineParser
{
private readonly CommonMessageProvider _messageProvider;
internal readonly bool IsScript;
internal readonly bool IsScriptCommandLineParser;
private static readonly char[] s_searchPatternTrimChars = new char[] { '\t', '\n', '\v', '\f', '\r', ' ', '\x0085', '\x00a0' };
internal CommandLineParser(CommonMessageProvider messageProvider, bool isScript)
internal CommandLineParser(CommonMessageProvider messageProvider, bool isScriptCommandLineParser)
{
Debug.Assert(messageProvider != null);
_messageProvider = messageProvider;
IsScript = isScript;
IsScriptCommandLineParser = isScriptCommandLineParser;
}
internal CommonMessageProvider MessageProvider
......@@ -793,7 +793,7 @@ private CommandLineSourceFile ToCommandLineSourceFile(string resolvedPath)
string extension = PathUtilities.GetExtension(resolvedPath);
bool isScriptFile;
if (IsScript)
if (IsScriptCommandLineParser)
{
isScriptFile = !string.Equals(extension, RegularFileExtension, StringComparison.OrdinalIgnoreCase);
}
......@@ -809,7 +809,7 @@ private CommandLineSourceFile ToCommandLineSourceFile(string resolvedPath)
internal IEnumerable<CommandLineSourceFile> ParseFileArgument(string arg, string baseDirectory, IList<Diagnostic> errors)
{
Debug.Assert(IsScript || !arg.StartsWith("-", StringComparison.Ordinal) && !arg.StartsWith("@", StringComparison.Ordinal));
Debug.Assert(IsScriptCommandLineParser || !arg.StartsWith("-", StringComparison.Ordinal) && !arg.StartsWith("@", StringComparison.Ordinal));
// We remove all doubles quotes from a file name. So that, for example:
// "Path With Spaces"\goo.cs
......
......@@ -25,14 +25,14 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
''' <summary>
''' Gets the current interactive command line parser.
''' </summary>
Public Shared ReadOnly Property Script As New VisualBasicCommandLineParser(isScript:=True)
Public Shared ReadOnly Property Script As New VisualBasicCommandLineParser(isScriptCommandLineParser:=True)
''' <summary>
''' Creates a new command line parser.
''' </summary>
''' <param name="isScript">An optional parameter indicating whether to create a interactive command line parser.</param>
Friend Sub New(Optional isScript As Boolean = False)
MyBase.New(VisualBasic.MessageProvider.Instance, isScript)
''' <param name="isScriptCommandLineParser">An optional parameter indicating whether to create a interactive command line parser.</param>
Friend Sub New(Optional isScriptCommandLineParser As Boolean = False)
MyBase.New(VisualBasic.MessageProvider.Instance, isScriptCommandLineParser)
End Sub
Private Const s_win32Manifest As String = "win32manifest"
......@@ -76,7 +76,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Dim diagnostics As List(Of Diagnostic) = New List(Of Diagnostic)()
Dim flattenedArgs As List(Of String) = New List(Of String)()
Dim scriptArgs As List(Of String) = If(IsScript, New List(Of String)(), Nothing)
Dim scriptArgs As List(Of String) = If(IsScriptCommandLineParser, New List(Of String)(), Nothing)
' normalized paths to directories containing response files:
Dim responsePaths As New List(Of String)
......@@ -163,7 +163,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
' Process ruleset files first so that diagnostic severity settings specified on the command line via
' /nowarn and /warnaserror can override diagnostic severity settings specified in the ruleset file.
If Not IsScript Then
If Not IsScriptCommandLineParser Then
For Each arg In flattenedArgs
Dim name As String = Nothing
Dim value As String = Nothing
......@@ -418,7 +418,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
#End If
End Select
If IsScript Then
If IsScriptCommandLineParser Then
Select Case name
Case "i", "i+"
If value IsNot Nothing Then
......@@ -1205,7 +1205,7 @@ lVbRuntimePlus:
AddDiagnostic(diagnostics, ERRID.ERR_NoNetModuleOutputWhenRefOutOrRefOnly)
End If
If Not IsScript AndAlso Not hasSourceFiles AndAlso managedResources.IsEmpty() Then
If Not IsScriptCommandLineParser AndAlso Not hasSourceFiles AndAlso managedResources.IsEmpty() Then
' VB displays help when there is nothing specified on the command line
If flattenedArgs.Any Then
AddDiagnostic(diagnostics, ERRID.ERR_NoSources)
......@@ -1300,7 +1300,7 @@ lVbRuntimePlus:
Dim compilationName As String = Nothing
GetCompilationAndModuleNames(diagnostics, outputKind, sourceFiles, moduleAssemblyName, outputFileName, moduleName, compilationName)
If Not IsScript AndAlso
If Not IsScriptCommandLineParser AndAlso
Not hasSourceFiles AndAlso
Not managedResources.IsEmpty() AndAlso
outputFileName = Nothing AndAlso
......@@ -1312,7 +1312,7 @@ lVbRuntimePlus:
Dim parseOptions = New VisualBasicParseOptions(
languageVersion:=languageVersion,
documentationMode:=If(parseDocumentationComments, DocumentationMode.Diagnose, DocumentationMode.None),
kind:=If(IsScript, SourceCodeKind.Script, SourceCodeKind.Regular),
kind:=If(IsScriptCommandLineParser, SourceCodeKind.Script, SourceCodeKind.Regular),
preprocessorSymbols:=AddPredefinedPreprocessorSymbols(outputKind, defines.AsImmutableOrEmpty()),
features:=parsedFeatures)
......@@ -1369,11 +1369,11 @@ lVbRuntimePlus:
' Enable interactive mode if either `\i` option is passed in or no arguments are specified (`vbi`, `vbi script.vbx \i`).
' If the script is passed without the `\i` option simply execute the script (`vbi script.vbx`).
interactiveMode = interactiveMode Or (IsScript AndAlso sourceFiles.Count = 0)
interactiveMode = interactiveMode Or (IsScriptCommandLineParser AndAlso sourceFiles.Count = 0)
Return New VisualBasicCommandLineArguments With
{
.IsScriptRunner = IsScript,
.IsScriptRunner = IsScriptCommandLineParser,
.InteractiveMode = interactiveMode,
.BaseDirectory = baseDirectory,
.Errors = diagnostics.AsImmutable(),
......@@ -2240,7 +2240,7 @@ lVbRuntimePlus:
End If
If kind.IsNetModule() Then
Debug.Assert(Not IsScript)
Debug.Assert(Not IsScriptCommandLineParser)
compilationName = moduleAssemblyName
Else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册