diff options
author | Rafael Teixeira <monoman@gmail.com> | 2003-11-27 23:06:31 +0300 |
---|---|---|
committer | Rafael Teixeira <monoman@gmail.com> | 2003-11-27 23:06:31 +0300 |
commit | a22d633bef41358847f85ac4c92905e1f3765047 (patch) | |
tree | d705a81c43c855c5fbb8d15a956b0041d9876aae /mcs/class/System/Microsoft.VisualBasic | |
parent | 1e086738437d60c8358b90dd55ca01cd12f53131 (diff) |
* Microsoft.VisualBasic/VBCodeGenerator.cs: Support for Option Strict/Option Explicit
svn path=/trunk/mcs/; revision=20550
Diffstat (limited to 'mcs/class/System/Microsoft.VisualBasic')
-rw-r--r-- | mcs/class/System/Microsoft.VisualBasic/ChangeLog | 5 | ||||
-rw-r--r-- | mcs/class/System/Microsoft.VisualBasic/VBCodeGenerator.cs | 13 |
2 files changed, 17 insertions, 1 deletions
diff --git a/mcs/class/System/Microsoft.VisualBasic/ChangeLog b/mcs/class/System/Microsoft.VisualBasic/ChangeLog index 17e5231cc39..839213bdc0f 100644 --- a/mcs/class/System/Microsoft.VisualBasic/ChangeLog +++ b/mcs/class/System/Microsoft.VisualBasic/ChangeLog @@ -1,3 +1,7 @@ +2003-11-27 Rafael Teixeira <rafaelteixeirabr@hotmail.com> + + * Microsoft.VisualBasic/VBCodeGenerator.cs: Support for Option Strict/Option Explicit + 2003-11-27 Jackson Harper <jackson@ximian.com> * VBCodeCompiler.cs: Put a space between Property and the @@ -54,4 +58,3 @@ these options) * VBCodeProvider.cs: Added and implemented - diff --git a/mcs/class/System/Microsoft.VisualBasic/VBCodeGenerator.cs b/mcs/class/System/Microsoft.VisualBasic/VBCodeGenerator.cs index c69bcffb28c..04f917bccc3 100644 --- a/mcs/class/System/Microsoft.VisualBasic/VBCodeGenerator.cs +++ b/mcs/class/System/Microsoft.VisualBasic/VBCodeGenerator.cs @@ -129,6 +129,16 @@ namespace Microsoft.VisualBasic output.Write (")"); } + private bool AsBool(object datavalue) + { + return datavalue != null && datavalue is bool && (bool)datavalue; + } + + private string OnOff(bool datavalue) + { + return datavalue?"On":"Off"; + } + protected override void GenerateCompileUnitStart (CodeCompileUnit compileUnit) { GenerateComment (new CodeComment ("------------------------------------------------------------------------------")); @@ -141,6 +151,9 @@ namespace Microsoft.VisualBasic GenerateComment (new CodeComment (" </autogenerated>")); GenerateComment (new CodeComment ("------------------------------------------------------------------------------")); Output.WriteLine (); + Output.WriteLine("Option Explicit {0}",OnOff(AsBool(compileUnit.UserData["RequireVariableDeclaration"]))); + Output.WriteLine("Option Strict {0}",OnOff(!AsBool(compileUnit.UserData["AllowLateBound"]))); + Output.WriteLine (); } protected override void GenerateDelegateCreateExpression (CodeDelegateCreateExpression expression) |