Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIain McCoy <iainmc@mono-cvs.ximian.com>2005-07-06 17:14:16 +0400
committerIain McCoy <iainmc@mono-cvs.ximian.com>2005-07-06 17:14:16 +0400
commit4dbdbff7c74b35139149877731d3ff53135de1f1 (patch)
tree4f26380d0fd53a793b0cfc9fc5ffa21d9e091072
parent3516d1dbdd3a13bcd12cdccd779a01fd16a103c1 (diff)
2005-07-06 Iain McCoy <iain@mccoy.id.au>
* Mono.Windows.Serialization/CodeWriter.cs: cleaned up a little, added support for the `partial' class modifier * xamlc.cs: add support for emitting classes with the partial modifier set svn path=/trunk/mcs/; revision=46995
-rw-r--r--mcs/class/PresentationFramework/ChangeLog5
-rw-r--r--mcs/class/PresentationFramework/Mono.Windows.Serialization/CodeWriter.cs15
-rw-r--r--mcs/tools/xamlc/ChangeLog5
-rw-r--r--mcs/tools/xamlc/demo/Makefile4
-rw-r--r--mcs/tools/xamlc/xamlc.cs12
5 files changed, 38 insertions, 3 deletions
diff --git a/mcs/class/PresentationFramework/ChangeLog b/mcs/class/PresentationFramework/ChangeLog
index 1d8af02c8f7..21baffd7d49 100644
--- a/mcs/class/PresentationFramework/ChangeLog
+++ b/mcs/class/PresentationFramework/ChangeLog
@@ -1,5 +1,10 @@
2005-07-06 Iain McCoy <iain@mccoy.id.au>
+ * Mono.Windows.Serialization/CodeWriter.cs: cleaned up a little, added
+ support for the `partial' class modifier
+
+2005-07-06 Iain McCoy <iain@mccoy.id.au>
+
* Mono.Windows.Serialization/Mapping.cs: removed in favour of
System.Windows.Serialization/Mapper.cs
* System.Windows.Serialization/Mapper.cs: Added because it is the
diff --git a/mcs/class/PresentationFramework/Mono.Windows.Serialization/CodeWriter.cs b/mcs/class/PresentationFramework/Mono.Windows.Serialization/CodeWriter.cs
index 578a30677ee..8ac2792deca 100644
--- a/mcs/class/PresentationFramework/Mono.Windows.Serialization/CodeWriter.cs
+++ b/mcs/class/PresentationFramework/Mono.Windows.Serialization/CodeWriter.cs
@@ -36,6 +36,9 @@ using System.CodeDom.Compiler;
namespace Mono.Windows.Serialization {
public class CodeWriter : XamlWriter {
TextWriter writer;
+ ICodeGenerator generator;
+ bool isPartial;
+
ArrayList objects = new ArrayList();
Hashtable nameClashes = new Hashtable();
int tempIndex = 0;
@@ -45,9 +48,11 @@ namespace Mono.Windows.Serialization {
CodeConstructor constructor;
// pushes: the code writer
- public CodeWriter(TextWriter writer)
+ public CodeWriter(ICodeGenerator generator, TextWriter writer, bool isPartial)
{
+ this.generator = generator;
this.writer = writer;
+ this.isPartial = isPartial;
code = new CodeCompileUnit();
objects.Add(code);
}
@@ -67,6 +72,13 @@ namespace Mono.Windows.Serialization {
((CodeCompileUnit)objects[0]).Namespaces.Add(ns);
type = new CodeTypeDeclaration(className);
+ if (isPartial) {
+#if NET_2_0
+ type.IsPartial = isPartial;
+#else
+ throw new Exception("Cannot create partial class");
+#endif
+ }
type.BaseTypes.Add(new CodeTypeReference(parent));
constructor = new CodeConstructor();
type.Members.Add(constructor);
@@ -238,7 +250,6 @@ namespace Mono.Windows.Serialization {
public void Finish()
{
- ICodeGenerator generator = (new Microsoft.CSharp.CSharpCodeProvider()).CreateGenerator();
generator.GenerateCodeFromCompileUnit(code, writer, null);
writer.Close();
}
diff --git a/mcs/tools/xamlc/ChangeLog b/mcs/tools/xamlc/ChangeLog
index dfe75513764..74749a7b94e 100644
--- a/mcs/tools/xamlc/ChangeLog
+++ b/mcs/tools/xamlc/ChangeLog
@@ -1,5 +1,10 @@
2005-07-06 Iain McCoy <iain@mccoy.id.au>
+ * xamlc.cs: add support for emitting classes with the partial modifier
+ set
+
+2005-07-06 Iain McCoy <iain@mccoy.id.au>
+
* demo/TestVocab/ConsoleApp.cs: remove default value hack, since we
have proper default value support now
diff --git a/mcs/tools/xamlc/demo/Makefile b/mcs/tools/xamlc/demo/Makefile
index 1b8d615487c..1c925b6c497 100644
--- a/mcs/tools/xamlc/demo/Makefile
+++ b/mcs/tools/xamlc/demo/Makefile
@@ -4,11 +4,15 @@ include ../../../build/rules.make
SOURCES=TestVocab/ConsoleApp.cs TestVocab/ConsoleWriter.cs TestVocab/IConsoleAction.cs
run:
+ make clean
make TestVocab.dll
MONO_PATH="." $(RUNTIME) --debug ../xamlc.exe -o:test.xaml.out.cs test.xaml
$(CSCOMPILE) -r:TestVocab.dll -o test.exe test.xaml.out.cs
$(RUNTIME) --debug test.exe
+clean-local:
+ rm -f TestVocab.dll test.xaml.out.cs
+
all-local: TestVocab.dll
TestVocab.dll: $(SOURCES)
diff --git a/mcs/tools/xamlc/xamlc.cs b/mcs/tools/xamlc/xamlc.cs
index 0341db85a2d..2759f32c642 100644
--- a/mcs/tools/xamlc/xamlc.cs
+++ b/mcs/tools/xamlc/xamlc.cs
@@ -28,10 +28,15 @@
using System;
using System.IO;
+using System.CodeDom;
+using System.CodeDom.Compiler;
using Mono.GetOptions;
using Mono.Windows.Serialization;
class XamlOptions : Options {
+ [Option("Whether or not the class should be marked as partial", "p", "partial")]
+ public bool Partial;
+
[Option("the file to output to", "o", "output")]
public string OutputFile;
}
@@ -42,11 +47,16 @@ class Driver {
Console.WriteLine("Input filenames must end in .xaml");
return;
}
+ if (Environment.Version.Major < 2 && options.Partial) {
+ Console.WriteLine("This runtime version does not support partial classes");
+ return;
+ }
if (options.OutputFile == null) {
options.OutputFile = input + ".out";
}
+ ICodeGenerator generator = (new Microsoft.CSharp.CSharpCodeProvider()).CreateGenerator();
TextWriter tw = new StreamWriter(options.OutputFile);
- CodeWriter cw = new CodeWriter(tw);
+ CodeWriter cw = new CodeWriter(generator, tw, options.Partial);
XamlParser r = new XamlParser(input, cw);
r.Parse();
}