Implemented PipeSecurity. GetAccessControl, SetAccessControl, and ACL-containing...
[mono.git] / mcs / mcs / eval.cs
index 1bff22cfe3094c67720867c3fa6a8cd3ea652223..c448d2b0d3705b751fe019411be826e075d257a9 100644 (file)
@@ -72,19 +72,17 @@ namespace Mono.CSharp
                readonly ReflectionImporter importer;
                readonly CompilationSourceFile source_file;
                
-               public Evaluator (CompilerSettings settings, Report report)
+               public Evaluator (CompilerContext ctx)
                {
-                       ctx = new CompilerContext (settings, report);
+                       this.ctx = ctx;
 
                        module = new ModuleContainer (ctx);
                        module.Evaluator = this;
 
-                       source_file = new CompilationSourceFile ("{interactive}", "", 1);
-                       source_file.NamespaceContainer = new NamespaceContainer (null, module, null, source_file);
-                       module.AddTypeContainer (source_file.NamespaceContainer);
+                       source_file = new CompilationSourceFile (module, null);
+                       module.AddTypeContainer (source_file);
 
                        startup_files = ctx.SourceFiles.Count;
-                       ctx.SourceFiles.Add (source_file);
 
                        // FIXME: Importer needs this assembly for internalsvisibleto
                        module.SetDeclaringAssembly (new AssemblyDefinitionDynamic (module, "evaluator"));
@@ -118,9 +116,10 @@ namespace Mono.CSharp
 
                        Location.Initialize (ctx.SourceFiles);
 
+                       var parser_session = new ParserSession ();
                        for (int i = 0; i < startup_files; ++i) {
-                               var sf = ctx.Settings.SourceFiles [i];
-                               d.Parse (sf, module);
+                               var sf = ctx.SourceFiles [i];
+                               d.Parse (sf, module, parser_session, ctx.Report);
                        }
                }
 
@@ -356,8 +355,6 @@ namespace Mono.CSharp
                                bool partial_input;
                                CSharpParser parser = ParseString (ParseMode.GetCompletions, input, out partial_input);
                                if (parser == null){
-                                       if (CSharpParser.yacc_verbose_flag != 0)
-                                               Console.WriteLine ("DEBUG: No completions available");
                                        return null;
                                }
                                
@@ -449,7 +446,7 @@ namespace Mono.CSharp
                //
                InputKind ToplevelOrStatement (SeekableStreamReader seekable)
                {
-                       Tokenizer tokenizer = new Tokenizer (seekable, source_file, ctx);
+                       Tokenizer tokenizer = new Tokenizer (seekable, source_file, new ParserSession ());
                        
                        int t = tokenizer.token ();
                        switch (t){
@@ -555,7 +552,6 @@ namespace Mono.CSharp
                {
                        partial_input = false;
                        Reset ();
-                       Tokenizer.LocatedToken.Initialize ();
 
                        var enc = ctx.Settings.Encoding;
                        var s = new MemoryStream (enc.GetBytes (input));
@@ -578,8 +574,8 @@ namespace Mono.CSharp
                        }
                        seekable.Position = 0;
 
-                       source_file.NamespaceContainer.DeclarationFound = false;
-                       CSharpParser parser = new CSharpParser (seekable, source_file);
+                       source_file.DeclarationFound = false;
+                       CSharpParser parser = new CSharpParser (seekable, source_file, new ParserSession ());
 
                        if (kind == InputKind.StatementOrExpression){
                                parser.Lexer.putback_char = Tokenizer.EvalStatementParserCharacter;
@@ -593,7 +589,7 @@ namespace Mono.CSharp
                                parser.Lexer.CompleteOnEOF = true;
 
                        ReportPrinter old_printer = null;
-                       if ((mode == ParseMode.Silent || mode == ParseMode.GetCompletions) && CSharpParser.yacc_verbose_flag == 0)
+                       if ((mode == ParseMode.Silent || mode == ParseMode.GetCompletions))
                                old_printer = ctx.Report.SetPrinter (new StreamReportPrinter (TextWriter.Null));
 
                        try {
@@ -660,7 +656,7 @@ namespace Mono.CSharp
                        }
 
                        module.CreateContainer ();
-                       ((NamespaceContainer) module.Containers[0]).EnableUsingClausesRedefinition ();
+                       source_file.EnableUsingClausesRedefinition ();
                        module.Define ();
 
                        if (Report.Errors != 0){
@@ -764,7 +760,7 @@ namespace Mono.CSharp
                        //foreach (object x in ns.using_alias_list)
                        //    sb.AppendFormat ("using {0};\n", x);
 
-                       foreach (var ue in source_file.NamespaceContainer.Usings) {
+                       foreach (var ue in source_file.Usings) {
                                sb.AppendFormat ("using {0};", ue.ToString ());
                                sb.Append (Environment.NewLine);
                        }
@@ -776,7 +772,7 @@ namespace Mono.CSharp
                {
                        var res = new List<string> ();
 
-                       foreach (var ue in source_file.NamespaceContainer.Usings) {
+                       foreach (var ue in source_file.Usings) {
                                if (ue.Alias != null || ue.ResolvedExpression == null)
                                        continue;
 
@@ -984,7 +980,9 @@ namespace Mono.CSharp
                static public string help {
                        get {
                                return "Static methods:\n" +
+#if !NET_2_1
                                        "  Describe (object);       - Describes the object's type\n" +
+#endif
                                        "  LoadPackage (package);   - Loads the given Package (like -pkg:FILE)\n" +
                                        "  LoadAssembly (assembly); - Loads the given assembly (like -r:ASSEMBLY)\n" +
                                        "  ShowVars ();             - Shows defined local variables.\n" +
@@ -1049,10 +1047,6 @@ namespace Mono.CSharp
                {
                }
 
-               public override void EmitSymbolInfo ()
-               {
-               }
-
                protected override FieldExpr GetFieldExpression (EmitContext ec)
                {
                        return new FieldExpr (field, field.Location);