Permalink
Browse files

Remove BaseRefactoringContext.StartScript().

  • Loading branch information...
1 parent 439010a commit daa1cff69dbb5455813bef074538eacdf1ff4a6d @dgrunwald dgrunwald committed Mar 22, 2012
@@ -1,4 +1,4 @@
-//
+//
// BaseRefactoringContext.cs
//
// Author:
@@ -96,8 +96,6 @@ public Conversion GetConversion (Expression expression)
}
#endregion
- public abstract Script StartScript();
-
/// <summary>
/// Translates the english input string to the context language.
/// </summary>
@@ -63,7 +63,7 @@ public IEnumerable<CodeAction> GetActions(RefactoringContext context)
yield return new CodeAction (context.TranslateString("Introduce format item"), script => {
var invocation = context.GetNode<InvocationExpression>();
if (invocation != null && invocation.Target.IsMatch(PrototypeFormatReference)) {
- AddFormatCallToInvocation(context, pexpr, invocation);
+ AddFormatCallToInvocation(context, script, pexpr, invocation);
return;
}
@@ -78,16 +78,14 @@ public IEnumerable<CodeAction> GetActions(RefactoringContext context)
}
- void AddFormatCallToInvocation (RefactoringContext context, PrimitiveExpression pExpr, InvocationExpression invocation)
+ void AddFormatCallToInvocation (RefactoringContext context, Script script, PrimitiveExpression pExpr, InvocationExpression invocation)
{
var newInvocation = (InvocationExpression)invocation.Clone ();
newInvocation.Arguments.First ().ReplaceWith (CreateFormatString (context, pExpr, newInvocation.Arguments.Count () - 1));
newInvocation.Arguments.Add (CreateFormatArgument (context));
- using (var script = context.StartScript ()) {
- script.Replace (invocation, newInvocation);
- }
+ script.Replace (invocation, newInvocation);
}
static PrimitiveExpression CreateFormatArgument (RefactoringContext context)
@@ -1,4 +1,4 @@
-//
+//
// ProviderDescriptionAttribute.cs
//
// Author:
@@ -27,6 +27,7 @@
namespace ICSharpCode.NRefactory.CSharp
{
+ [AttributeUsage(AttributeTargets.Class)]
public class ContextActionAttribute : System.Attribute
{
public string Title { get; private set;}
@@ -1,4 +1,4 @@
-//
+//
// IssueAttribute.cs
//
// Author:
@@ -27,6 +27,7 @@
namespace ICSharpCode.NRefactory.CSharp
{
+ [AttributeUsage(AttributeTargets.Class)]
public class IssueDescriptionAttribute : System.Attribute
{
public string Title { get; private set;}
@@ -59,7 +59,7 @@ public override bool Supports(Version version)
get { return location; }
}
- public override Script StartScript ()
+ public Script StartScript ()
{
return new TestScript (this);
}

0 comments on commit daa1cff

Please sign in to comment.