Imported Upstream version 4.2.0.179

Former-commit-id: 4610231f55806d2a05ed69e5ff3faa7336cc1479
This commit is contained in:
Xamarin Public Jenkins
2015-08-26 07:17:56 -04:00
committed by Jo Shields
parent aa7da660d6
commit c042cd0c52
7507 changed files with 90259 additions and 657307 deletions

View File

@@ -50,6 +50,7 @@ namespace Microsoft.VisualBasic
{
static string windowsMonoPath;
static string windowsvbncPath;
static string unixVbncCommand;
static VBCodeCompiler ()
{
@@ -69,6 +70,13 @@ namespace Microsoft.VisualBasic
"bin\\mono.exe");
windowsvbncPath =
Path.Combine (p, "2.0\\vbnc.exe");
} else {
var mscorlibPath = new Uri (typeof (object).Assembly.CodeBase).LocalPath;
var unixMcsPath = Path.GetFullPath (Path.Combine (mscorlibPath, "..", "..", "..", "..", "bin", "vbnc"));
if (File.Exists (unixMcsPath))
unixVbncCommand = unixMcsPath;
else
unixVbncCommand = "vbnc";
}
}

View File

@@ -93,6 +93,9 @@ namespace Microsoft.VisualBasic
"While", "With", "WithEvents", "WriteOnly",
"Xor"
};
private CodeAttributeDeclarationCollection assemblyCustomAttributes;
public VBCodeGenerator()
{
}
@@ -229,13 +232,17 @@ namespace Microsoft.VisualBasic
protected override void GenerateCompileUnit (CodeCompileUnit compileUnit)
{
assemblyCustomAttributes = compileUnit.AssemblyCustomAttributes;
GenerateCompileUnitStart (compileUnit);
OutputAttributes (compileUnit.AssemblyCustomAttributes,
"Assembly: ", LineHandling.NewLine);
GenerateNamespaces (compileUnit);
// In the case there are no namespaces, and hence no Import statements, now
// is the time to emit assembly level attributes.
if (assemblyCustomAttributes != null)
GenerateAssemblyAttributes ();
GenerateCompileUnitEnd (compileUnit);
}
@@ -1026,7 +1033,14 @@ namespace Microsoft.VisualBasic
protected override void GenerateNamespace(CodeNamespace ns)
{
GenerateNamespaceImports (ns);
// Assembly level attributes can't be emitted before the Import statements
// in the file.
if (assemblyCustomAttributes != null)
GenerateAssemblyAttributes ();
Output.WriteLine ();
GenerateCommentStatements (ns.Comments);
GenerateNamespaceStart (ns);
GenerateTypes (ns);
@@ -1650,6 +1664,13 @@ namespace Microsoft.VisualBasic
return (attributes & MemberAttributes.ScopeMask) == MemberAttributes.Abstract;
}
private void GenerateAssemblyAttributes ()
{
OutputAttributes (assemblyCustomAttributes,
"Assembly: ", LineHandling.NewLine);
assemblyCustomAttributes = null;
}
private enum LineHandling
{
InLine,