diff options
author | Mike Krüger <mkrueger@xamarin.com> | 2011-09-04 19:22:31 +0400 |
---|---|---|
committer | Mike Krüger <mkrueger@xamarin.com> | 2011-09-04 19:22:31 +0400 |
commit | 30b6a04c5fc659eeac03fd247e2e89bcac48ad27 (patch) | |
tree | f3f604addcd2dae44fe473f298073b4c85e50c01 /main/src/addins/AspNet | |
parent | bc696d17b68b0a35986c76ee57ef423a60ea728c (diff) |
Updated NRefactory & tracked API changes.
Diffstat (limited to 'main/src/addins/AspNet')
6 files changed, 118 insertions, 22 deletions
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet/Makefile.am b/main/src/addins/AspNet/MonoDevelop.AspNet/Makefile.am index 0b1db4733b..7c727bac0e 100644 --- a/main/src/addins/AspNet/MonoDevelop.AspNet/Makefile.am +++ b/main/src/addins/AspNet/MonoDevelop.AspNet/Makefile.am @@ -11,7 +11,8 @@ DEPS = \ $(top_builddir)/build/bin/ICSharpCode.NRefactory.dll \ $(top_builddir)/build/bin/Mono.TextEditor.dll \ $(top_builddir)/build/bin/MonoDevelop.Core.dll \ - $(top_builddir)/build/bin/MonoDevelop.Ide.dll + $(top_builddir)/build/bin/MonoDevelop.Ide.dll \ + $(top_builddir)/contrib/ICSharpCode.NRefactory/bin/Debug/ICSharpCode.NRefactory.CSharp.dll REFS = \ $(GLIB_SHARP_LIBS) \ @@ -57,6 +58,7 @@ FILES = \ MonoDevelop.AspNet.Gui/BrowserLauncher.cs \ MonoDevelop.AspNet.Gui/HtmlEditorExtension.cs \ MonoDevelop.AspNet.Gui/ILanguageCompletionBuilder.cs \ + MonoDevelop.AspNet.Gui/TypeResolveContextDecorator.cs \ MonoDevelop.AspNet.Gui/XspOptionsPanel.cs \ MonoDevelop.AspNet.Gui/XspOptionsPanelWidget.cs \ MonoDevelop.AspNet.MD1Serialization/MD1AspNetCustomDataItem.cs \ diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.Gui/AspNetEditorExtension.cs b/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.Gui/AspNetEditorExtension.cs index 0bc629f9c7..b6d641c81a 100644 --- a/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.Gui/AspNetEditorExtension.cs +++ b/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.Gui/AspNetEditorExtension.cs @@ -50,6 +50,7 @@ using System.Text.RegularExpressions; using ICSharpCode.NRefactory.TypeSystem; using MonoDevelop.TypeSystem; using ICSharpCode.NRefactory.CSharp; +using ICSharpCode.NRefactory; namespace MonoDevelop.AspNet.Gui { @@ -165,7 +166,7 @@ namespace MonoDevelop.AspNet.Gui //FIXME: get doctype from master page DocType = null; } else { - DocType = new MonoDevelop.Xml.StateEngine.XDocType (AstLocation.Empty); + DocType = new MonoDevelop.Xml.StateEngine.XDocType (TextLocation.Empty); var matches = DocTypeRegex.Match (aspDoc.Info.DocType); DocType.PublicFpi = matches.Groups["fpi"].Value; DocType.Uri = matches.Groups["uri"].Value; @@ -780,7 +781,7 @@ namespace MonoDevelop.AspNet.Gui return System.Web.UI.PersistenceMode.Attribute; } - return (System.Web.UI.PersistenceMode) expr.GetValue (projectDatabase); + return (System.Web.UI.PersistenceMode) expr.ConstantValue; } else if (att.AttributeType.Resolve (projectDatabase).ReflectionName == "System.Web.UI.TemplateContainerAttribute") { @@ -807,8 +808,8 @@ namespace MonoDevelop.AspNet.Gui return false; } - if (expr.GetValue (ctx) is bool) { - childrenAsProperties = (bool)expr.GetValue (ctx); + if (expr.ConstantValue is bool) { + childrenAsProperties = (bool)expr.ConstantValue; } else { //TODO: implement this LoggingService.LogWarning ("ASP.NET completion does not yet handle ParseChildrenAttribute (Type)"); @@ -818,11 +819,11 @@ namespace MonoDevelop.AspNet.Gui if (posArgs.Count > 1) { var expr = posArgs [1]; - if (expr == null || !(expr.GetValue (ctx) is string)) { + if (expr == null || !(expr.ConstantValue is string)) { LoggingService.LogWarning ("Unknown expression '{0}' in IAttribute parameter", expr); return false; } - defaultProperty = (string)expr.GetValue (ctx); + defaultProperty = (string)expr.ConstantValue; } var namedArgs = att.GetNamedArguments (ctx); @@ -833,7 +834,7 @@ namespace MonoDevelop.AspNet.Gui LoggingService.LogWarning ("Unknown expression type {0} in IAttribute parameter", expr); return false; } - childrenAsProperties = (bool)expr.GetValue (ctx); + childrenAsProperties = (bool)expr.ConstantValue; } if (namedArgs.Any (p => p.Key == "DefaultProperty")) { var expr = namedArgs.First (p => p.Key == "DefaultProperty").Value; @@ -841,7 +842,7 @@ namespace MonoDevelop.AspNet.Gui LoggingService.LogWarning ("Unknown expression type {0} in IAttribute parameter", expr); return false; } - defaultProperty = (string)expr.GetValue (ctx); + defaultProperty = (string)expr.ConstantValue; } if (namedArgs.Any (p => p.Key == "ChildControlType")) { //TODO: implement this diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.Gui/TypeResolveContextDecorator.cs b/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.Gui/TypeResolveContextDecorator.cs new file mode 100644 index 0000000000..4c95957253 --- /dev/null +++ b/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.Gui/TypeResolveContextDecorator.cs @@ -0,0 +1,87 @@ +// +// TypeResolveContextDecorator.cs +// +// Author: +// Mike Krüger <mkrueger@novell.com> +// +// Copyright (c) 2011 Mike Krüger <mkrueger@novell.com> +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Collections.Generic; +using System.Diagnostics.Contracts; + +using ICSharpCode.NRefactory.Utils; +using ICSharpCode.NRefactory.TypeSystem; + +namespace MonoDevelop.AspNet.Gui +{ + public class TypeResolveContextDecorator : ITypeResolveContext + { + protected ITypeResolveContext ctx; + + public TypeResolveContextDecorator (ITypeResolveContext ctx) + { + this.ctx = ctx; + } + + public virtual ITypeDefinition GetKnownTypeDefinition (TypeCode typeCode) + { + return ctx.GetKnownTypeDefinition (typeCode); + } + + public virtual ITypeDefinition GetTypeDefinition(string nameSpace, string name, int typeParameterCount, StringComparer nameComparer) + { + return ctx.GetTypeDefinition(nameSpace, name, typeParameterCount, nameComparer); + } + + public virtual IEnumerable<ITypeDefinition> GetTypes() + { + return ctx.GetTypes(); + } + + public virtual IEnumerable<ITypeDefinition> GetTypes(string nameSpace, StringComparer nameComparer) + { + return ctx.GetTypes(nameSpace, nameComparer); + } + + public virtual IEnumerable<string> GetNamespaces() + { + return ctx.GetNamespaces(); + } + + public virtual string GetNamespace(string nameSpace, StringComparer nameComparer) + { + return ctx.GetNamespace(nameSpace, nameComparer); + } + + public virtual ISynchronizedTypeResolveContext Synchronize() + { + return ctx.Synchronize(); + } + + public virtual CacheManager CacheManager { + get { + return ctx.CacheManager; + } + } + } +} + diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.Parser/MemberListVisitor.cs b/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.Parser/MemberListVisitor.cs index d5dc1ddde6..11a5f5deb1 100644 --- a/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.Parser/MemberListVisitor.cs +++ b/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.Parser/MemberListVisitor.cs @@ -37,6 +37,7 @@ using MonoDevelop.Core; using MonoDevelop.AspNet.Parser.Dom; using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.NRefactory.CSharp; +using ICSharpCode.NRefactory; namespace MonoDevelop.AspNet.Parser { @@ -90,7 +91,7 @@ namespace MonoDevelop.AspNet.Parser return; } - Members [id] = new CodeBehindMember (id, type, new AstLocation (node.Location.BeginLine, node.Location.BeginColumn)); + Members [id] = new CodeBehindMember (id, type, new TextLocation (node.Location.BeginLine, node.Location.BeginColumn)); } internal void AddError (ErrorType type, ILocation location, string message) @@ -104,7 +105,7 @@ namespace MonoDevelop.AspNet.Parser public class CodeBehindMember { - public CodeBehindMember (string name, IType type, AstLocation location) + public CodeBehindMember (string name, IType type, TextLocation location) { this.Name = name; this.Type = type; @@ -113,6 +114,6 @@ namespace MonoDevelop.AspNet.Parser public string Name { get; private set; } public IType Type { get; private set; } - public AstLocation Location { get; private set; } + public TextLocation Location { get; private set; } } } diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.StateEngine/AspNetDom.cs b/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.StateEngine/AspNetDom.cs index c4e159414c..d9720deab8 100644 --- a/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.StateEngine/AspNetDom.cs +++ b/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.StateEngine/AspNetDom.cs @@ -34,6 +34,7 @@ using System.Collections.Generic; using MonoDevelop.Xml.StateEngine; using ICSharpCode.NRefactory.CSharp; using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.NRefactory; namespace MonoDevelop.AspNet.StateEngine { @@ -43,12 +44,12 @@ namespace MonoDevelop.AspNet.StateEngine XName name; XAttributeCollection attributes; - public AspNetDirective (AstLocation start) : base (start) + public AspNetDirective (TextLocation start) : base (start) { attributes = new XAttributeCollection (this); } - public AspNetDirective (AstLocation start, XName name) : this (start) + public AspNetDirective (TextLocation start, XName name) : this (start) { this.name = name; } @@ -116,7 +117,7 @@ namespace MonoDevelop.AspNet.StateEngine public abstract class AspNetExpression : XNode { public AspNetExpression (DomRegion region) : base (region) {} - public AspNetExpression (AstLocation start) : base (start) {} + public AspNetExpression (TextLocation start) : base (start) {} protected AspNetExpression () {} } @@ -124,7 +125,7 @@ namespace MonoDevelop.AspNet.StateEngine public class AspNetRenderExpression : AspNetExpression { public AspNetRenderExpression (DomRegion region) : base (region) {} - public AspNetRenderExpression (AstLocation start) : base (start) {} + public AspNetRenderExpression (TextLocation start) : base (start) {} protected AspNetRenderExpression () {} protected override XObject NewInstance () { return new AspNetRenderExpression (); } @@ -142,7 +143,7 @@ namespace MonoDevelop.AspNet.StateEngine public class AspNetHtmlEncodedExpression : AspNetExpression { public AspNetHtmlEncodedExpression (DomRegion region) : base (region) {} - public AspNetHtmlEncodedExpression (AstLocation start) : base (start) {} + public AspNetHtmlEncodedExpression (TextLocation start) : base (start) {} protected AspNetHtmlEncodedExpression () {} protected override XObject NewInstance () { return new AspNetHtmlEncodedExpression (); } @@ -160,7 +161,7 @@ namespace MonoDevelop.AspNet.StateEngine public class AspNetDataBindingExpression : AspNetExpression { public AspNetDataBindingExpression (DomRegion region) : base (region) {} - public AspNetDataBindingExpression (AstLocation start) : base (start) {} + public AspNetDataBindingExpression (TextLocation start) : base (start) {} protected AspNetDataBindingExpression () {} protected override XObject NewInstance () { return new AspNetDataBindingExpression (); } @@ -178,7 +179,7 @@ namespace MonoDevelop.AspNet.StateEngine public class AspNetResourceExpression : AspNetExpression { public AspNetResourceExpression (DomRegion region) : base (region) {} - public AspNetResourceExpression (AstLocation start) : base (start) {} + public AspNetResourceExpression (TextLocation start) : base (start) {} protected AspNetResourceExpression () {} protected override XObject NewInstance () { return new AspNetResourceExpression (); } @@ -196,7 +197,7 @@ namespace MonoDevelop.AspNet.StateEngine public class AspNetServerComment : XNode { public AspNetServerComment (DomRegion region) : base (region) {} - public AspNetServerComment (AstLocation start) : base (start) {} + public AspNetServerComment (TextLocation start) : base (start) {} protected AspNetServerComment () {} protected override XObject NewInstance () { return new AspNetServerComment (); } @@ -214,7 +215,7 @@ namespace MonoDevelop.AspNet.StateEngine public class AspNetRenderBlock : XNode { public AspNetRenderBlock (DomRegion region) : base (region) {} - public AspNetRenderBlock (AstLocation start) : base (start) {} + public AspNetRenderBlock (TextLocation start) : base (start) {} protected AspNetRenderBlock () {} protected override XObject NewInstance () { return new AspNetRenderBlock (); } diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.csproj b/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.csproj index d6fbbe0527..6c03cbcc42 100644 --- a/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.csproj +++ b/main/src/addins/AspNet/MonoDevelop.AspNet/MonoDevelop.AspNet.csproj @@ -81,6 +81,10 @@ <Project>{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}</Project> <Name>ICSharpCode.NRefactory</Name> </ProjectReference> + <ProjectReference Include="..\..\..\..\contrib\ICSharpCode.NRefactory.CSharp\ICSharpCode.NRefactory.CSharp.csproj"> + <Project>{53DCA265-3C3C-42F9-B647-F72BA678122B}</Project> + <Name>ICSharpCode.NRefactory.CSharp</Name> + </ProjectReference> </ItemGroup> <ItemGroup> <Reference Include="System" /> @@ -296,6 +300,7 @@ <Compile Include="MonoDevelop.AspNet.Gui\AspProjectDom.cs" /> <Compile Include="MonoDevelop.AspNet\RegistrationCache.cs" /> <Compile Include="MonoDevelop.AspNet.StateEngine\HtmlScriptBodyState.cs" /> + <Compile Include="MonoDevelop.AspNet.Gui\TypeResolveContextDecorator.cs" /> </ItemGroup> <ItemGroup> <None Include="Makefile.am" /> @@ -322,7 +327,6 @@ <ProjectExtensions> <MonoDevelop> <Properties> - <GtkDesignInfo gettextClass="MonoDevelop.Core.GettextCatalog" /> <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="true" RelativeMakefileName="Makefile.am" BuildTargetName="" CleanTargetName="" SyncReferences="true" IsAutotoolsProject="true" RelativeConfigureInPath="../../../.."> <BuildFilesVar Sync="true" Name="FILES" /> <DeployFilesVar Sync="true" Name="DATA_FILES" /> |