when beginning Type generation. This prevents "invalid"
`#endregion`s; if the CodeGenerator instance is reused for multiple
types, the last member of the first type has an EndDirective, then
the EndDirectvies will be generated before any members of the 2nd
type. Don't do that.
* Test/System.CodeDom.Compiler/CodeGeneratorTest.cs: Add some testing
for CodeRegionDirectives.
svn path=/trunk/mcs/; revision=155321
* CodeGeneratorFromTypeTest.cs: Added tests for static and abstract
property.
* ComponentConverterTests.cs: Allow test to be compiled using csc 1.x.
* ExecutorTest.cs: Use Assert.Ignore when ping is not available.
Avoid using ExpectedException in ExecWait test, and added link to
MS bug report.
svn path=/trunk/mcs/; revision=102229
Test/System.CodeDom.Compiler/CodeGeneratorFromTypeTestBase.cs,
Test/Microsoft.VisualBasic/CodeGeneratorFromTypeTest.cs: Added
PartialTypeTest.
* Microsoft.VisualBasic/VBCodeGenerator.cs: Split array of keywords in
two, one for 1.1 and one for 2.0. Add some 2.0 specific keywords.
When writing a type, escape the name of the type if necessary.
Output "Partial" if a type is partial.
svn path=/trunk/mcs/; revision=91780
* Codegenerator.cs: I noticed an `unreachable code' warning while
building Mono:
System.CodeDom.Compiler/CodeGenerator.cs(1229,42): warning CS0162:
Unreachable code detected
This turned out to be in the method
CodeGenerator.IsValidLanguageIndependentIdentifier, which was
broken.
The following patch contains a unit test to demonstrate the
problem (checked against MS.NET), and a fix to CodeGenerator.cs.
svn path=/trunk/mcs/; revision=73782
* CodeTypeReference.cs :
Support generic type definition in .ctor(Type)
Handle generic type in straightforward way in .ctor(Type), no need
to do ToString() and Parse().
Supply "`n" in .ctor(string,params CodeTypeReference[]).
* CSharpCodeGenerator.cs : for GenericTypeParameter, GetTypeOutput()
should just print its name.
For generic type definition, print "<>". OutputTypeArguments() was
also causing IndexOutOfRangeException.
* CodeGeneratorFromTypeTestBase.cs :
added GenerateGenericCodeTypeReferences() for generic type test.
* CodeGeneratorFromTypeTest.cs :
Added test for generic type references output.
* CodeTypeReferenceTest.cs :
Fixed generic type tests and let them involved in the actual tests.
Added some more generic type tests, including generic type
definition.
svn path=/trunk/mcs/; revision=71244
CodeAssignStatement, CodeAttachEventStatement,
CodeConditionStatement, CodeExpressionStatement,
CodeIterationStatement, CodeLabeledStatement,
CodeMethodReturnStatement, CodeRemoveEventStatement,
CodeSnippetStatement, CodeStatement, CodeVariableDeclarationStatement.
* CodeRemoveEventStatementTest.cs: Added tests for ctors.
* IndentedTextWriterTest.cs: Added tests for Indent property.
* CodeGeneratorFromStatementTest.cs: Added tests for
CodeAssignStatement, CodeAttachEventStatement, CodeConditionStatement,
CodeExpressionStatement, CodeIterationStatement,
CodeLabeledStatement, CodeMethodReturnStatement,
CodeRemoveEventStatement and CodeSnippetStatement.
* CSharpCodeGenerator.cs: No longer output semicolon and newline for
CodeVariableDeclarationStatement in for statement, fixes#75292.
Fixed NRE in GenerateEventReferenceExpression. Cosmetic changes to
code generated for iteration to match MS.NET. Temporary reduce
indentation for label and no longer escape label if its a keyword.
* CodeRemoveEventStatement.cs: Event returns new CodeEventReference
if underlying value is null.
* System_test.dll.sources: Added CodeRemoveEventStatementTest.cs from
System.CodeDom.
* CodeGenerator.cs: Corrected line endings. Set eol-style to native.
* IndentedTextWriter.cs: Indent can no longer become negative.
* VBCodeGenerator.cs: Fixed NRE in GenerateEventReferenceExpression,
and escape event name. Indent statements for iteration. Avoid
ArgumentNullException if expression is not set for CodeReturnStatement.
Temporary reduce indentation for label, and fixed ArgumentNullException
if no statement is set. Cosmetic changes to code generated for
condition to match MS.NET. In OutputTypeNamePair, escape name.
svn path=/trunk/mcs/; revision=53703
CodeParameterDeclarationExpression.
* CodeGeneratorFromTypeTest.cs: Modified tests to check result
for zero-length event, field and parameter name.
* CodeGeneratorFromStatementTest.cs: Added CodeCommentStatement,
CodeThrowExceptionStatement, CodeGotoStatement and
CodeTryCatchFinallyStatement tests.
* CodeGeneratorFromTypeTestBase.cs: Modified GetMethodMembersType3 to
add parameter with no name.
* CodeGeneratorTestBase.cs: Removed Code property, added Generate
overload taking CodeGeneratorOptions, added NewLine property.
* CodeGeneratorCompileUnitTest.cs: Use Generate method instead of
Code property.
* CodeGeneratorFromExpressionTest.cs: Added test for
CodeParameterDeclarationExpression.
* CodeGeneratorFromTypeTest.cs: Added tests for __exception name that
is output for zero-length field, event and parameter name in 2.0
profile.
* CodeGeneratorFromStatementTest.cs: Added.
* CSharpCodeGenerator.cs: Fixed GenerateComment to also write
comment chars for carriage-return (and skip linefeed, if its the
next character). Fixed output for TryCatchFinallyStatement. Fixed
GotoStatement to end with newline.
* VBCodeGenerator.cs: Fixed NullReferenceException if no ToThrow
expression is set for CodeThrowExceptionStatement. Fixed
GenerateComment to output comment chars for carriage-returns and
linefeed characters. Modified code generated for
CodeTryCatchFinallyStatement to match MS.NET. Fixed code generated
for CodeGotoStatement to match MS.NET. On 2.0 profile, output
"__exception" if name is zero-length string in OutputTypeNamePair.
svn path=/trunk/mcs/; revision=53506
* CodeCompilerCas.cs: New. CAS unit tests.
* ExecutorCas.cs: New. CAS unit tests.
* ExecutorTest.cs: New. Unit tests for Executor.
svn path=/trunk/mcs/; revision=52476
and bug #76580.
* CodeGeneratorTestBase.cs: Set eol-style to native.
* CodeGeneratorTest.cs: Set eol-style to native.
* CodeGeneratorFromTypeTestBase.cs: Added tests for
CodeEntryPointMethod and bug #76580. Set eol-style to native.
* IndentedTextWriterTest.cs: Set eol-style to native.
* CodeGeneratorFromTypeTest.cs: Added tests for CodeEntryPointMethod
and bug #76580.
* CSharpCodeGenerator.cs: Use fixed signature for entrypoint method
on 1.0 profile. On 2.0 profile output custom attributes, and return
type. On 1.0 profile, also replace + with dot (for nested types).
Fixes bug #76580. Set eol-style to native.
* CSharpCodeCompiler.cs: Set eol-style to native.
* CSharpCodeProvider.cs: Set eol-style to native.
* VBCodeGenerator.cs: Use fixed signature for entrypoint method.
Only output attributes on 2.0 profile. Replace + with dot in type
name (for nested types). Fixes bug #76580.
svn path=/trunk/mcs/; revision=52344
* CompilerErrorCas.cs: Under 1.x CompilerError is protected by a
LinkDemand for Unrestricted.
* CompilerErrorCollectionCas.cs: Under 1.x CompilerError is protected
by a LinkDemand for Unrestricted.
* TempFileCollectionCas.cs: Moved precompiler directive to the right
method (to ignore a test under MS 1.x).
svn path=/trunk/mcs/; revision=52193
* TempFileCollectionCas.cs: New. CAS unit tests.
* TempFileCollectionTest.cs: New. Very basic tests to check the
behaviour of the TempDir property.
svn path=/trunk/mcs/; revision=52180
* CodeGeneratorOptionsCas.cs: New. CAS unit tests.
* CodeGeneratorOptionsTest.cs: New. Unit tests.
* CodeParserCas.cs: New. CAS unit tests.
* CompilerErrorCas.cs: New. CAS unit tests.
* CompilerErrorCollectionCas.cs: New. CAS unit tests.
* CompilerInfoCas.cs: New. CAS unit tests.
* CompilerParametersCas.cs: New. CAS unit tests.
* CompilerResultsCas.cs: New. CAS unit tests.
* GeneratedCodeAttributeCas.cs: New. CAS unit tests.
* GeneratedCodeAttributeTest.cs: New. Unit tests.
* IndentedTextWriterCas.cs: New. CAS unit tests.
svn path=/trunk/mcs/; revision=52160
and takes CodeGeneratorOptions instance in order to support testing
bracing style.
* CodeGeneratorFromCompileUnitTest.cs: Added tests for C bracing style.
* CodeGeneratorFromNamespaceTest.cs: Added tests for C bracing style.
* CodeGeneratorFromExpressionTest.cs: Clean up.
* CodeGeneratorFromTypeTest.cs: Added tests for C bracing style.
* CodeGeneratorTestBase.cs: No longer keep instance of StringWriter to
allow GenerateCodeFromType to be executed multiple times with relying
on user to reset writer. Allow CodeGeneratorOptions to be passed in,
in order to support bracing style tests.
* CodeGeneratorFromTypeTestBase.cs: Modify Generate* methods to take
CodeGeneratorOptions instance and pass it on to GenerateCodeFromType.
* CodeGeneratorFromTypeTest.cs: Reworked tests to pass
CodeGeneratorOptions to Generate* methods.
* CodeGeneratorTestBase.cs: Generate now returns code that was output,
and take CodeGeneratorOptions instance in order to support testing
bracing style.
* CodeGeneratorFromCompileUnitTest.cs: Added tests for C bracing style.
* CodeGeneratorFromNamespaceTest.cs: Added tests for C bracing style.
* CodeGeneratorFromExpressionTest.cs: Clean up.
* CodeGeneratorFromTypeTest.cs: Added tests for C bracing style.
* CSharpCodeGenerator.cs: Support C bracing style. Fixes bug #76286.
svn path=/trunk/mcs/; revision=51753
tests. Added enum, interface and delegate tests.
* CodeTypeDelegateTest.cs: Added tests for BaseTypes and ReturnType.
* CodeGeneratorTest.cs: Removed duplicate import of NUNit.Framework namespace.
* CodeGeneratorFromTypeTestBase.cs: Added BaseTypes and TypeConstructor tests.
* CodeGeneratorFromTypeTest.cs: Added BaseTypes and TypeConstructor
tests. Enabled enum, interface and delegate tests.
* CSharpCodeGenerator.cs: Fixed generated code for enums, interfaces
and delegates to match MS.NET.
* CodeTypeReference.cs: Added internal IsInterface property.
* CodeTypeDelegate.cs: System.Delegate is base type, and make sure
ReturnType is initialized.
* System_test.dll.sources: Added CodeTypeDelegateTest.cs from System.CodeDom.
* CodeGenerator.cs: Threat delegates like any other type.
* VBCodeGenerator.cs: Fixed generated code for enums, interfaces and
delegates to match MS.NET.
svn path=/trunk/mcs/; revision=47604
CodeGenerator.GenerateCodeFromType.
* CodeGeneratorTestBase.cs: Base class for CodeGenerator unit tests.
* CodeGeneratorFromTypeTest.cs: Inherit from
System.CodeDom.CodeGeneratorFromTypeTestBase. Added testfixture
for testing enum, interface and delegate, but for now these are
marked NotWorking.
* System_test.dll.sources: Added CodeGeneratorFromTypeTestBase.cs
and CodeGeneratorTestBase.cs from System.CodeDom.Compiler.
svn path=/trunk/mcs/; revision=47496