Supported Constructs
Since not every language might support all the constructs CodeDom can represent, there needs to be a way for the CodeDom Provider to specify which constructs are supported and which ones are not. This is done through the System.Codedom.Compiler.ICodeGenerator
interface using method Supports
.
This method takes a flag corresponding to the CodeDom contruct the caller is interested in and returns a boolean value indicating whether or not the construct is supported. In the Eiffel CodeDom Provider implementation there is a third category of constructs which will be reported as supported since the provider will generate valid Eiffel code for them but that should be distinguished from other "truly" supported constructs as the generated code will not correspond to the .NET equivalent of the construct.
Let's take an example: Enum declarations are supported by the Eiffel CodeDom Provider because the generated Eiffel code will correctly make use of the values defined in the enum. However there is no such thing as an enum type in Eiffel so there won't be a corresponding .NET enum type in the generated assembly. Such constructs are said to be "non-roundtripable" because even if the Eiffel CodeDom Provider supported parsing source code, the corresponding CodeDom tree would not include the constructs like the initial CodeDom did.
The lists of supported, supported without roundtrip and unsupported constructs for the Eiffel CodeDom Provider are as follows:
Supported constructs:
- Arrays of arrays
- Assembly attributes
- Complex expressions
- Declare value types
- Entry point method
- Multiple interface members
Supported constructs (no roundtrip):
- Declare enums
- Declare events
- Declare interfaces
- Nested types
- Public static members
- Reference parameters
- Try catch statements
Unsupported constructs:
- Chained constructor arguments
- Declare delegates
- Goto statements
- Multidimensional arrays
- Parameter attributes
- Return type attributes
- Static constructors
- Win32 resources