diff --git a/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/ResolveVisitor.cs b/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/ResolveVisitor.cs
index 69ba4ee6d2..b77e6a8771 100644
--- a/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/ResolveVisitor.cs
+++ b/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/ResolveVisitor.cs
@@ -418,16 +418,13 @@ namespace Grunwald.BooBinding.CodeCompletion
if (callingClass != null)
isClassInInheritanceTree = callingClass.IsTypeInInheritanceTree(trr.ResolvedClass);
- foreach (IMethod m in trr.ResolvedClass.Methods) {
+ foreach (IMethod m in trr.ResolvedClass.DefaultReturnType.GetMethods()) {
if (m.IsConstructor && !m.IsStatic
&& m.IsAccessible(callingClass, isClassInInheritanceTree))
{
methods.Add(m);
}
}
- if (methods.Count == 0) {
- methods.Add(ICSharpCode.SharpDevelop.Dom.Constructor.CreateDefault(trr.ResolvedClass));
- }
ResolveInvocation(methods, node.Arguments);
if (resolveResult != null)
resolveResult.ResolvedType = trr.ResolvedType;
diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/PythonBinding.addin b/src/AddIns/BackendBindings/Python/PythonBinding/Project/PythonBinding.addin
index 65d28acc21..a7f5afc479 100644
--- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/PythonBinding.addin
+++ b/src/AddIns/BackendBindings/Python/PythonBinding/Project/PythonBinding.addin
@@ -24,6 +24,10 @@
resource="ICSharpCode.PythonBinding.Resources.Python.xshd"/>
+
+
+
+
+
diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonDesignerGenerator.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonDesignerGenerator.cs
index 779560556b..e11fa27c4f 100644
--- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonDesignerGenerator.cs
+++ b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonDesignerGenerator.cs
@@ -131,7 +131,7 @@ namespace ICSharpCode.PythonBinding
// Insert the event handler at the end of the class with an extra
// new line before it.
IDocument doc = viewContent.DesignerCodeFileDocument;
- string eventHandler = CreateEventHandler(eventMethodName, body, "\t");
+ string eventHandler = CreateEventHandler(eventMethodName, body, NRefactoryToPythonConverter.GetIndentString(textEditorProperties));
int line = doc.TotalNumberOfLines;
IDocumentLine lastLineSegment = doc.GetLine(line);
int offset = lastLineSegment.Offset + lastLineSegment.Length;
@@ -228,6 +228,7 @@ namespace ICSharpCode.PythonBinding
///
/// Returns the generated event handler.
///
+ /// The indent string to use for the event handler.
protected string CreateEventHandler(string eventMethodName, string body, string indentation)
{
if (String.IsNullOrEmpty(body)) {
@@ -240,9 +241,9 @@ namespace ICSharpCode.PythonBinding
eventHandler.Append("def ");
eventHandler.Append(eventMethodName);
eventHandler.Append("(self, sender, e):");
- eventHandler.AppendLine();
+ eventHandler.AppendLine();
eventHandler.Append(indentation);
- eventHandler.Append("\t");
+ eventHandler.Append(NRefactoryToPythonConverter.GetIndentString(textEditorProperties));
eventHandler.Append(body);
return eventHandler.ToString();
diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonFormattingStrategy.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonFormattingStrategy.cs
new file mode 100644
index 0000000000..55ad526f35
--- /dev/null
+++ b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonFormattingStrategy.cs
@@ -0,0 +1,76 @@
+//
+//
+//
+//
+// $Revision$
+//
+
+using System;
+using ICSharpCode.TextEditor;
+using ICSharpCode.TextEditor.Actions;
+using ICSharpCode.TextEditor.Document;
+
+namespace ICSharpCode.PythonBinding
+{
+ public class PythonFormattingStrategy : DefaultFormattingStrategy
+ {
+ public PythonFormattingStrategy()
+ {
+ }
+
+ protected override int SmartIndentLine(TextArea textArea, int line)
+ {
+ IDocument document = textArea.Document;
+ LineSegment previousLine = document.GetLineSegment(line - 1);
+ string previousLineText = document.GetText(previousLine).Trim();
+
+ if (previousLineText.EndsWith(":")) {
+ return IncreaseLineIndent(textArea, line);
+ } else if (previousLineText == "pass") {
+ return DecreaseLineIndent(textArea, line);
+ } else if ((previousLineText == "return") || (previousLineText.StartsWith("return "))) {
+ return DecreaseLineIndent(textArea, line);
+ } else if ((previousLineText == "raise") || (previousLineText.StartsWith("raise "))) {
+ return DecreaseLineIndent(textArea, line);
+ } else if (previousLineText == "break") {
+ return DecreaseLineIndent(textArea, line);
+ }
+ return base.SmartIndentLine(textArea, line);
+ }
+
+ int IncreaseLineIndent(TextArea textArea, int line)
+ {
+ return ModifyLineIndent(textArea, line, true);
+ }
+
+ int DecreaseLineIndent(TextArea textArea, int line)
+ {
+ return ModifyLineIndent(textArea, line, false);
+ }
+
+ int ModifyLineIndent(TextArea textArea, int line, bool increaseIndent)
+ {
+ IDocument document = textArea.Document;
+ LineSegment currentLine = document.GetLineSegment(line);
+ string indentation = GetIndentation(textArea, line - 1);
+ indentation = GetNewLineIndentation(indentation, Tab.GetIndentationString(document), increaseIndent);
+ string newIndentedText = indentation + document.GetText(currentLine);
+ SmartReplaceLine(document, currentLine, newIndentedText);
+ return indentation.Length;
+ }
+
+ string GetNewLineIndentation(string previousLineIndentation, string singleIndent, bool increaseIndent)
+ {
+ if (increaseIndent) {
+ return previousLineIndentation + singleIndent;
+ }
+
+ // Decrease the new line indentation.
+ int decreaselength = previousLineIndentation.Length - singleIndent.Length;
+ if (decreaselength < 0) {
+ decreaselength = 0;
+ }
+ return previousLineIndentation.Substring(0, decreaselength);
+ }
+ }
+}
diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/AddInFileTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/AddInFileTestFixture.cs
index ac0538ee56..b9972a0ecf 100644
--- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/AddInFileTestFixture.cs
+++ b/src/AddIns/BackendBindings/Python/PythonBinding/Test/AddInFileTestFixture.cs
@@ -51,6 +51,7 @@ namespace PythonBinding.Tests
Codon pythonProjectIconCodon;
Codon convertCSharpProjectCodon;
Codon convertVBNetProjectCodon;
+ Codon formattingStrategyCodon;
[TestFixtureSetUp]
public void SetupFixture()
@@ -83,6 +84,7 @@ namespace PythonBinding.Tests
pythonProjectIconCodon = GetCodon("/Workspace/Icons", "PythonProjectIcon");
convertCSharpProjectCodon = GetCodon("/SharpDevelop/Pads/ProjectBrowser/ContextMenu/ProjectActions/Convert", "CSharpProjectToPythonProjectConverter");
convertVBNetProjectCodon = GetCodon("/SharpDevelop/Pads/ProjectBrowser/ContextMenu/ProjectActions/Convert", "VBNetProjectToPythonProjectConverter");
+ formattingStrategyCodon = GetCodon("/AddIns/DefaultTextEditor/Formatter/Python", "PythonFormatter");
// Get the PythonBinding runtime.
foreach (Runtime runtime in addin.Runtimes) {
@@ -749,6 +751,12 @@ namespace PythonBinding.Tests
{
Assert.AreEqual(pythonWithoutDebuggerRunMenuItemCodon.Conditions[0], pythonRunMenuItemCodon.Conditions[0]);
}
+
+ [Test]
+ public void PythonFormatterClass()
+ {
+ Assert.AreEqual("ICSharpCode.PythonBinding.PythonFormattingStrategy", formattingStrategyCodon["class"]);
+ }
Codon GetCodon(string name, string extensionPath)
{
diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/InsertEventHandlerTestFixtureBase.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/InsertEventHandlerTestFixtureBase.cs
index 760c452740..c12fef28f0 100644
--- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/InsertEventHandlerTestFixtureBase.cs
+++ b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/InsertEventHandlerTestFixtureBase.cs
@@ -26,11 +26,13 @@ namespace PythonBinding.Tests.Designer
protected DerivedFormDesignerViewContent viewContent;
protected string fileName = @"C:\Projects\Python\mainform.py";
protected DerivedPythonDesignerGenerator generator;
+ protected MockTextEditorProperties textEditorProperties;
[TestFixtureSetUp]
public void SetUpFixture()
{
- generator = new DerivedPythonDesignerGenerator();
+ textEditorProperties = new MockTextEditorProperties();
+ generator = new DerivedPythonDesignerGenerator(textEditorProperties);
mockViewContent = new MockTextEditorViewContent();
viewContent = new DerivedFormDesignerViewContent(mockViewContent, new MockOpenedFile(fileName));
generator.Attach(viewContent);
diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/InsertEventHandlerWithSpaceIndentTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/InsertEventHandlerWithSpaceIndentTestFixture.cs
new file mode 100644
index 0000000000..57c603284d
--- /dev/null
+++ b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/InsertEventHandlerWithSpaceIndentTestFixture.cs
@@ -0,0 +1,65 @@
+//
+//
+//
+//
+// $Revision$
+//
+
+using System;
+using ICSharpCode.PythonBinding;
+using ICSharpCode.FormsDesigner;
+using ICSharpCode.SharpDevelop.Dom;
+using NUnit.Framework;
+using PythonBinding.Tests.Utils;
+
+namespace PythonBinding.Tests.Designer
+{
+ ///
+ /// Tests the PythonDesignerGenerator uses the text editor properties for indentation when
+ /// inserting an event handler into the document.
+ ///
+ [TestFixture]
+ public class InsertEventHandlerWithSpaceIndentTestFixture : InsertEventHandlerTestFixtureBase
+ {
+ public override void AfterSetUpFixture()
+ {
+ textEditorProperties.ConvertTabsToSpaces = true;
+ textEditorProperties.IndentationSize = 4;
+ MockEventDescriptor mockEventDescriptor = new MockEventDescriptor("Click");
+ insertedEventHandler = generator.InsertComponentEvent(null, mockEventDescriptor, "button1_click", String.Empty, out file, out position);
+ }
+
+ [Test]
+ public void ExpectedCodeAfterEventHandlerInserted()
+ {
+ string expectedCode = GetTextEditorCode();
+ string eventHandler = " def button1_click(self, sender, e):\r\n" +
+ " pass";
+ expectedCode = expectedCode + "\r\n" + eventHandler;
+
+ Assert.AreEqual(expectedCode, viewContent.DesignerCodeFileContent);
+ }
+
+ ///
+ /// Note that the text editor code already has the
+ /// statement:
+ ///
+ /// "self._button1.Click += button1_click"
+ ///
+ /// This is generated by the form designer framework and not
+ /// by the designer generator.
+ ///
+ protected override string GetTextEditorCode()
+ {
+ return "from System.Windows.Forms import Form\r\n" +
+ "\r\n" +
+ "class MainForm(Form):\r\n" +
+ " def __init__(self):\r\n" +
+ " self.InitializeComponents()\r\n" +
+ " \r\n" +
+ " def InitializeComponents(self):\r\n" +
+ " self._button1 = System.Windows.Forms.Button()\r\n" +
+ " self.Controls.Add(self._button1)\r\n";
+ }
+ }
+}
diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonBinding.Tests.csproj b/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonBinding.Tests.csproj
index a97b1e26ac..4e9e8a4acf 100644
--- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonBinding.Tests.csproj
+++ b/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonBinding.Tests.csproj
@@ -242,6 +242,7 @@
+
@@ -315,6 +316,7 @@
+
diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonIndentationTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonIndentationTests.cs
new file mode 100644
index 0000000000..9d15beef43
--- /dev/null
+++ b/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonIndentationTests.cs
@@ -0,0 +1,205 @@
+//
+//
+//
+//
+// $Revision$
+//
+
+using System;
+using ICSharpCode.PythonBinding;
+using ICSharpCode.TextEditor;
+using ICSharpCode.TextEditor.Document;
+using ICSharpCode.TextEditor.Actions;
+using NUnit.Framework;
+using PythonBinding.Tests.Utils;
+
+namespace PythonBinding.Tests.Indentation
+{
+ ///
+ /// Tests that the PythonFormattingStrategy indents the new line added after pressing the ':' character.
+ ///
+ [TestFixture]
+ public class PythonNewMethodIndentationTestFixture
+ {
+ TextEditorControl textEditor;
+ PythonFormattingStrategy formattingStrategy;
+
+ [SetUp]
+ public void Init()
+ {
+ MockTextEditorProperties textEditorProperties = new MockTextEditorProperties();
+ textEditorProperties.IndentStyle = IndentStyle.Smart;
+ textEditorProperties.TabIndent = 4;
+ textEditor = new TextEditorControl();
+ textEditor.TextEditorProperties = textEditorProperties;
+ formattingStrategy = new PythonFormattingStrategy();
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ textEditor.Dispose();
+ }
+
+ [Test]
+ public void NewMethodDefinition()
+ {
+ textEditor.Text = "def newMethod:\r\n" +
+ "";
+ int indentResult = formattingStrategy.IndentLine(textEditor.ActiveTextAreaControl.TextArea, 1);
+ string expectedText = "def newMethod:\r\n" +
+ "\t";
+
+ Assert.AreEqual(expectedText, textEditor.Text);
+ Assert.AreEqual(1, indentResult);
+ }
+
+ [Test]
+ public void NoExtraIndentationRequired()
+ {
+ textEditor.Text = "\tprint 'abc'\r\n" +
+ "";
+ int indentResult = formattingStrategy.IndentLine(textEditor.ActiveTextAreaControl.TextArea, 1);
+ string expectedText = "\tprint 'abc'\r\n" +
+ "\t";
+
+ Assert.AreEqual(expectedText, textEditor.Text);
+ Assert.AreEqual(1, indentResult);
+ }
+
+ [Test]
+ public void PassStatementDecreasesIndentOnThirdLine()
+ {
+ textEditor.Text = "def method1:\r\n" +
+ "\tpass\r\n" +
+ "";
+ int indentResult = formattingStrategy.IndentLine(textEditor.ActiveTextAreaControl.TextArea, 2);
+ string expectedText = "def method1:\r\n" +
+ "\tpass\r\n" +
+ "";
+
+ Assert.AreEqual(expectedText, textEditor.Text);
+ }
+
+ [Test]
+ public void ReturnValueStatementDecreasesIndentOnThirdLine()
+ {
+ textEditor.Text = "def method1:\r\n" +
+ "\treturn 0\r\n" +
+ "";
+ int indentResult = formattingStrategy.IndentLine(textEditor.ActiveTextAreaControl.TextArea, 2);
+ string expectedText = "def method1:\r\n" +
+ "\treturn 0\r\n" +
+ "";
+
+ Assert.AreEqual(expectedText, textEditor.Text);
+ }
+
+ [Test]
+ public void ReturnStatementDecreasesIndentOnThirdLine()
+ {
+ textEditor.Text = "def method1:\r\n" +
+ "\treturn\r\n" +
+ "";
+ int indentResult = formattingStrategy.IndentLine(textEditor.ActiveTextAreaControl.TextArea, 2);
+ string expectedText = "def method1:\r\n" +
+ "\treturn\r\n" +
+ "";
+
+ Assert.AreEqual(expectedText, textEditor.Text);
+ }
+ [Test]
+ public void ReturnStatementWithNoIndentOnPreviousLine()
+ {
+ textEditor.Text = "return\r\n" +
+ "";
+ int indentResult = formattingStrategy.IndentLine(textEditor.ActiveTextAreaControl.TextArea, 1);
+ string expectedText = "return\r\n" +
+ "";
+
+ Assert.AreEqual(expectedText, textEditor.Text);
+ }
+
+ [Test]
+ public void StatementIsNotAReturnOnPreviousLine()
+ {
+ textEditor.Text = "\treturnValue\r\n" +
+ "";
+ int indentResult = formattingStrategy.IndentLine(textEditor.ActiveTextAreaControl.TextArea, 1);
+ string expectedText = "\treturnValue\r\n" +
+ "\t";
+
+ Assert.AreEqual(expectedText, textEditor.Text);
+ }
+
+ [Test]
+ public void RaiseStatementWithObjectDecreasesIndentOnThirdLine()
+ {
+ textEditor.Text = "def method1:\r\n" +
+ "\traise 'a'\r\n" +
+ "";
+ int indentResult = formattingStrategy.IndentLine(textEditor.ActiveTextAreaControl.TextArea, 2);
+ string expectedText = "def method1:\r\n" +
+ "\traise 'a'\r\n" +
+ "";
+
+ Assert.AreEqual(expectedText, textEditor.Text);
+ }
+
+ [Test]
+ public void RaiseStatementDecreasesIndentOnThirdLine()
+ {
+ textEditor.Text = "def method1:\r\n" +
+ "\traise\r\n" +
+ "";
+ int indentResult = formattingStrategy.IndentLine(textEditor.ActiveTextAreaControl.TextArea, 2);
+ string expectedText = "def method1:\r\n" +
+ "\traise\r\n" +
+ "";
+
+ Assert.AreEqual(expectedText, textEditor.Text);
+ }
+
+ [Test]
+ public void StatementIsNotARaiseStatementOnPreviousLine()
+ {
+ textEditor.Text = "def method1:\r\n" +
+ "\traiseThis\r\n" +
+ "";
+ int indentResult = formattingStrategy.IndentLine(textEditor.ActiveTextAreaControl.TextArea, 2);
+ string expectedText = "def method1:\r\n" +
+ "\traiseThis\r\n" +
+ "\t";
+
+ Assert.AreEqual(expectedText, textEditor.Text);
+ }
+
+ [Test]
+ public void BreakStatementDecreasesIndentOnThirdLine()
+ {
+ textEditor.Text = "def method1:\r\n" +
+ "\tbreak\r\n" +
+ "";
+ int indentResult = formattingStrategy.IndentLine(textEditor.ActiveTextAreaControl.TextArea, 2);
+ string expectedText = "def method1:\r\n" +
+ "\tbreak\r\n" +
+ "";
+
+ Assert.AreEqual(expectedText, textEditor.Text);
+ }
+
+ [Test]
+ public void StatementIsNotABreakStatementOnPreviousLine()
+ {
+ textEditor.Text = "def method1:\r\n" +
+ "\tbreakThis\r\n" +
+ "";
+ int indentResult = formattingStrategy.IndentLine(textEditor.ActiveTextAreaControl.TextArea, 2);
+ string expectedText = "def method1:\r\n" +
+ "\tbreakThis\r\n" +
+ "\t";
+
+ Assert.AreEqual(expectedText, textEditor.Text);
+ }
+ }
+}
diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MockTextEditorProperties.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MockTextEditorProperties.cs
index e54df5268f..bee4d59345 100644
--- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MockTextEditorProperties.cs
+++ b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MockTextEditorProperties.cs
@@ -17,6 +17,7 @@ namespace PythonBinding.Tests.Utils
{
public MockTextEditorProperties()
{
+ FontContainer = new FontContainer(SystemFonts.MenuFont);
}
public bool CaretLine { get; set; }
diff --git a/src/AddIns/Misc/Profiler/Controller/Data/CallTreeNode.cs b/src/AddIns/Misc/Profiler/Controller/Data/CallTreeNode.cs
index 4f6a2b5c3d..e3c0fd5906 100644
--- a/src/AddIns/Misc/Profiler/Controller/Data/CallTreeNode.cs
+++ b/src/AddIns/Misc/Profiler/Controller/Data/CallTreeNode.cs
@@ -79,12 +79,17 @@ namespace ICSharpCode.Profiler.Controller.Data
///
public abstract long CpuCyclesSpent { get; }
+ long cpuCyclesSpentSelf = -1;
+
///
/// Gets how many CPU cycles were spent inside this method, excluding sub calls.
///
public virtual long CpuCyclesSpentSelf {
get {
- return GetCpuCyclesSelf();
+ if (cpuCyclesSpentSelf == -1)
+ cpuCyclesSpentSelf = GetCpuCyclesSelf();
+
+ return cpuCyclesSpentSelf;
}
}
@@ -116,11 +121,19 @@ namespace ICSharpCode.Profiler.Controller.Data
///
/// Determines whether this node is a thread node or not.
///
- public bool IsThread
- {
+ public bool IsThread {
get { return this.Name.StartsWith("Thread#", StringComparison.Ordinal); }
}
+ ///
+ /// Determines whether this node has chil
+ ///
+ public virtual bool HasChildren {
+ get {
+ return this.Children.Any();
+ }
+ }
+
///
/// Gets a readonly list of the string representation of the parameters.
///
@@ -136,6 +149,11 @@ namespace ICSharpCode.Profiler.Controller.Data
///
public abstract double TimeSpent { get; }
+ ///
+ /// Gets the time spent inside the method (excluding sub calls) in milliseconds.
+ ///
+ public abstract double TimeSpentSelf { get; }
+
///
/// Gets a reference to the parent of this CallTreeNode.
///
diff --git a/src/AddIns/Misc/Profiler/Controller/Data/ProfilingDataSQLiteProvider.cs b/src/AddIns/Misc/Profiler/Controller/Data/ProfilingDataSQLiteProvider.cs
index c4119cb63e..76688bc5c5 100644
--- a/src/AddIns/Misc/Profiler/Controller/Data/ProfilingDataSQLiteProvider.cs
+++ b/src/AddIns/Misc/Profiler/Controller/Data/ProfilingDataSQLiteProvider.cs
@@ -59,39 +59,6 @@ namespace ICSharpCode.Profiler.Controller.Data
this.Dispose();
}
- internal IQueryable GetChildren(SQLiteCallTreeNode parent)
- {
- SQLiteCommand cmd;
- using (LockAndCreateCommand(out cmd)) {
- cmd.CommandText = @"SELECT id, nameid, callcount, timespent, isactiveatstart
- FROM FunctionData
- WHERE parentid IN(" + string.Join(",", parent.ids.Select(a => a.ToString(CultureInfo.InvariantCulture.NumberFormat)).ToArray()) + @")
- ORDER BY id;";
-
- using (SQLiteDataReader reader = cmd.ExecuteReader()) {
- List items = new List();
-
- while (reader.Read()) {
- int childNameId = reader.GetInt32(1);
- SQLiteCallTreeNode newItem = items.Find(node => node.nameId == childNameId);
- if (newItem == null) {
- newItem = new SQLiteCallTreeNode(childNameId, (parent.nameId == 0) ? null : parent, this);
- items.Add(newItem);
-
- // works because of ORDER BY id
- newItem.isActiveAtStart = reader.GetBoolean(4);
- }
-
- newItem.callCount += reader.GetInt32(2);
- newItem.cpuCyclesSpent += (ulong)reader.GetInt64(3);
- newItem.ids.Add(reader.GetInt32(0));
- }
-
- return items.Cast().AsQueryable();
- }
- }
- }
-
internal IQueryable GetCallers(SQLiteCallTreeNode item)
{
SQLiteCommand cmd;
@@ -115,6 +82,7 @@ namespace ICSharpCode.Profiler.Controller.Data
SQLiteCallTreeNode newItem = items.Find(node => node.nameId == childNameId);
if (newItem == null) {
newItem = new SQLiteCallTreeNode(childNameId, null, this);
+ newItem.selectionStartIndex = item.selectionStartIndex;
items.Add(newItem);
// works because of ORDER BY id
@@ -292,6 +260,8 @@ namespace ICSharpCode.Profiler.Controller.Data
using (SQLiteDataReader reader = cmd.ExecuteReader()) {
SQLiteCallTreeNode root = new SQLiteCallTreeNode(0, null, this);
+
+ root.selectionStartIndex = startIndex;
while (reader.Read()) {
root.callCount += reader.GetInt32(2);
@@ -304,6 +274,7 @@ namespace ICSharpCode.Profiler.Controller.Data
}
}
+ #region Properties
///
public override void SetProperty(string name, string value)
{
@@ -350,6 +321,7 @@ namespace ICSharpCode.Profiler.Controller.Data
return null;
}
+ #endregion
int processorFrequency = -1;
@@ -376,45 +348,54 @@ namespace ICSharpCode.Profiler.Controller.Data
///
public override IQueryable GetFunctions(int startIndex, int endIndex)
{
- Expression> filterLambda = c => startIndex <= c.DataSetID && c.DataSetID <= endIndex;
- return CreateQuery(new MergeByName(new Filter(AllCalls.Instance, filterLambda)));
- }
-
- /*
if (startIndex < 0 || startIndex >= this.dataSets.Count)
throw new ArgumentOutOfRangeException("startIndex", startIndex, "Value must be between 0 and " + endIndex);
if (endIndex < startIndex || endIndex >= this.DataSets.Count)
throw new ArgumentOutOfRangeException("endIndex", endIndex, "Value must be between " + startIndex + " and " + (this.DataSets.Count - 1));
- IList functions = new List();
+ Expression> filterLambda = c => startIndex <= c.DataSetID && c.DataSetID <= endIndex;
+ return from c in CreateQuery(new MergeByName(new Filter(AllCalls.Instance, filterLambda)))
+ where c.NameMapping.Id != 0 && !c.NameMapping.Name.StartsWith("Thread#", StringComparison.Ordinal)
+ select c;
+ }
+
+ /*
+ IQueryable GetMergedFunctionData(string condition, int startIndex)
+ {
+ IList result = new List();
SQLiteCommand cmd;
using (LockAndCreateCommand(out cmd)) {
- cmd.CommandText = @"SELECT GROUP_CONCAT(id), nameid, SUM(timespent), SUM(callcount)
- FROM FunctionData
- WHERE datasetid BETWEEN @start AND @end
- GROUP BY nameid;";
- cmd.Parameters.Add(new SQLiteParameter("@start", startIndex));
- cmd.Parameters.Add(new SQLiteParameter("@end", endIndex));
+ cmd.CommandText = @"SELECT
+ GROUP_CONCAT(id),
+ nameid,
+ SUM(timespent),
+ SUM(callcount),
+ MAX(id != endid) AS hasChildren,
+ SUM((datasetid = " + startIndex + @") AND isActiveAtStart) AS activeCallCount
+ FROM FunctionData
+ WHERE " + condition + @"
+ GROUP BY nameid;";
using (SQLiteDataReader reader = cmd.ExecuteReader()) {
-
while (reader.Read()) {
SQLiteCallTreeNode node = new SQLiteCallTreeNode(reader.GetInt32(1), null, this);
+ node.selectionStartIndex = startIndex;
node.callCount = reader.GetInt32(3);
node.cpuCyclesSpent = (ulong)reader.GetInt64(2);
node.ids = reader.GetString(0).Split(',').Select(s => int.Parse(s)).ToList();
node.ids.Sort();
+ node.hasChildren = reader.GetBoolean(4);
+ node.activeCallCount = reader.GetInt32(5);
// Can not do filtering of root and thread nodes here,
// because retrieval of names needs access to DB
// which is forbidden now (we are inside the lock!)
- functions.Add(node);
+ result.Add(node);
}
}
}
- // Do filtering now via LINQ
- return functions.SkipWhile(i => i.NameMapping.Id == 0 || i.NameMapping.Name.StartsWith("Thread#", StringComparison.Ordinal)).AsQueryable();
+ return result.AsQueryable();
}
*/
diff --git a/src/AddIns/Misc/Profiler/Controller/Data/SQLiteCallTreeNode.cs b/src/AddIns/Misc/Profiler/Controller/Data/SQLiteCallTreeNode.cs
index 1749cab496..5df5e34da2 100644
--- a/src/AddIns/Misc/Profiler/Controller/Data/SQLiteCallTreeNode.cs
+++ b/src/AddIns/Misc/Profiler/Controller/Data/SQLiteCallTreeNode.cs
@@ -29,6 +29,9 @@ namespace ICSharpCode.Profiler.Controller.Data
CallTreeNode parent;
ProfilingDataSQLiteProvider provider;
internal List ids = new List();
+ internal bool hasChildren;
+ internal int activeCallCount;
+ internal int selectionStartIndex;
///
/// Creates a new CallTreeNode.
@@ -95,6 +98,12 @@ namespace ICSharpCode.Profiler.Controller.Data
return CpuCyclesSpent / (1000.0 * this.provider.ProcessorFrequency);
}
}
+
+ public override double TimeSpentSelf {
+ get {
+ return CpuCyclesSpentSelf / (1000.0 * this.provider.ProcessorFrequency);
+ }
+ }
///
/// Gets whether the function call started in a previous data set that's not selected.
@@ -105,8 +114,12 @@ namespace ICSharpCode.Profiler.Controller.Data
}
}
+ public override int CallCount {
+ get { return callCount + activeCallCount; }
+ }
+
///
- /// Merges a collection of CallTreeNodes into one CallTreeNode, all valuess are accumulated.
+ /// Merges a collection of CallTreeNodes into one CallTreeNode, all values are accumulated.
///
/// The collection of nodes to process.
/// A new CallTreeNode.
@@ -114,8 +127,10 @@ namespace ICSharpCode.Profiler.Controller.Data
{
SQLiteCallTreeNode mergedNode = new SQLiteCallTreeNode(0, null, this.provider);
bool initialised = false;
+
foreach (SQLiteCallTreeNode node in nodes) {
mergedNode.ids.AddRange(node.ids);
+ mergedNode.selectionStartIndex = Math.Min(mergedNode.selectionStartIndex, node.selectionStartIndex);
mergedNode.callCount += node.callCount;
mergedNode.cpuCyclesSpent += node.cpuCyclesSpent;
if (!initialised || mergedNode.nameId == node.nameId)
@@ -172,5 +187,9 @@ namespace ICSharpCode.Profiler.Controller.Data
return hash;
}
+
+ public override bool HasChildren {
+ get { return this.hasChildren; }
+ }
}
}
diff --git a/src/AddIns/Misc/Profiler/Controller/Data/UnitTestRootCallTreeNode.cs b/src/AddIns/Misc/Profiler/Controller/Data/UnitTestRootCallTreeNode.cs
index 357083d872..5aacd3feed 100644
--- a/src/AddIns/Misc/Profiler/Controller/Data/UnitTestRootCallTreeNode.cs
+++ b/src/AddIns/Misc/Profiler/Controller/Data/UnitTestRootCallTreeNode.cs
@@ -18,7 +18,7 @@ namespace ICSharpCode.Profiler.Controller.Data
List unitTests;
///
- /// Creates a new UnitTestRootCallTreeNode.
+ /// Creates a new UnitTestRootCallTreeNode.
///
public UnitTestRootCallTreeNode(IEnumerable unitTests)
{
@@ -46,58 +46,65 @@ namespace ICSharpCode.Profiler.Controller.Data
}
}
- ///
+ ///
public override double TimeSpent {
get {
return 0;
}
}
-
- ///
+
+ ///
public override int RawCallCount {
get {
return 0;
}
}
-
- ///
+
+ ///
public override CallTreeNode Parent {
get {
return null;
}
}
-
- ///
+
+ ///
public override CallTreeNode Merge(System.Collections.Generic.IEnumerable nodes)
{
// throw new ShouldNeverHappenException();
throw new NotSupportedException("Cannot merge a UnitTestRootCallTreeNode (should never be possible)");
}
-
- ///
+
+ ///
public override int GetHashCode()
{
return this.unitTests.Aggregate(0, (sum, item) => sum ^= item.GetHashCode());
}
-
- ///
+
+ ///
public override bool Equals(CallTreeNode other)
{
return (other is UnitTestRootCallTreeNode) && (other as UnitTestRootCallTreeNode).unitTests.SequenceEqual(unitTests);
}
-
- ///
+
+ ///
public override IQueryable Callers {
get {
return Enumerable.Empty().AsQueryable();
}
}
-
- ///
+
+ ///
public override IQueryable Children {
get {
return unitTests.AsQueryable();
}
}
+
+ ///
+ public override double TimeSpentSelf {
+ get {
+ return 0;
+ }
+ }
}
}
diff --git a/src/AddIns/Misc/Profiler/Controller/Data/UnmanagedCallTreeNode.cs b/src/AddIns/Misc/Profiler/Controller/Data/UnmanagedCallTreeNode.cs
index 899379f9e3..613019a319 100644
--- a/src/AddIns/Misc/Profiler/Controller/Data/UnmanagedCallTreeNode.cs
+++ b/src/AddIns/Misc/Profiler/Controller/Data/UnmanagedCallTreeNode.cs
@@ -94,6 +94,12 @@ namespace ICSharpCode.Profiler.Controller.Data
return this.CpuCyclesSpent / (1000.0 * this.dataSet.ProcessorFrequency);
}
}
+
+ public override double TimeSpentSelf {
+ get {
+ return this.CpuCyclesSpentSelf / (1000.0 * this.dataSet.ProcessorFrequency);
+ }
+ }
public override CallTreeNode Merge(IEnumerable nodes)
{
diff --git a/src/AddIns/Misc/Profiler/Frontend/Controls/CallTreeNodeViewModel.cs b/src/AddIns/Misc/Profiler/Frontend/Controls/CallTreeNodeViewModel.cs
index ade07b82e6..ca6b11a87a 100644
--- a/src/AddIns/Misc/Profiler/Frontend/Controls/CallTreeNodeViewModel.cs
+++ b/src/AddIns/Misc/Profiler/Frontend/Controls/CallTreeNodeViewModel.cs
@@ -330,20 +330,18 @@ namespace ICSharpCode.Profiler.Controls
public string TimeSpentSelf {
get {
- if (!node.IsThread) {
- double value = node.TimeSpent - node.Children.Aggregate(0.0, (sum, item) => sum + item.TimeSpent);
- return value.ToString("f6") + "ms";
- } else
+ if (!node.IsThread)
+ return node.TimeSpentSelf.ToString("f6") + "ms";
+ else
return null;
}
}
public string TimeSpentSelfPerCall {
get {
- if (!node.IsThread) {
- double value = node.TimeSpent - node.Children.Aggregate(0.0, (sum, item) => sum + item.TimeSpent);
- return (value / node.CallCount).ToString("f6") + "ms";
- } else
+ if (!node.IsThread)
+ return (node.TimeSpentSelf / node.CallCount).ToString("f6") + "ms";
+ else
return null;
}
}
@@ -369,7 +367,7 @@ namespace ICSharpCode.Profiler.Controls
public Visibility CheckBoxVisibility
{
get {
- if (this.Children.Count > 0)
+ if (node.HasChildren)
return Visibility.Visible;
else
return Visibility.Hidden;
diff --git a/src/AddIns/Misc/Profiler/Frontend/Controls/QueryView.xaml.cs b/src/AddIns/Misc/Profiler/Frontend/Controls/QueryView.xaml.cs
index 9bd57f1046..6c0f0a6bf1 100644
--- a/src/AddIns/Misc/Profiler/Frontend/Controls/QueryView.xaml.cs
+++ b/src/AddIns/Misc/Profiler/Frontend/Controls/QueryView.xaml.cs
@@ -190,16 +190,26 @@ namespace ICSharpCode.Profiler.Controls
this.visibleColumnsSelection.ItemsSource = this.gridView.Columns.Select(col => new GridViewColumnModel(col));
this.treeView.SizeChanged += delegate(object sender, SizeChangedEventArgs e) {
- if (e.NewSize.Width > 0 && e.PreviousSize.Width > 0 &&
- (nameColumn.Width + (e.NewSize.Width - e.PreviousSize.Width)) > 0) {
- double newValue = e.NewSize.Width - this.callCountColumn.Width
+ if (e.NewSize.Width > 0 && e.PreviousSize.Width > 0) {
+ double adjustedNameColumnWidth = nameColumn.Width + e.NewSize.Width - e.PreviousSize.Width;
+ double matchingNameColumnWidth = e.NewSize.Width - this.callCountColumn.Width
- this.percentColumn.Width - this.timeSpentColumn.Width
- this.timeSpentSelfColumn.Width - this.timeSpentPerCallColumn.Width
- - this.timeSpentSelfPerCallColumn.Width;
- if ((nameColumn.Width + (e.NewSize.Width - e.PreviousSize.Width)) >= newValue)
- this.nameColumn.Width = newValue - 25;
- else
- nameColumn.Width += (e.NewSize.Width - e.PreviousSize.Width);
+ - this.timeSpentSelfPerCallColumn.Width - 25;
+
+ // always keep name column at least 75 pixels wide
+ if (matchingNameColumnWidth < 75)
+ matchingNameColumnWidth = 75;
+
+ if (e.NewSize.Width >= e.PreviousSize.Width) {
+ // treeView got wider: also make name column wider if there's space free
+ if (adjustedNameColumnWidth <= matchingNameColumnWidth)
+ nameColumn.Width = adjustedNameColumnWidth;
+ } else {
+ // treeView got smaller: make column smaller unless there's space free
+ if (adjustedNameColumnWidth >= matchingNameColumnWidth)
+ nameColumn.Width = adjustedNameColumnWidth;
+ }
}
};
}
@@ -332,17 +342,17 @@ namespace ICSharpCode.Profiler.Controls
void BtnExpandHotPathSubtreeClick(object sender, RoutedEventArgs e)
{
foreach (CallTreeNodeViewModel node in this.SelectedItems.ToArray()) {
- ExpandHotPathItems(node);
+ ExpandHotPathItems(node, node);
}
}
- void ExpandHotPathItems(CallTreeNodeViewModel parent)
+ void ExpandHotPathItems(CallTreeNodeViewModel parent, CallTreeNodeViewModel selectedRoot)
{
- if (parent.HotPathIndicatorVisibility == Visibility.Visible) {
+ if ((parent.CpuCyclesSpent / (double)selectedRoot.CpuCyclesSpent) >= 0.2) {
parent.IsExpanded = true;
foreach (CallTreeNodeViewModel node in parent.Children)
- ExpandHotPathItems(node);
+ ExpandHotPathItems(node, selectedRoot);
}
}
diff --git a/src/AddIns/Misc/Profiler/Hook/ProfilerMetaData.cpp b/src/AddIns/Misc/Profiler/Hook/ProfilerMetaData.cpp
index d90fd05df0..a3dd180da6 100644
--- a/src/AddIns/Misc/Profiler/Hook/ProfilerMetaData.cpp
+++ b/src/AddIns/Misc/Profiler/Hook/ProfilerMetaData.cpp
@@ -528,8 +528,10 @@ bool SignatureReader::ReadCompressedInt(int *out)
return true;
}
+// public key token: b77a5c561934e089
const byte mscorlibkey[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+// public key token: b03f5f7f11d50a3a
const byte systemdrawingkey[] = {
0x00, 0x24, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x06, 0x02, 0x00, 0x00, 0x00,
0x24, 0x00, 0x00, 0x52, 0x53, 0x41, 0x31, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x07, 0xD1,
@@ -543,6 +545,20 @@ const byte systemdrawingkey[] = {
0xC0, 0x93, 0x34, 0x4D, 0x5A, 0xD2, 0x93
};
+// public key token: 31bf3856ad364e35
+const byte wpfassemblieskey[] = {
+ 0x00, 0x24, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x06, 0x02, 0x00, 0x00, 0x00,
+ 0x24, 0x00, 0x00, 0x52, 0x53, 0x41, 0x31, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0xB5, 0xFC,
+ 0x90, 0xE7, 0x02, 0x7F, 0x67, 0x87, 0x1E, 0x77, 0x3A, 0x8F, 0xDE, 0x89, 0x38, 0xC8, 0x1D, 0xD4, 0x02,
+ 0xBA, 0x65, 0xB9, 0x20, 0x1D, 0x60, 0x59, 0x3E, 0x96, 0xC4, 0x92, 0x65, 0x1E, 0x88, 0x9C, 0xC1, 0x3F,
+ 0x14, 0x15, 0xEB, 0xB5, 0x3F, 0xAC, 0x11, 0x31, 0xAE, 0x0B, 0xD3, 0x33, 0xC5, 0xEE, 0x60, 0x21, 0x67,
+ 0x2D, 0x97, 0x18, 0xEA, 0x31, 0xA8, 0xAE, 0xBD, 0x0D, 0xA0, 0x07, 0x2F, 0x25, 0xD8, 0x7D, 0xBA, 0x6F,
+ 0xC9, 0x0F, 0xFD, 0x59, 0x8E, 0xD4, 0xDA, 0x35, 0xE4, 0x4C, 0x39, 0x8C, 0x45, 0x43, 0x07, 0xE8, 0xE3,
+ 0x3B, 0x84, 0x26, 0x14, 0x3D, 0xAE, 0xC9, 0xF5, 0x96, 0x83, 0x6F, 0x97, 0xC8, 0xF7, 0x47, 0x50, 0xE5,
+ 0x97, 0x5C, 0x64, 0xE2, 0x18, 0x9F, 0x45, 0xDE, 0xF4, 0x6B, 0x2A, 0x2B, 0x12, 0x47, 0xAD, 0xC3, 0x65,
+ 0x2B, 0xF5, 0xC3, 0x08, 0x05, 0x5D, 0xA9
+};
+
bool SignatureReader::IsNetInternal(FunctionID fid)
{
@@ -567,6 +583,8 @@ bool SignatureReader::IsNetInternal(FunctionID fid)
return true;
if (pKLength == sizeof(systemdrawingkey) && memcmp(systemdrawingkey, b, sizeof(systemdrawingkey)) == 0)
return true;
+ if (pKLength == sizeof(wpfassemblieskey) && memcmp(wpfassemblieskey, b, sizeof(wpfassemblieskey)) == 0)
+ return true;
}
}
diff --git a/src/Libraries/NRefactory/Project/Src/Parser/CSharp/CSharpParser.cs b/src/Libraries/NRefactory/Project/Src/Parser/CSharp/CSharpParser.cs
index fd3adc8edf..48588637d3 100644
--- a/src/Libraries/NRefactory/Project/Src/Parser/CSharp/CSharpParser.cs
+++ b/src/Libraries/NRefactory/Project/Src/Parser/CSharp/CSharpParser.cs
@@ -503,9 +503,7 @@ namespace ICSharpCode.NRefactory.Parser.CSharp
string val = la.val;
return (cur == Tokens.Event || cur == Tokens.Return ||
- (Tokens.IdentifierTokens[cur] &&
- (val == "field" || val == "method" || val == "module" ||
- val == "param" || val == "property" || val == "type"))) &&
+ Tokens.IdentifierTokens[cur]) &&
Peek(1).kind == Tokens.Colon;
}
@@ -551,8 +549,9 @@ namespace ICSharpCode.NRefactory.Parser.CSharp
TypeReference targetType = GetTypeReferenceFromExpression(member.TargetObject);
if (targetType != null) {
if (targetType.GenericTypes.Count == 0 && targetType.IsArrayType == false) {
- TypeReference tr = new TypeReference(targetType.Type + "." + member.MemberName, member.TypeArguments);
- tr.IsGlobal = targetType.IsGlobal;
+ TypeReference tr = targetType.Clone();
+ tr.Type = tr.Type + "." + member.MemberName;
+ tr.GenericTypes.AddRange(member.TypeArguments);
return tr;
} else {
return new InnerClassTypeReference(targetType, member.MemberName, member.TypeArguments);
diff --git a/src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs b/src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs
index 933d98504f..3c78839d1b 100644
--- a/src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs
+++ b/src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs
@@ -56,23 +56,23 @@ IsGlobalAttrTarget()) {
void ExternAliasDirective() {
-#line 350 "cs.ATG"
+#line 345 "cs.ATG"
ExternAliasDirective ead = new ExternAliasDirective { StartLocation = la.Location };
Expect(71);
Identifier();
-#line 353 "cs.ATG"
+#line 348 "cs.ATG"
if (t.val != "alias") Error("Expected 'extern alias'.");
Identifier();
-#line 354 "cs.ATG"
+#line 349 "cs.ATG"
ead.Name = t.val;
Expect(11);
-#line 355 "cs.ATG"
+#line 350 "cs.ATG"
ead.EndLocation = t.EndLocation;
-#line 356 "cs.ATG"
+#line 351 "cs.ATG"
compilationUnit.AddChild(ead);
}
@@ -160,7 +160,7 @@ out attribute);
void NamespaceMemberDecl() {
-#line 323 "cs.ATG"
+#line 318 "cs.ATG"
AttributeSection section;
List attributes = new List();
ModifierList m = new ModifierList();
@@ -169,13 +169,13 @@ out attribute);
if (la.kind == 88) {
lexer.NextToken();
-#line 329 "cs.ATG"
+#line 324 "cs.ATG"
Location startPos = t.Location;
Qualident(
-#line 330 "cs.ATG"
+#line 325 "cs.ATG"
out qualident);
-#line 330 "cs.ATG"
+#line 325 "cs.ATG"
INode node = new NamespaceDeclaration(qualident);
node.StartLocation = startPos;
compilationUnit.AddChild(node);
@@ -196,58 +196,58 @@ out qualident);
lexer.NextToken();
}
-#line 340 "cs.ATG"
+#line 335 "cs.ATG"
node.EndLocation = t.EndLocation;
compilationUnit.BlockEnd();
} else if (StartOf(2)) {
while (la.kind == 18) {
AttributeSection(
-#line 344 "cs.ATG"
+#line 339 "cs.ATG"
out section);
-#line 344 "cs.ATG"
+#line 339 "cs.ATG"
attributes.Add(section);
}
while (StartOf(3)) {
TypeModifier(
-#line 345 "cs.ATG"
+#line 340 "cs.ATG"
m);
}
TypeDecl(
-#line 346 "cs.ATG"
+#line 341 "cs.ATG"
m, attributes);
} else SynErr(146);
}
void Qualident(
-#line 480 "cs.ATG"
+#line 475 "cs.ATG"
out string qualident) {
Identifier();
-#line 482 "cs.ATG"
+#line 477 "cs.ATG"
qualidentBuilder.Length = 0; qualidentBuilder.Append(t.val);
while (
-#line 483 "cs.ATG"
+#line 478 "cs.ATG"
DotAndIdent()) {
Expect(15);
Identifier();
-#line 483 "cs.ATG"
+#line 478 "cs.ATG"
qualidentBuilder.Append('.');
qualidentBuilder.Append(t.val);
}
-#line 486 "cs.ATG"
+#line 481 "cs.ATG"
qualident = qualidentBuilder.ToString();
}
void NonArrayType(
-#line 598 "cs.ATG"
+#line 593 "cs.ATG"
out TypeReference type) {
-#line 600 "cs.ATG"
+#line 595 "cs.ATG"
Location startPos = la.Location;
string name;
int pointer = 0;
@@ -255,37 +255,37 @@ out TypeReference type) {
if (StartOf(4)) {
ClassType(
-#line 606 "cs.ATG"
+#line 601 "cs.ATG"
out type, false);
} else if (StartOf(5)) {
SimpleType(
-#line 607 "cs.ATG"
+#line 602 "cs.ATG"
out name);
-#line 607 "cs.ATG"
+#line 602 "cs.ATG"
type = new TypeReference(name, true);
} else if (la.kind == 123) {
lexer.NextToken();
Expect(6);
-#line 608 "cs.ATG"
+#line 603 "cs.ATG"
pointer = 1; type = new TypeReference("System.Void", true);
} else SynErr(147);
if (la.kind == 12) {
NullableQuestionMark(
-#line 611 "cs.ATG"
+#line 606 "cs.ATG"
ref type);
}
while (
-#line 613 "cs.ATG"
+#line 608 "cs.ATG"
IsPointer()) {
Expect(6);
-#line 614 "cs.ATG"
+#line 609 "cs.ATG"
++pointer;
}
-#line 616 "cs.ATG"
+#line 611 "cs.ATG"
if (type != null) {
type.PointerNestingLevel = pointer;
type.EndLocation = t.EndLocation;
@@ -487,68 +487,68 @@ out expr);
}
void Expr(
-#line 1768 "cs.ATG"
+#line 1763 "cs.ATG"
out Expression expr) {
-#line 1769 "cs.ATG"
+#line 1764 "cs.ATG"
expr = null; Expression expr1 = null, expr2 = null; AssignmentOperatorType op;
-#line 1771 "cs.ATG"
+#line 1766 "cs.ATG"
Location startLocation = la.Location;
UnaryExpr(
-#line 1772 "cs.ATG"
+#line 1767 "cs.ATG"
out expr);
if (StartOf(7)) {
AssignmentOperator(
-#line 1775 "cs.ATG"
+#line 1770 "cs.ATG"
out op);
Expr(
-#line 1775 "cs.ATG"
+#line 1770 "cs.ATG"
out expr1);
-#line 1775 "cs.ATG"
+#line 1770 "cs.ATG"
expr = new AssignmentExpression(expr, op, expr1);
} else if (
-#line 1776 "cs.ATG"
+#line 1771 "cs.ATG"
la.kind == Tokens.GreaterThan && Peek(1).kind == Tokens.GreaterEqual) {
AssignmentOperator(
-#line 1777 "cs.ATG"
+#line 1772 "cs.ATG"
out op);
Expr(
-#line 1777 "cs.ATG"
+#line 1772 "cs.ATG"
out expr1);
-#line 1777 "cs.ATG"
+#line 1772 "cs.ATG"
expr = new AssignmentExpression(expr, op, expr1);
} else if (StartOf(8)) {
ConditionalOrExpr(
-#line 1779 "cs.ATG"
+#line 1774 "cs.ATG"
ref expr);
if (la.kind == 13) {
lexer.NextToken();
Expr(
-#line 1780 "cs.ATG"
+#line 1775 "cs.ATG"
out expr1);
-#line 1780 "cs.ATG"
+#line 1775 "cs.ATG"
expr = new BinaryOperatorExpression(expr, BinaryOperatorType.NullCoalescing, expr1);
}
if (la.kind == 12) {
lexer.NextToken();
Expr(
-#line 1781 "cs.ATG"
+#line 1776 "cs.ATG"
out expr1);
Expect(9);
Expr(
-#line 1781 "cs.ATG"
+#line 1776 "cs.ATG"
out expr2);
-#line 1781 "cs.ATG"
+#line 1776 "cs.ATG"
expr = new ConditionalExpression(expr, expr1, expr2);
}
} else SynErr(150);
-#line 1784 "cs.ATG"
+#line 1779 "cs.ATG"
if (expr != null) {
if (expr.StartLocation.IsEmpty)
expr.StartLocation = startLocation;
@@ -589,30 +589,25 @@ IsLocalAttrTarget()) {
Identifier();
#line 300 "cs.ATG"
- if (t.val != "field" && t.val != "method" &&
- t.val != "param" &&
- t.val != "property" && t.val != "type")
- Error("attribute target specifier (field, event, method, param, property, return or type) expected");
- attributeTarget = t.val;
-
+ attributeTarget = t.val;
}
Expect(9);
}
Attribute(
-#line 309 "cs.ATG"
+#line 304 "cs.ATG"
out attribute);
-#line 309 "cs.ATG"
+#line 304 "cs.ATG"
attributes.Add(attribute);
while (
-#line 310 "cs.ATG"
+#line 305 "cs.ATG"
NotFinalComma()) {
Expect(14);
Attribute(
-#line 310 "cs.ATG"
+#line 305 "cs.ATG"
out attribute);
-#line 310 "cs.ATG"
+#line 305 "cs.ATG"
attributes.Add(attribute);
}
if (la.kind == 14) {
@@ -620,7 +615,7 @@ out attribute);
}
Expect(19);
-#line 312 "cs.ATG"
+#line 307 "cs.ATG"
section = new AttributeSection {
AttributeTarget = attributeTarget,
Attributes = attributes,
@@ -631,76 +626,76 @@ out attribute);
}
void TypeModifier(
-#line 691 "cs.ATG"
+#line 686 "cs.ATG"
ModifierList m) {
switch (la.kind) {
case 89: {
lexer.NextToken();
-#line 693 "cs.ATG"
+#line 688 "cs.ATG"
m.Add(Modifiers.New, t.Location);
break;
}
case 98: {
lexer.NextToken();
-#line 694 "cs.ATG"
+#line 689 "cs.ATG"
m.Add(Modifiers.Public, t.Location);
break;
}
case 97: {
lexer.NextToken();
-#line 695 "cs.ATG"
+#line 690 "cs.ATG"
m.Add(Modifiers.Protected, t.Location);
break;
}
case 84: {
lexer.NextToken();
-#line 696 "cs.ATG"
+#line 691 "cs.ATG"
m.Add(Modifiers.Internal, t.Location);
break;
}
case 96: {
lexer.NextToken();
-#line 697 "cs.ATG"
+#line 692 "cs.ATG"
m.Add(Modifiers.Private, t.Location);
break;
}
case 119: {
lexer.NextToken();
-#line 698 "cs.ATG"
+#line 693 "cs.ATG"
m.Add(Modifiers.Unsafe, t.Location);
break;
}
case 49: {
lexer.NextToken();
-#line 699 "cs.ATG"
+#line 694 "cs.ATG"
m.Add(Modifiers.Abstract, t.Location);
break;
}
case 103: {
lexer.NextToken();
-#line 700 "cs.ATG"
+#line 695 "cs.ATG"
m.Add(Modifiers.Sealed, t.Location);
break;
}
case 107: {
lexer.NextToken();
-#line 701 "cs.ATG"
+#line 696 "cs.ATG"
m.Add(Modifiers.Static, t.Location);
break;
}
case 126: {
lexer.NextToken();
-#line 702 "cs.ATG"
+#line 697 "cs.ATG"
m.Add(Modifiers.Partial, t.Location);
break;
}
@@ -709,10 +704,10 @@ ModifierList m) {
}
void TypeDecl(
-#line 359 "cs.ATG"
+#line 354 "cs.ATG"
ModifierList m, List attributes) {
-#line 361 "cs.ATG"
+#line 356 "cs.ATG"
TypeReference type;
List names;
List p = new List();
@@ -721,11 +716,11 @@ ModifierList m, List attributes) {
if (la.kind == 59) {
-#line 367 "cs.ATG"
+#line 362 "cs.ATG"
m.Check(Modifiers.Classes);
lexer.NextToken();
-#line 368 "cs.ATG"
+#line 363 "cs.ATG"
TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
templates = newType.Templates;
compilationUnit.AddChild(newType);
@@ -736,28 +731,28 @@ ModifierList m, List attributes) {
Identifier();
-#line 376 "cs.ATG"
+#line 371 "cs.ATG"
newType.Name = t.val;
if (la.kind == 23) {
TypeParameterList(
-#line 379 "cs.ATG"
+#line 374 "cs.ATG"
templates);
}
if (la.kind == 9) {
ClassBase(
-#line 381 "cs.ATG"
+#line 376 "cs.ATG"
out names);
-#line 381 "cs.ATG"
+#line 376 "cs.ATG"
newType.BaseTypes = names;
}
while (la.kind == 127) {
TypeParameterConstraintsClause(
-#line 384 "cs.ATG"
+#line 379 "cs.ATG"
templates);
}
-#line 386 "cs.ATG"
+#line 381 "cs.ATG"
newType.BodyStartLocation = t.EndLocation;
Expect(16);
ClassBody();
@@ -766,18 +761,18 @@ templates);
lexer.NextToken();
}
-#line 390 "cs.ATG"
+#line 385 "cs.ATG"
newType.EndLocation = t.EndLocation;
compilationUnit.BlockEnd();
} else if (StartOf(9)) {
-#line 393 "cs.ATG"
+#line 388 "cs.ATG"
m.Check(Modifiers.StructsInterfacesEnumsDelegates);
if (la.kind == 109) {
lexer.NextToken();
-#line 394 "cs.ATG"
+#line 389 "cs.ATG"
TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
templates = newType.Templates;
newType.StartLocation = m.GetDeclarationLocation(t.Location);
@@ -787,42 +782,42 @@ templates);
Identifier();
-#line 401 "cs.ATG"
+#line 396 "cs.ATG"
newType.Name = t.val;
if (la.kind == 23) {
TypeParameterList(
-#line 404 "cs.ATG"
+#line 399 "cs.ATG"
templates);
}
if (la.kind == 9) {
StructInterfaces(
-#line 406 "cs.ATG"
+#line 401 "cs.ATG"
out names);
-#line 406 "cs.ATG"
+#line 401 "cs.ATG"
newType.BaseTypes = names;
}
while (la.kind == 127) {
TypeParameterConstraintsClause(
-#line 409 "cs.ATG"
+#line 404 "cs.ATG"
templates);
}
-#line 412 "cs.ATG"
+#line 407 "cs.ATG"
newType.BodyStartLocation = t.EndLocation;
StructBody();
if (la.kind == 11) {
lexer.NextToken();
}
-#line 414 "cs.ATG"
+#line 409 "cs.ATG"
newType.EndLocation = t.EndLocation;
compilationUnit.BlockEnd();
} else if (la.kind == 83) {
lexer.NextToken();
-#line 418 "cs.ATG"
+#line 413 "cs.ATG"
TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
templates = newType.Templates;
compilationUnit.AddChild(newType);
@@ -832,42 +827,42 @@ templates);
Identifier();
-#line 425 "cs.ATG"
+#line 420 "cs.ATG"
newType.Name = t.val;
if (la.kind == 23) {
TypeParameterList(
-#line 428 "cs.ATG"
+#line 423 "cs.ATG"
templates);
}
if (la.kind == 9) {
InterfaceBase(
-#line 430 "cs.ATG"
+#line 425 "cs.ATG"
out names);
-#line 430 "cs.ATG"
+#line 425 "cs.ATG"
newType.BaseTypes = names;
}
while (la.kind == 127) {
TypeParameterConstraintsClause(
-#line 433 "cs.ATG"
+#line 428 "cs.ATG"
templates);
}
-#line 435 "cs.ATG"
+#line 430 "cs.ATG"
newType.BodyStartLocation = t.EndLocation;
InterfaceBody();
if (la.kind == 11) {
lexer.NextToken();
}
-#line 437 "cs.ATG"
+#line 432 "cs.ATG"
newType.EndLocation = t.EndLocation;
compilationUnit.BlockEnd();
} else if (la.kind == 68) {
lexer.NextToken();
-#line 441 "cs.ATG"
+#line 436 "cs.ATG"
TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
compilationUnit.AddChild(newType);
compilationUnit.BlockStart(newType);
@@ -876,79 +871,79 @@ templates);
Identifier();
-#line 447 "cs.ATG"
+#line 442 "cs.ATG"
newType.Name = t.val;
if (la.kind == 9) {
lexer.NextToken();
IntegralType(
-#line 448 "cs.ATG"
+#line 443 "cs.ATG"
out name);
-#line 448 "cs.ATG"
+#line 443 "cs.ATG"
newType.BaseTypes.Add(new TypeReference(name, true));
}
-#line 450 "cs.ATG"
+#line 445 "cs.ATG"
newType.BodyStartLocation = t.EndLocation;
EnumBody();
if (la.kind == 11) {
lexer.NextToken();
}
-#line 452 "cs.ATG"
+#line 447 "cs.ATG"
newType.EndLocation = t.EndLocation;
compilationUnit.BlockEnd();
} else {
lexer.NextToken();
-#line 456 "cs.ATG"
+#line 451 "cs.ATG"
DelegateDeclaration delegateDeclr = new DelegateDeclaration(m.Modifier, attributes);
templates = delegateDeclr.Templates;
delegateDeclr.StartLocation = m.GetDeclarationLocation(t.Location);
if (
-#line 460 "cs.ATG"
+#line 455 "cs.ATG"
NotVoidPointer()) {
Expect(123);
-#line 460 "cs.ATG"
+#line 455 "cs.ATG"
delegateDeclr.ReturnType = new TypeReference("System.Void", true);
} else if (StartOf(10)) {
Type(
-#line 461 "cs.ATG"
+#line 456 "cs.ATG"
out type);
-#line 461 "cs.ATG"
+#line 456 "cs.ATG"
delegateDeclr.ReturnType = type;
} else SynErr(152);
Identifier();
-#line 463 "cs.ATG"
+#line 458 "cs.ATG"
delegateDeclr.Name = t.val;
if (la.kind == 23) {
TypeParameterList(
-#line 466 "cs.ATG"
+#line 461 "cs.ATG"
templates);
}
Expect(20);
if (StartOf(11)) {
FormalParameterList(
-#line 468 "cs.ATG"
+#line 463 "cs.ATG"
p);
-#line 468 "cs.ATG"
+#line 463 "cs.ATG"
delegateDeclr.Parameters = p;
}
Expect(21);
while (la.kind == 127) {
TypeParameterConstraintsClause(
-#line 472 "cs.ATG"
+#line 467 "cs.ATG"
templates);
}
Expect(11);
-#line 474 "cs.ATG"
+#line 469 "cs.ATG"
delegateDeclr.EndLocation = t.EndLocation;
compilationUnit.AddChild(delegateDeclr);
@@ -957,87 +952,87 @@ templates);
}
void TypeParameterList(
-#line 2349 "cs.ATG"
+#line 2344 "cs.ATG"
List templates) {
-#line 2351 "cs.ATG"
+#line 2346 "cs.ATG"
AttributeSection section;
List attributes = new List();
Expect(23);
while (la.kind == 18) {
AttributeSection(
-#line 2355 "cs.ATG"
+#line 2350 "cs.ATG"
out section);
-#line 2355 "cs.ATG"
+#line 2350 "cs.ATG"
attributes.Add(section);
}
Identifier();
-#line 2356 "cs.ATG"
+#line 2351 "cs.ATG"
templates.Add(new TemplateDefinition(t.val, attributes));
while (la.kind == 14) {
lexer.NextToken();
while (la.kind == 18) {
AttributeSection(
-#line 2357 "cs.ATG"
+#line 2352 "cs.ATG"
out section);
-#line 2357 "cs.ATG"
+#line 2352 "cs.ATG"
attributes.Add(section);
}
Identifier();
-#line 2358 "cs.ATG"
+#line 2353 "cs.ATG"
templates.Add(new TemplateDefinition(t.val, attributes));
}
Expect(22);
}
void ClassBase(
-#line 489 "cs.ATG"
+#line 484 "cs.ATG"
out List names) {
-#line 491 "cs.ATG"
+#line 486 "cs.ATG"
TypeReference typeRef;
names = new List();
Expect(9);
ClassType(
-#line 495 "cs.ATG"
+#line 490 "cs.ATG"
out typeRef, false);
-#line 495 "cs.ATG"
+#line 490 "cs.ATG"
if (typeRef != null) { names.Add(typeRef); }
while (la.kind == 14) {
lexer.NextToken();
TypeName(
-#line 496 "cs.ATG"
+#line 491 "cs.ATG"
out typeRef, false);
-#line 496 "cs.ATG"
+#line 491 "cs.ATG"
if (typeRef != null) { names.Add(typeRef); }
}
}
void TypeParameterConstraintsClause(
-#line 2362 "cs.ATG"
+#line 2357 "cs.ATG"
List templates) {
-#line 2363 "cs.ATG"
+#line 2358 "cs.ATG"
string name = ""; TypeReference type;
Expect(127);
Identifier();
-#line 2366 "cs.ATG"
+#line 2361 "cs.ATG"
name = t.val;
Expect(9);
TypeParameterConstraintsClauseBase(
-#line 2368 "cs.ATG"
+#line 2363 "cs.ATG"
out type);
-#line 2369 "cs.ATG"
+#line 2364 "cs.ATG"
TemplateDefinition td = null;
foreach (TemplateDefinition d in templates) {
if (d.Name == name) {
@@ -1050,10 +1045,10 @@ out type);
while (la.kind == 14) {
lexer.NextToken();
TypeParameterConstraintsClauseBase(
-#line 2378 "cs.ATG"
+#line 2373 "cs.ATG"
out type);
-#line 2379 "cs.ATG"
+#line 2374 "cs.ATG"
td = null;
foreach (TemplateDefinition d in templates) {
if (d.Name == name) {
@@ -1068,109 +1063,109 @@ out type);
void ClassBody() {
-#line 500 "cs.ATG"
+#line 495 "cs.ATG"
AttributeSection section;
while (StartOf(12)) {
-#line 502 "cs.ATG"
+#line 497 "cs.ATG"
List attributes = new List();
ModifierList m = new ModifierList();
while (!(StartOf(13))) {SynErr(154); lexer.NextToken(); }
while (la.kind == 18) {
AttributeSection(
-#line 506 "cs.ATG"
+#line 501 "cs.ATG"
out section);
-#line 506 "cs.ATG"
+#line 501 "cs.ATG"
attributes.Add(section);
}
MemberModifiers(
-#line 507 "cs.ATG"
+#line 502 "cs.ATG"
m);
ClassMemberDecl(
-#line 508 "cs.ATG"
+#line 503 "cs.ATG"
m, attributes);
}
}
void StructInterfaces(
-#line 512 "cs.ATG"
+#line 507 "cs.ATG"
out List names) {
-#line 514 "cs.ATG"
+#line 509 "cs.ATG"
TypeReference typeRef;
names = new List();
Expect(9);
TypeName(
-#line 518 "cs.ATG"
+#line 513 "cs.ATG"
out typeRef, false);
-#line 518 "cs.ATG"
+#line 513 "cs.ATG"
if (typeRef != null) { names.Add(typeRef); }
while (la.kind == 14) {
lexer.NextToken();
TypeName(
-#line 519 "cs.ATG"
+#line 514 "cs.ATG"
out typeRef, false);
-#line 519 "cs.ATG"
+#line 514 "cs.ATG"
if (typeRef != null) { names.Add(typeRef); }
}
}
void StructBody() {
-#line 523 "cs.ATG"
+#line 518 "cs.ATG"
AttributeSection section;
Expect(16);
while (StartOf(14)) {
-#line 526 "cs.ATG"
+#line 521 "cs.ATG"
List attributes = new List();
ModifierList m = new ModifierList();
while (la.kind == 18) {
AttributeSection(
-#line 529 "cs.ATG"
+#line 524 "cs.ATG"
out section);
-#line 529 "cs.ATG"
+#line 524 "cs.ATG"
attributes.Add(section);
}
MemberModifiers(
-#line 530 "cs.ATG"
+#line 525 "cs.ATG"
m);
StructMemberDecl(
-#line 531 "cs.ATG"
+#line 526 "cs.ATG"
m, attributes);
}
Expect(17);
}
void InterfaceBase(
-#line 536 "cs.ATG"
+#line 531 "cs.ATG"
out List names) {
-#line 538 "cs.ATG"
+#line 533 "cs.ATG"
TypeReference typeRef;
names = new List();
Expect(9);
TypeName(
-#line 542 "cs.ATG"
+#line 537 "cs.ATG"
out typeRef, false);
-#line 542 "cs.ATG"
+#line 537 "cs.ATG"
if (typeRef != null) { names.Add(typeRef); }
while (la.kind == 14) {
lexer.NextToken();
TypeName(
-#line 543 "cs.ATG"
+#line 538 "cs.ATG"
out typeRef, false);
-#line 543 "cs.ATG"
+#line 538 "cs.ATG"
if (typeRef != null) { names.Add(typeRef); }
}
}
@@ -1185,72 +1180,72 @@ out typeRef, false);
}
void IntegralType(
-#line 713 "cs.ATG"
+#line 708 "cs.ATG"
out string name) {
-#line 713 "cs.ATG"
+#line 708 "cs.ATG"
name = "";
switch (la.kind) {
case 102: {
lexer.NextToken();
-#line 715 "cs.ATG"
+#line 710 "cs.ATG"
name = "System.SByte";
break;
}
case 54: {
lexer.NextToken();
-#line 716 "cs.ATG"
+#line 711 "cs.ATG"
name = "System.Byte";
break;
}
case 104: {
lexer.NextToken();
-#line 717 "cs.ATG"
+#line 712 "cs.ATG"
name = "System.Int16";
break;
}
case 120: {
lexer.NextToken();
-#line 718 "cs.ATG"
+#line 713 "cs.ATG"
name = "System.UInt16";
break;
}
case 82: {
lexer.NextToken();
-#line 719 "cs.ATG"
+#line 714 "cs.ATG"
name = "System.Int32";
break;
}
case 116: {
lexer.NextToken();
-#line 720 "cs.ATG"
+#line 715 "cs.ATG"
name = "System.UInt32";
break;
}
case 87: {
lexer.NextToken();
-#line 721 "cs.ATG"
+#line 716 "cs.ATG"
name = "System.Int64";
break;
}
case 117: {
lexer.NextToken();
-#line 722 "cs.ATG"
+#line 717 "cs.ATG"
name = "System.UInt64";
break;
}
case 57: {
lexer.NextToken();
-#line 723 "cs.ATG"
+#line 718 "cs.ATG"
name = "System.Char";
break;
}
@@ -1260,25 +1255,25 @@ out string name) {
void EnumBody() {
-#line 552 "cs.ATG"
+#line 547 "cs.ATG"
FieldDeclaration f;
Expect(16);
if (StartOf(17)) {
EnumMemberDecl(
-#line 555 "cs.ATG"
+#line 550 "cs.ATG"
out f);
-#line 555 "cs.ATG"
+#line 550 "cs.ATG"
compilationUnit.AddChild(f);
while (
-#line 556 "cs.ATG"
+#line 551 "cs.ATG"
NotFinalComma()) {
Expect(14);
EnumMemberDecl(
-#line 557 "cs.ATG"
+#line 552 "cs.ATG"
out f);
-#line 557 "cs.ATG"
+#line 552 "cs.ATG"
compilationUnit.AddChild(f);
}
if (la.kind == 14) {
@@ -1289,36 +1284,36 @@ out f);
}
void Type(
-#line 563 "cs.ATG"
+#line 558 "cs.ATG"
out TypeReference type) {
TypeWithRestriction(
-#line 565 "cs.ATG"
+#line 560 "cs.ATG"
out type, true, false);
}
void FormalParameterList(
-#line 635 "cs.ATG"
+#line 630 "cs.ATG"
List parameter) {
-#line 638 "cs.ATG"
+#line 633 "cs.ATG"
ParameterDeclarationExpression p;
AttributeSection section;
List attributes = new List();
while (la.kind == 18) {
AttributeSection(
-#line 643 "cs.ATG"
+#line 638 "cs.ATG"
out section);
-#line 643 "cs.ATG"
+#line 638 "cs.ATG"
attributes.Add(section);
}
if (StartOf(18)) {
FixedParameter(
-#line 645 "cs.ATG"
+#line 640 "cs.ATG"
out p);
-#line 645 "cs.ATG"
+#line 640 "cs.ATG"
bool paramsFound = false;
p.Attributes = attributes;
parameter.Add(p);
@@ -1326,97 +1321,97 @@ out p);
while (la.kind == 14) {
lexer.NextToken();
-#line 650 "cs.ATG"
+#line 645 "cs.ATG"
attributes = new List(); if (paramsFound) Error("params array must be at end of parameter list");
while (la.kind == 18) {
AttributeSection(
-#line 651 "cs.ATG"
+#line 646 "cs.ATG"
out section);
-#line 651 "cs.ATG"
+#line 646 "cs.ATG"
attributes.Add(section);
}
if (StartOf(18)) {
FixedParameter(
-#line 653 "cs.ATG"
+#line 648 "cs.ATG"
out p);
-#line 653 "cs.ATG"
+#line 648 "cs.ATG"
p.Attributes = attributes; parameter.Add(p);
} else if (la.kind == 95) {
ParameterArray(
-#line 654 "cs.ATG"
+#line 649 "cs.ATG"
out p);
-#line 654 "cs.ATG"
+#line 649 "cs.ATG"
paramsFound = true; p.Attributes = attributes; parameter.Add(p);
} else SynErr(157);
}
} else if (la.kind == 95) {
ParameterArray(
-#line 657 "cs.ATG"
+#line 652 "cs.ATG"
out p);
-#line 657 "cs.ATG"
+#line 652 "cs.ATG"
p.Attributes = attributes; parameter.Add(p);
} else SynErr(158);
}
void ClassType(
-#line 705 "cs.ATG"
+#line 700 "cs.ATG"
out TypeReference typeRef, bool canBeUnbound) {
-#line 706 "cs.ATG"
+#line 701 "cs.ATG"
TypeReference r; typeRef = null;
if (StartOf(19)) {
TypeName(
-#line 708 "cs.ATG"
+#line 703 "cs.ATG"
out r, canBeUnbound);
-#line 708 "cs.ATG"
+#line 703 "cs.ATG"
typeRef = r;
} else if (la.kind == 91) {
lexer.NextToken();
-#line 709 "cs.ATG"
+#line 704 "cs.ATG"
typeRef = new TypeReference("System.Object", true); typeRef.StartLocation = t.Location;
} else if (la.kind == 108) {
lexer.NextToken();
-#line 710 "cs.ATG"
+#line 705 "cs.ATG"
typeRef = new TypeReference("System.String", true); typeRef.StartLocation = t.Location;
} else SynErr(159);
}
void TypeName(
-#line 2290 "cs.ATG"
+#line 2285 "cs.ATG"
out TypeReference typeRef, bool canBeUnbound) {
-#line 2291 "cs.ATG"
+#line 2286 "cs.ATG"
List typeArguments = null;
string alias = null;
string qualident;
Location startLocation = la.Location;
if (
-#line 2297 "cs.ATG"
+#line 2292 "cs.ATG"
IdentAndDoubleColon()) {
Identifier();
-#line 2298 "cs.ATG"
+#line 2293 "cs.ATG"
alias = t.val;
Expect(10);
}
Qualident(
-#line 2301 "cs.ATG"
+#line 2296 "cs.ATG"
out qualident);
if (la.kind == 23) {
TypeArgumentList(
-#line 2302 "cs.ATG"
+#line 2297 "cs.ATG"
out typeArguments, canBeUnbound);
}
-#line 2304 "cs.ATG"
+#line 2299 "cs.ATG"
if (alias == null) {
typeRef = new TypeReference(qualident, typeArguments);
} else if (alias == "global") {
@@ -1427,143 +1422,143 @@ out typeArguments, canBeUnbound);
}
while (
-#line 2313 "cs.ATG"
+#line 2308 "cs.ATG"
DotAndIdent()) {
Expect(15);
-#line 2314 "cs.ATG"
+#line 2309 "cs.ATG"
typeArguments = null;
Qualident(
-#line 2315 "cs.ATG"
+#line 2310 "cs.ATG"
out qualident);
if (la.kind == 23) {
TypeArgumentList(
-#line 2316 "cs.ATG"
+#line 2311 "cs.ATG"
out typeArguments, canBeUnbound);
}
-#line 2317 "cs.ATG"
+#line 2312 "cs.ATG"
typeRef = new InnerClassTypeReference(typeRef, qualident, typeArguments);
}
-#line 2319 "cs.ATG"
+#line 2314 "cs.ATG"
typeRef.StartLocation = startLocation;
}
void MemberModifiers(
-#line 726 "cs.ATG"
+#line 721 "cs.ATG"
ModifierList m) {
while (StartOf(20)) {
switch (la.kind) {
case 49: {
lexer.NextToken();
-#line 729 "cs.ATG"
+#line 724 "cs.ATG"
m.Add(Modifiers.Abstract, t.Location);
break;
}
case 71: {
lexer.NextToken();
-#line 730 "cs.ATG"
+#line 725 "cs.ATG"
m.Add(Modifiers.Extern, t.Location);
break;
}
case 84: {
lexer.NextToken();
-#line 731 "cs.ATG"
+#line 726 "cs.ATG"
m.Add(Modifiers.Internal, t.Location);
break;
}
case 89: {
lexer.NextToken();
-#line 732 "cs.ATG"
+#line 727 "cs.ATG"
m.Add(Modifiers.New, t.Location);
break;
}
case 94: {
lexer.NextToken();
-#line 733 "cs.ATG"
+#line 728 "cs.ATG"
m.Add(Modifiers.Override, t.Location);
break;
}
case 96: {
lexer.NextToken();
-#line 734 "cs.ATG"
+#line 729 "cs.ATG"
m.Add(Modifiers.Private, t.Location);
break;
}
case 97: {
lexer.NextToken();
-#line 735 "cs.ATG"
+#line 730 "cs.ATG"
m.Add(Modifiers.Protected, t.Location);
break;
}
case 98: {
lexer.NextToken();
-#line 736 "cs.ATG"
+#line 731 "cs.ATG"
m.Add(Modifiers.Public, t.Location);
break;
}
case 99: {
lexer.NextToken();
-#line 737 "cs.ATG"
+#line 732 "cs.ATG"
m.Add(Modifiers.ReadOnly, t.Location);
break;
}
case 103: {
lexer.NextToken();
-#line 738 "cs.ATG"
+#line 733 "cs.ATG"
m.Add(Modifiers.Sealed, t.Location);
break;
}
case 107: {
lexer.NextToken();
-#line 739 "cs.ATG"
+#line 734 "cs.ATG"
m.Add(Modifiers.Static, t.Location);
break;
}
case 74: {
lexer.NextToken();
-#line 740 "cs.ATG"
+#line 735 "cs.ATG"
m.Add(Modifiers.Fixed, t.Location);
break;
}
case 119: {
lexer.NextToken();
-#line 741 "cs.ATG"
+#line 736 "cs.ATG"
m.Add(Modifiers.Unsafe, t.Location);
break;
}
case 122: {
lexer.NextToken();
-#line 742 "cs.ATG"
+#line 737 "cs.ATG"
m.Add(Modifiers.Virtual, t.Location);
break;
}
case 124: {
lexer.NextToken();
-#line 743 "cs.ATG"
+#line 738 "cs.ATG"
m.Add(Modifiers.Volatile, t.Location);
break;
}
case 126: {
lexer.NextToken();
-#line 744 "cs.ATG"
+#line 739 "cs.ATG"
m.Add(Modifiers.Partial, t.Location);
break;
}
@@ -1572,23 +1567,23 @@ ModifierList m) {
}
void ClassMemberDecl(
-#line 1060 "cs.ATG"
+#line 1055 "cs.ATG"
ModifierList m, List attributes) {
-#line 1061 "cs.ATG"
+#line 1056 "cs.ATG"
Statement stmt = null;
if (StartOf(21)) {
StructMemberDecl(
-#line 1063 "cs.ATG"
+#line 1058 "cs.ATG"
m, attributes);
} else if (la.kind == 27) {
-#line 1064 "cs.ATG"
+#line 1059 "cs.ATG"
m.Check(Modifiers.Destructors); Location startPos = la.Location;
lexer.NextToken();
Identifier();
-#line 1065 "cs.ATG"
+#line 1060 "cs.ATG"
DestructorDeclaration d = new DestructorDeclaration(t.val, m.Modifier, attributes);
d.Modifier = m.Modifier;
d.StartLocation = m.GetDeclarationLocation(startPos);
@@ -1596,17 +1591,17 @@ m, attributes);
Expect(20);
Expect(21);
-#line 1069 "cs.ATG"
+#line 1064 "cs.ATG"
d.EndLocation = t.EndLocation;
if (la.kind == 16) {
Block(
-#line 1069 "cs.ATG"
+#line 1064 "cs.ATG"
out stmt);
} else if (la.kind == 11) {
lexer.NextToken();
} else SynErr(160);
-#line 1070 "cs.ATG"
+#line 1065 "cs.ATG"
d.Body = (BlockStatement)stmt;
compilationUnit.AddChild(d);
@@ -1614,10 +1609,10 @@ out stmt);
}
void StructMemberDecl(
-#line 748 "cs.ATG"
+#line 743 "cs.ATG"
ModifierList m, List attributes) {
-#line 750 "cs.ATG"
+#line 745 "cs.ATG"
string qualident = null;
TypeReference type;
Expression expr;
@@ -1629,18 +1624,18 @@ ModifierList m, List attributes) {
if (la.kind == 60) {
-#line 760 "cs.ATG"
+#line 755 "cs.ATG"
m.Check(Modifiers.Constants);
lexer.NextToken();
-#line 761 "cs.ATG"
+#line 756 "cs.ATG"
Location startPos = t.Location;
Type(
-#line 762 "cs.ATG"
+#line 757 "cs.ATG"
out type);
Identifier();
-#line 762 "cs.ATG"
+#line 757 "cs.ATG"
FieldDeclaration fd = new FieldDeclaration(attributes, type, m.Modifier | Modifiers.Const);
fd.StartLocation = m.GetDeclarationLocation(startPos);
VariableDeclaration f = new VariableDeclaration(t.val);
@@ -1650,16 +1645,16 @@ out type);
Expect(3);
Expr(
-#line 769 "cs.ATG"
+#line 764 "cs.ATG"
out expr);
-#line 769 "cs.ATG"
+#line 764 "cs.ATG"
f.Initializer = expr;
while (la.kind == 14) {
lexer.NextToken();
Identifier();
-#line 770 "cs.ATG"
+#line 765 "cs.ATG"
f = new VariableDeclaration(t.val);
f.StartLocation = t.Location;
f.TypeReference = type;
@@ -1667,63 +1662,63 @@ out expr);
Expect(3);
Expr(
-#line 775 "cs.ATG"
+#line 770 "cs.ATG"
out expr);
-#line 775 "cs.ATG"
+#line 770 "cs.ATG"
f.EndLocation = t.EndLocation; f.Initializer = expr;
}
Expect(11);
-#line 776 "cs.ATG"
+#line 771 "cs.ATG"
fd.EndLocation = t.EndLocation; compilationUnit.AddChild(fd);
} else if (
-#line 780 "cs.ATG"
+#line 775 "cs.ATG"
NotVoidPointer()) {
-#line 780 "cs.ATG"
+#line 775 "cs.ATG"
m.Check(Modifiers.PropertysEventsMethods);
Expect(123);
-#line 781 "cs.ATG"
+#line 776 "cs.ATG"
Location startPos = t.Location;
if (
-#line 782 "cs.ATG"
+#line 777 "cs.ATG"
IsExplicitInterfaceImplementation()) {
TypeName(
-#line 783 "cs.ATG"
+#line 778 "cs.ATG"
out explicitInterface, false);
-#line 784 "cs.ATG"
+#line 779 "cs.ATG"
if (la.kind != Tokens.Dot || Peek(1).kind != Tokens.This) {
qualident = TypeReference.StripLastIdentifierFromType(ref explicitInterface);
}
} else if (StartOf(19)) {
Identifier();
-#line 787 "cs.ATG"
+#line 782 "cs.ATG"
qualident = t.val;
} else SynErr(162);
if (la.kind == 23) {
TypeParameterList(
-#line 790 "cs.ATG"
+#line 785 "cs.ATG"
templates);
}
Expect(20);
if (la.kind == 111) {
lexer.NextToken();
-#line 793 "cs.ATG"
+#line 788 "cs.ATG"
isExtensionMethod = true; /* C# 3.0 */
}
if (StartOf(11)) {
FormalParameterList(
-#line 794 "cs.ATG"
+#line 789 "cs.ATG"
p);
}
Expect(21);
-#line 795 "cs.ATG"
+#line 790 "cs.ATG"
MethodDeclaration methodDeclaration = new MethodDeclaration {
Name = qualident,
Modifier = m.Modifier,
@@ -1742,28 +1737,28 @@ p);
while (la.kind == 127) {
TypeParameterConstraintsClause(
-#line 813 "cs.ATG"
+#line 808 "cs.ATG"
templates);
}
if (la.kind == 16) {
Block(
-#line 815 "cs.ATG"
+#line 810 "cs.ATG"
out stmt);
} else if (la.kind == 11) {
lexer.NextToken();
} else SynErr(163);
-#line 815 "cs.ATG"
+#line 810 "cs.ATG"
compilationUnit.BlockEnd();
methodDeclaration.Body = (BlockStatement)stmt;
} else if (la.kind == 69) {
-#line 819 "cs.ATG"
+#line 814 "cs.ATG"
m.Check(Modifiers.PropertysEventsMethods);
lexer.NextToken();
-#line 821 "cs.ATG"
+#line 816 "cs.ATG"
EventDeclaration eventDecl = new EventDeclaration {
Modifier = m.Modifier,
Attributes = attributes,
@@ -1775,113 +1770,113 @@ out stmt);
EventRemoveRegion removeBlock = null;
Type(
-#line 831 "cs.ATG"
+#line 826 "cs.ATG"
out type);
-#line 831 "cs.ATG"
+#line 826 "cs.ATG"
eventDecl.TypeReference = type;
if (
-#line 832 "cs.ATG"
+#line 827 "cs.ATG"
IsExplicitInterfaceImplementation()) {
TypeName(
-#line 833 "cs.ATG"
+#line 828 "cs.ATG"
out explicitInterface, false);
-#line 834 "cs.ATG"
+#line 829 "cs.ATG"
qualident = TypeReference.StripLastIdentifierFromType(ref explicitInterface);
-#line 835 "cs.ATG"
+#line 830 "cs.ATG"
eventDecl.InterfaceImplementations.Add(new InterfaceImplementation(explicitInterface, qualident));
} else if (StartOf(19)) {
Identifier();
-#line 837 "cs.ATG"
+#line 832 "cs.ATG"
qualident = t.val;
} else SynErr(164);
-#line 839 "cs.ATG"
+#line 834 "cs.ATG"
eventDecl.Name = qualident; eventDecl.EndLocation = t.EndLocation;
if (la.kind == 3) {
lexer.NextToken();
Expr(
-#line 840 "cs.ATG"
+#line 835 "cs.ATG"
out expr);
-#line 840 "cs.ATG"
+#line 835 "cs.ATG"
eventDecl.Initializer = expr;
}
if (la.kind == 16) {
lexer.NextToken();
-#line 841 "cs.ATG"
+#line 836 "cs.ATG"
eventDecl.BodyStart = t.Location;
EventAccessorDecls(
-#line 842 "cs.ATG"
+#line 837 "cs.ATG"
out addBlock, out removeBlock);
Expect(17);
-#line 843 "cs.ATG"
+#line 838 "cs.ATG"
eventDecl.BodyEnd = t.EndLocation;
}
if (la.kind == 11) {
lexer.NextToken();
}
-#line 846 "cs.ATG"
+#line 841 "cs.ATG"
compilationUnit.BlockEnd();
eventDecl.AddRegion = addBlock;
eventDecl.RemoveRegion = removeBlock;
} else if (
-#line 852 "cs.ATG"
+#line 847 "cs.ATG"
IdentAndLPar()) {
-#line 852 "cs.ATG"
+#line 847 "cs.ATG"
m.Check(Modifiers.Constructors | Modifiers.StaticConstructors);
Identifier();
-#line 853 "cs.ATG"
+#line 848 "cs.ATG"
string name = t.val; Location startPos = t.Location;
Expect(20);
if (StartOf(11)) {
-#line 853 "cs.ATG"
+#line 848 "cs.ATG"
m.Check(Modifiers.Constructors);
FormalParameterList(
-#line 854 "cs.ATG"
+#line 849 "cs.ATG"
p);
}
Expect(21);
-#line 856 "cs.ATG"
+#line 851 "cs.ATG"
ConstructorInitializer init = null;
if (la.kind == 9) {
-#line 857 "cs.ATG"
+#line 852 "cs.ATG"
m.Check(Modifiers.Constructors);
ConstructorInitializer(
-#line 858 "cs.ATG"
+#line 853 "cs.ATG"
out init);
}
-#line 860 "cs.ATG"
+#line 855 "cs.ATG"
ConstructorDeclaration cd = new ConstructorDeclaration(name, m.Modifier, p, init, attributes);
cd.StartLocation = startPos;
cd.EndLocation = t.EndLocation;
if (la.kind == 16) {
Block(
-#line 865 "cs.ATG"
+#line 860 "cs.ATG"
out stmt);
} else if (la.kind == 11) {
lexer.NextToken();
} else SynErr(165);
-#line 865 "cs.ATG"
+#line 860 "cs.ATG"
cd.Body = (BlockStatement)stmt; compilationUnit.AddChild(cd);
} else if (la.kind == 70 || la.kind == 80) {
-#line 868 "cs.ATG"
+#line 863 "cs.ATG"
m.Check(Modifiers.Operators);
if (m.isNone) Error("at least one modifier must be set");
bool isImplicit = true;
@@ -1890,45 +1885,45 @@ out stmt);
if (la.kind == 80) {
lexer.NextToken();
-#line 873 "cs.ATG"
+#line 868 "cs.ATG"
startPos = t.Location;
} else {
lexer.NextToken();
-#line 873 "cs.ATG"
+#line 868 "cs.ATG"
isImplicit = false; startPos = t.Location;
}
Expect(92);
Type(
-#line 874 "cs.ATG"
+#line 869 "cs.ATG"
out type);
-#line 874 "cs.ATG"
+#line 869 "cs.ATG"
TypeReference operatorType = type;
Expect(20);
Type(
-#line 875 "cs.ATG"
+#line 870 "cs.ATG"
out type);
Identifier();
-#line 875 "cs.ATG"
+#line 870 "cs.ATG"
string varName = t.val;
Expect(21);
-#line 876 "cs.ATG"
+#line 871 "cs.ATG"
Location endPos = t.Location;
if (la.kind == 16) {
Block(
-#line 877 "cs.ATG"
+#line 872 "cs.ATG"
out stmt);
} else if (la.kind == 11) {
lexer.NextToken();
-#line 877 "cs.ATG"
+#line 872 "cs.ATG"
stmt = null;
} else SynErr(166);
-#line 880 "cs.ATG"
+#line 875 "cs.ATG"
List parameters = new List();
parameters.Add(new ParameterDeclarationExpression(type, varName));
OperatorDeclaration operatorDeclaration = new OperatorDeclaration {
@@ -1946,61 +1941,61 @@ out stmt);
} else if (StartOf(22)) {
TypeDecl(
-#line 898 "cs.ATG"
+#line 893 "cs.ATG"
m, attributes);
} else if (StartOf(10)) {
Type(
-#line 900 "cs.ATG"
+#line 895 "cs.ATG"
out type);
-#line 900 "cs.ATG"
+#line 895 "cs.ATG"
Location startPos = t.Location;
if (la.kind == 92) {
-#line 902 "cs.ATG"
+#line 897 "cs.ATG"
OverloadableOperatorType op;
m.Check(Modifiers.Operators);
if (m.isNone) Error("at least one modifier must be set");
lexer.NextToken();
OverloadableOperator(
-#line 906 "cs.ATG"
+#line 901 "cs.ATG"
out op);
-#line 906 "cs.ATG"
+#line 901 "cs.ATG"
TypeReference firstType, secondType = null; string secondName = null;
Expect(20);
Type(
-#line 907 "cs.ATG"
+#line 902 "cs.ATG"
out firstType);
Identifier();
-#line 907 "cs.ATG"
+#line 902 "cs.ATG"
string firstName = t.val;
if (la.kind == 14) {
lexer.NextToken();
Type(
-#line 908 "cs.ATG"
+#line 903 "cs.ATG"
out secondType);
Identifier();
-#line 908 "cs.ATG"
+#line 903 "cs.ATG"
secondName = t.val;
} else if (la.kind == 21) {
} else SynErr(167);
-#line 916 "cs.ATG"
+#line 911 "cs.ATG"
Location endPos = t.Location;
Expect(21);
if (la.kind == 16) {
Block(
-#line 917 "cs.ATG"
+#line 912 "cs.ATG"
out stmt);
} else if (la.kind == 11) {
lexer.NextToken();
} else SynErr(168);
-#line 919 "cs.ATG"
+#line 914 "cs.ATG"
if (op == OverloadableOperatorType.Add && secondType == null)
op = OverloadableOperatorType.UnaryPlus;
if (op == OverloadableOperatorType.Subtract && secondType == null)
@@ -2022,75 +2017,75 @@ out stmt);
compilationUnit.AddChild(operatorDeclaration);
} else if (
-#line 941 "cs.ATG"
+#line 936 "cs.ATG"
IsVarDecl()) {
-#line 942 "cs.ATG"
+#line 937 "cs.ATG"
m.Check(Modifiers.Fields);
FieldDeclaration fd = new FieldDeclaration(attributes, type, m.Modifier);
fd.StartLocation = m.GetDeclarationLocation(startPos);
if (
-#line 946 "cs.ATG"
+#line 941 "cs.ATG"
m.Contains(Modifiers.Fixed)) {
VariableDeclarator(
-#line 947 "cs.ATG"
+#line 942 "cs.ATG"
fd);
Expect(18);
Expr(
-#line 949 "cs.ATG"
+#line 944 "cs.ATG"
out expr);
-#line 949 "cs.ATG"
+#line 944 "cs.ATG"
if (fd.Fields.Count > 0)
fd.Fields[fd.Fields.Count-1].FixedArrayInitialization = expr;
Expect(19);
while (la.kind == 14) {
lexer.NextToken();
VariableDeclarator(
-#line 953 "cs.ATG"
+#line 948 "cs.ATG"
fd);
Expect(18);
Expr(
-#line 955 "cs.ATG"
+#line 950 "cs.ATG"
out expr);
-#line 955 "cs.ATG"
+#line 950 "cs.ATG"
if (fd.Fields.Count > 0)
fd.Fields[fd.Fields.Count-1].FixedArrayInitialization = expr;
Expect(19);
}
} else if (StartOf(19)) {
VariableDeclarator(
-#line 960 "cs.ATG"
+#line 955 "cs.ATG"
fd);
while (la.kind == 14) {
lexer.NextToken();
VariableDeclarator(
-#line 961 "cs.ATG"
+#line 956 "cs.ATG"
fd);
}
} else SynErr(169);
Expect(11);
-#line 963 "cs.ATG"
+#line 958 "cs.ATG"
fd.EndLocation = t.EndLocation; compilationUnit.AddChild(fd);
} else if (la.kind == 111) {
-#line 966 "cs.ATG"
+#line 961 "cs.ATG"
m.Check(Modifiers.Indexers);
lexer.NextToken();
Expect(18);
FormalParameterList(
-#line 967 "cs.ATG"
+#line 962 "cs.ATG"
p);
Expect(19);
-#line 967 "cs.ATG"
+#line 962 "cs.ATG"
Location endLocation = t.EndLocation;
Expect(16);
-#line 968 "cs.ATG"
+#line 963 "cs.ATG"
IndexerDeclaration indexer = new IndexerDeclaration(type, p, m.Modifier, attributes);
indexer.StartLocation = startPos;
indexer.EndLocation = endLocation;
@@ -2099,64 +2094,64 @@ p);
PropertySetRegion setRegion;
AccessorDecls(
-#line 975 "cs.ATG"
+#line 970 "cs.ATG"
out getRegion, out setRegion);
Expect(17);
-#line 976 "cs.ATG"
+#line 971 "cs.ATG"
indexer.BodyEnd = t.EndLocation;
indexer.GetRegion = getRegion;
indexer.SetRegion = setRegion;
compilationUnit.AddChild(indexer);
} else if (
-#line 981 "cs.ATG"
+#line 976 "cs.ATG"
IsIdentifierToken(la)) {
if (
-#line 982 "cs.ATG"
+#line 977 "cs.ATG"
IsExplicitInterfaceImplementation()) {
TypeName(
-#line 983 "cs.ATG"
+#line 978 "cs.ATG"
out explicitInterface, false);
-#line 984 "cs.ATG"
+#line 979 "cs.ATG"
if (la.kind != Tokens.Dot || Peek(1).kind != Tokens.This) {
qualident = TypeReference.StripLastIdentifierFromType(ref explicitInterface);
}
} else if (StartOf(19)) {
Identifier();
-#line 987 "cs.ATG"
+#line 982 "cs.ATG"
qualident = t.val;
} else SynErr(170);
-#line 989 "cs.ATG"
+#line 984 "cs.ATG"
Location qualIdentEndLocation = t.EndLocation;
if (la.kind == 16 || la.kind == 20 || la.kind == 23) {
if (la.kind == 20 || la.kind == 23) {
-#line 993 "cs.ATG"
+#line 988 "cs.ATG"
m.Check(Modifiers.PropertysEventsMethods);
if (la.kind == 23) {
TypeParameterList(
-#line 995 "cs.ATG"
+#line 990 "cs.ATG"
templates);
}
Expect(20);
if (la.kind == 111) {
lexer.NextToken();
-#line 997 "cs.ATG"
+#line 992 "cs.ATG"
isExtensionMethod = true;
}
if (StartOf(11)) {
FormalParameterList(
-#line 998 "cs.ATG"
+#line 993 "cs.ATG"
p);
}
Expect(21);
-#line 1000 "cs.ATG"
+#line 995 "cs.ATG"
MethodDeclaration methodDeclaration = new MethodDeclaration {
Name = qualident,
Modifier = m.Modifier,
@@ -2174,23 +2169,23 @@ p);
while (la.kind == 127) {
TypeParameterConstraintsClause(
-#line 1015 "cs.ATG"
+#line 1010 "cs.ATG"
templates);
}
if (la.kind == 16) {
Block(
-#line 1016 "cs.ATG"
+#line 1011 "cs.ATG"
out stmt);
} else if (la.kind == 11) {
lexer.NextToken();
} else SynErr(171);
-#line 1016 "cs.ATG"
+#line 1011 "cs.ATG"
methodDeclaration.Body = (BlockStatement)stmt;
} else {
lexer.NextToken();
-#line 1019 "cs.ATG"
+#line 1014 "cs.ATG"
PropertyDeclaration pDecl = new PropertyDeclaration(qualident, type, m.Modifier, attributes);
if (explicitInterface != null)
pDecl.InterfaceImplementations.Add(new InterfaceImplementation(explicitInterface, qualident));
@@ -2201,11 +2196,11 @@ out stmt);
PropertySetRegion setRegion;
AccessorDecls(
-#line 1028 "cs.ATG"
+#line 1023 "cs.ATG"
out getRegion, out setRegion);
Expect(17);
-#line 1030 "cs.ATG"
+#line 1025 "cs.ATG"
pDecl.GetRegion = getRegion;
pDecl.SetRegion = setRegion;
pDecl.BodyEnd = t.EndLocation;
@@ -2214,17 +2209,17 @@ out getRegion, out setRegion);
}
} else if (la.kind == 15) {
-#line 1038 "cs.ATG"
+#line 1033 "cs.ATG"
m.Check(Modifiers.Indexers);
lexer.NextToken();
Expect(111);
Expect(18);
FormalParameterList(
-#line 1039 "cs.ATG"
+#line 1034 "cs.ATG"
p);
Expect(19);
-#line 1040 "cs.ATG"
+#line 1035 "cs.ATG"
IndexerDeclaration indexer = new IndexerDeclaration(type, p, m.Modifier, attributes);
indexer.StartLocation = m.GetDeclarationLocation(startPos);
indexer.EndLocation = t.EndLocation;
@@ -2235,14 +2230,14 @@ p);
Expect(16);
-#line 1048 "cs.ATG"
+#line 1043 "cs.ATG"
Location bodyStart = t.Location;
AccessorDecls(
-#line 1049 "cs.ATG"
+#line 1044 "cs.ATG"
out getRegion, out setRegion);
Expect(17);
-#line 1050 "cs.ATG"
+#line 1045 "cs.ATG"
indexer.BodyStart = bodyStart;
indexer.BodyEnd = t.EndLocation;
indexer.GetRegion = getRegion;
@@ -2256,7 +2251,7 @@ out getRegion, out setRegion);
void InterfaceMemberDecl() {
-#line 1077 "cs.ATG"
+#line 1072 "cs.ATG"
TypeReference type;
AttributeSection section;
@@ -2271,49 +2266,49 @@ out getRegion, out setRegion);
while (la.kind == 18) {
AttributeSection(
-#line 1090 "cs.ATG"
+#line 1085 "cs.ATG"
out section);
-#line 1090 "cs.ATG"
+#line 1085 "cs.ATG"
attributes.Add(section);
}
if (la.kind == 89) {
lexer.NextToken();
-#line 1091 "cs.ATG"
+#line 1086 "cs.ATG"
mod = Modifiers.New; startLocation = t.Location;
}
if (
-#line 1094 "cs.ATG"
+#line 1089 "cs.ATG"
NotVoidPointer()) {
Expect(123);
-#line 1094 "cs.ATG"
+#line 1089 "cs.ATG"
if (startLocation.IsEmpty) startLocation = t.Location;
Identifier();
-#line 1095 "cs.ATG"
+#line 1090 "cs.ATG"
name = t.val;
if (la.kind == 23) {
TypeParameterList(
-#line 1096 "cs.ATG"
+#line 1091 "cs.ATG"
templates);
}
Expect(20);
if (StartOf(11)) {
FormalParameterList(
-#line 1097 "cs.ATG"
+#line 1092 "cs.ATG"
parameters);
}
Expect(21);
while (la.kind == 127) {
TypeParameterConstraintsClause(
-#line 1098 "cs.ATG"
+#line 1093 "cs.ATG"
templates);
}
Expect(11);
-#line 1100 "cs.ATG"
+#line 1095 "cs.ATG"
MethodDeclaration md = new MethodDeclaration {
Name = name, Modifier = mod, TypeReference = new TypeReference("System.Void", true),
Parameters = parameters, Attributes = attributes, Templates = templates,
@@ -2324,37 +2319,37 @@ templates);
} else if (StartOf(23)) {
if (StartOf(10)) {
Type(
-#line 1108 "cs.ATG"
+#line 1103 "cs.ATG"
out type);
-#line 1108 "cs.ATG"
+#line 1103 "cs.ATG"
if (startLocation.IsEmpty) startLocation = t.Location;
if (StartOf(19)) {
Identifier();
-#line 1110 "cs.ATG"
+#line 1105 "cs.ATG"
name = t.val; Location qualIdentEndLocation = t.EndLocation;
if (la.kind == 20 || la.kind == 23) {
if (la.kind == 23) {
TypeParameterList(
-#line 1114 "cs.ATG"
+#line 1109 "cs.ATG"
templates);
}
Expect(20);
if (StartOf(11)) {
FormalParameterList(
-#line 1115 "cs.ATG"
+#line 1110 "cs.ATG"
parameters);
}
Expect(21);
while (la.kind == 127) {
TypeParameterConstraintsClause(
-#line 1117 "cs.ATG"
+#line 1112 "cs.ATG"
templates);
}
Expect(11);
-#line 1118 "cs.ATG"
+#line 1113 "cs.ATG"
MethodDeclaration md = new MethodDeclaration {
Name = name, Modifier = mod, TypeReference = type,
Parameters = parameters, Attributes = attributes, Templates = templates,
@@ -2364,58 +2359,58 @@ templates);
} else if (la.kind == 16) {
-#line 1127 "cs.ATG"
+#line 1122 "cs.ATG"
PropertyDeclaration pd = new PropertyDeclaration(name, type, mod, attributes);
compilationUnit.AddChild(pd);
lexer.NextToken();
-#line 1130 "cs.ATG"
+#line 1125 "cs.ATG"
Location bodyStart = t.Location;
InterfaceAccessors(
-#line 1131 "cs.ATG"
+#line 1126 "cs.ATG"
out getBlock, out setBlock);
Expect(17);
-#line 1132 "cs.ATG"
+#line 1127 "cs.ATG"
pd.GetRegion = getBlock; pd.SetRegion = setBlock; pd.StartLocation = startLocation; pd.EndLocation = qualIdentEndLocation; pd.BodyStart = bodyStart; pd.BodyEnd = t.EndLocation;
} else SynErr(175);
} else if (la.kind == 111) {
lexer.NextToken();
Expect(18);
FormalParameterList(
-#line 1135 "cs.ATG"
+#line 1130 "cs.ATG"
parameters);
Expect(19);
-#line 1136 "cs.ATG"
+#line 1131 "cs.ATG"
Location bracketEndLocation = t.EndLocation;
-#line 1137 "cs.ATG"
+#line 1132 "cs.ATG"
IndexerDeclaration id = new IndexerDeclaration(type, parameters, mod, attributes);
compilationUnit.AddChild(id);
Expect(16);
-#line 1139 "cs.ATG"
+#line 1134 "cs.ATG"
Location bodyStart = t.Location;
InterfaceAccessors(
-#line 1140 "cs.ATG"
+#line 1135 "cs.ATG"
out getBlock, out setBlock);
Expect(17);
-#line 1142 "cs.ATG"
+#line 1137 "cs.ATG"
id.GetRegion = getBlock; id.SetRegion = setBlock; id.StartLocation = startLocation; id.EndLocation = bracketEndLocation; id.BodyStart = bodyStart; id.BodyEnd = t.EndLocation;
} else SynErr(176);
} else {
lexer.NextToken();
-#line 1145 "cs.ATG"
+#line 1140 "cs.ATG"
if (startLocation.IsEmpty) startLocation = t.Location;
Type(
-#line 1146 "cs.ATG"
+#line 1141 "cs.ATG"
out type);
Identifier();
-#line 1147 "cs.ATG"
+#line 1142 "cs.ATG"
EventDeclaration ed = new EventDeclaration {
TypeReference = type, Name = t.val, Modifier = mod, Attributes = attributes
};
@@ -2423,17 +2418,17 @@ out type);
Expect(11);
-#line 1153 "cs.ATG"
+#line 1148 "cs.ATG"
ed.StartLocation = startLocation; ed.EndLocation = t.EndLocation;
}
} else SynErr(177);
}
void EnumMemberDecl(
-#line 1158 "cs.ATG"
+#line 1153 "cs.ATG"
out FieldDeclaration f) {
-#line 1160 "cs.ATG"
+#line 1155 "cs.ATG"
Expression expr = null;
List attributes = new List();
AttributeSection section = null;
@@ -2441,15 +2436,15 @@ out FieldDeclaration f) {
while (la.kind == 18) {
AttributeSection(
-#line 1166 "cs.ATG"
+#line 1161 "cs.ATG"
out section);
-#line 1166 "cs.ATG"
+#line 1161 "cs.ATG"
attributes.Add(section);
}
Identifier();
-#line 1167 "cs.ATG"
+#line 1162 "cs.ATG"
f = new FieldDeclaration(attributes);
varDecl = new VariableDeclaration(t.val);
f.Fields.Add(varDecl);
@@ -2459,19 +2454,19 @@ out section);
if (la.kind == 3) {
lexer.NextToken();
Expr(
-#line 1173 "cs.ATG"
+#line 1168 "cs.ATG"
out expr);
-#line 1173 "cs.ATG"
+#line 1168 "cs.ATG"
varDecl.Initializer = expr;
}
}
void TypeWithRestriction(
-#line 568 "cs.ATG"
+#line 563 "cs.ATG"
out TypeReference type, bool allowNullable, bool canBeUnbound) {
-#line 570 "cs.ATG"
+#line 565 "cs.ATG"
Location startPos = la.Location;
string name;
int pointer = 0;
@@ -2479,59 +2474,59 @@ out TypeReference type, bool allowNullable, bool canBeUnbound) {
if (StartOf(4)) {
ClassType(
-#line 576 "cs.ATG"
+#line 571 "cs.ATG"
out type, canBeUnbound);
} else if (StartOf(5)) {
SimpleType(
-#line 577 "cs.ATG"
+#line 572 "cs.ATG"
out name);
-#line 577 "cs.ATG"
+#line 572 "cs.ATG"
type = new TypeReference(name, true);
} else if (la.kind == 123) {
lexer.NextToken();
Expect(6);
-#line 578 "cs.ATG"
+#line 573 "cs.ATG"
pointer = 1; type = new TypeReference("System.Void", true);
} else SynErr(178);
-#line 579 "cs.ATG"
+#line 574 "cs.ATG"
List r = new List();
if (
-#line 581 "cs.ATG"
+#line 576 "cs.ATG"
allowNullable && la.kind == Tokens.Question) {
NullableQuestionMark(
-#line 581 "cs.ATG"
+#line 576 "cs.ATG"
ref type);
}
while (
-#line 583 "cs.ATG"
+#line 578 "cs.ATG"
IsPointerOrDims()) {
-#line 583 "cs.ATG"
+#line 578 "cs.ATG"
int i = 0;
if (la.kind == 6) {
lexer.NextToken();
-#line 584 "cs.ATG"
+#line 579 "cs.ATG"
++pointer;
} else if (la.kind == 18) {
lexer.NextToken();
while (la.kind == 14) {
lexer.NextToken();
-#line 585 "cs.ATG"
+#line 580 "cs.ATG"
++i;
}
Expect(19);
-#line 585 "cs.ATG"
+#line 580 "cs.ATG"
r.Add(i);
} else SynErr(179);
}
-#line 588 "cs.ATG"
+#line 583 "cs.ATG"
if (type != null) {
type.RankSpecifier = r.ToArray();
type.PointerNestingLevel = pointer;
@@ -2542,57 +2537,57 @@ IsPointerOrDims()) {
}
void SimpleType(
-#line 624 "cs.ATG"
+#line 619 "cs.ATG"
out string name) {
-#line 625 "cs.ATG"
+#line 620 "cs.ATG"
name = String.Empty;
if (StartOf(24)) {
IntegralType(
-#line 627 "cs.ATG"
+#line 622 "cs.ATG"
out name);
} else if (la.kind == 75) {
lexer.NextToken();
-#line 628 "cs.ATG"
+#line 623 "cs.ATG"
name = "System.Single";
} else if (la.kind == 66) {
lexer.NextToken();
-#line 629 "cs.ATG"
+#line 624 "cs.ATG"
name = "System.Double";
} else if (la.kind == 62) {
lexer.NextToken();
-#line 630 "cs.ATG"
+#line 625 "cs.ATG"
name = "System.Decimal";
} else if (la.kind == 52) {
lexer.NextToken();
-#line 631 "cs.ATG"
+#line 626 "cs.ATG"
name = "System.Boolean";
} else SynErr(180);
}
void NullableQuestionMark(
-#line 2323 "cs.ATG"
+#line 2318 "cs.ATG"
ref TypeReference typeRef) {
-#line 2324 "cs.ATG"
+#line 2319 "cs.ATG"
List typeArguments = new List(1);
Expect(12);
-#line 2328 "cs.ATG"
+#line 2323 "cs.ATG"
if (typeRef != null) typeArguments.Add(typeRef);
typeRef = new TypeReference("System.Nullable", typeArguments) { IsKeyword = true };
}
void FixedParameter(
-#line 661 "cs.ATG"
+#line 656 "cs.ATG"
out ParameterDeclarationExpression p) {
-#line 663 "cs.ATG"
+#line 658 "cs.ATG"
TypeReference type;
ParameterModifiers mod = ParameterModifiers.In;
Location start = la.Location;
@@ -2601,82 +2596,82 @@ out ParameterDeclarationExpression p) {
if (la.kind == 100) {
lexer.NextToken();
-#line 669 "cs.ATG"
+#line 664 "cs.ATG"
mod = ParameterModifiers.Ref;
} else {
lexer.NextToken();
-#line 670 "cs.ATG"
+#line 665 "cs.ATG"
mod = ParameterModifiers.Out;
}
}
Type(
-#line 672 "cs.ATG"
+#line 667 "cs.ATG"
out type);
Identifier();
-#line 672 "cs.ATG"
+#line 667 "cs.ATG"
p = new ParameterDeclarationExpression(type, t.val, mod); p.StartLocation = start; p.EndLocation = t.Location;
}
void ParameterArray(
-#line 675 "cs.ATG"
+#line 670 "cs.ATG"
out ParameterDeclarationExpression p) {
-#line 676 "cs.ATG"
+#line 671 "cs.ATG"
TypeReference type;
Expect(95);
Type(
-#line 678 "cs.ATG"
+#line 673 "cs.ATG"
out type);
Identifier();
-#line 678 "cs.ATG"
+#line 673 "cs.ATG"
p = new ParameterDeclarationExpression(type, t.val, ParameterModifiers.Params);
}
void AccessorModifiers(
-#line 681 "cs.ATG"
+#line 676 "cs.ATG"
out ModifierList m) {
-#line 682 "cs.ATG"
+#line 677 "cs.ATG"
m = new ModifierList();
if (la.kind == 96) {
lexer.NextToken();
-#line 684 "cs.ATG"
+#line 679 "cs.ATG"
m.Add(Modifiers.Private, t.Location);
} else if (la.kind == 97) {
lexer.NextToken();
-#line 685 "cs.ATG"
+#line 680 "cs.ATG"
m.Add(Modifiers.Protected, t.Location);
if (la.kind == 84) {
lexer.NextToken();
-#line 686 "cs.ATG"
+#line 681 "cs.ATG"
m.Add(Modifiers.Internal, t.Location);
}
} else if (la.kind == 84) {
lexer.NextToken();
-#line 687 "cs.ATG"
+#line 682 "cs.ATG"
m.Add(Modifiers.Internal, t.Location);
if (la.kind == 97) {
lexer.NextToken();
-#line 688 "cs.ATG"
+#line 683 "cs.ATG"
m.Add(Modifiers.Protected, t.Location);
}
} else SynErr(181);
}
void Block(
-#line 1293 "cs.ATG"
+#line 1288 "cs.ATG"
out Statement stmt) {
Expect(16);
-#line 1295 "cs.ATG"
+#line 1290 "cs.ATG"
BlockStatement blockStmt = new BlockStatement();
blockStmt.StartLocation = t.Location;
compilationUnit.BlockStart(blockStmt);
@@ -2688,7 +2683,7 @@ out Statement stmt) {
while (!(la.kind == 0 || la.kind == 17)) {SynErr(182); lexer.NextToken(); }
Expect(17);
-#line 1303 "cs.ATG"
+#line 1298 "cs.ATG"
stmt = blockStmt;
blockStmt.EndLocation = t.EndLocation;
compilationUnit.BlockEnd();
@@ -2696,10 +2691,10 @@ out Statement stmt) {
}
void EventAccessorDecls(
-#line 1230 "cs.ATG"
+#line 1225 "cs.ATG"
out EventAddRegion addBlock, out EventRemoveRegion removeBlock) {
-#line 1231 "cs.ATG"
+#line 1226 "cs.ATG"
AttributeSection section;
List attributes = new List();
Statement stmt;
@@ -2708,93 +2703,93 @@ out EventAddRegion addBlock, out EventRemoveRegion removeBlock) {
while (la.kind == 18) {
AttributeSection(
-#line 1238 "cs.ATG"
+#line 1233 "cs.ATG"
out section);
-#line 1238 "cs.ATG"
+#line 1233 "cs.ATG"
attributes.Add(section);
}
if (la.kind == 130) {
-#line 1240 "cs.ATG"
+#line 1235 "cs.ATG"
addBlock = new EventAddRegion(attributes);
AddAccessorDecl(
-#line 1241 "cs.ATG"
+#line 1236 "cs.ATG"
out stmt);
-#line 1241 "cs.ATG"
+#line 1236 "cs.ATG"
attributes = new List(); addBlock.Block = (BlockStatement)stmt;
while (la.kind == 18) {
AttributeSection(
-#line 1242 "cs.ATG"
+#line 1237 "cs.ATG"
out section);
-#line 1242 "cs.ATG"
+#line 1237 "cs.ATG"
attributes.Add(section);
}
RemoveAccessorDecl(
-#line 1243 "cs.ATG"
+#line 1238 "cs.ATG"
out stmt);
-#line 1243 "cs.ATG"
+#line 1238 "cs.ATG"
removeBlock = new EventRemoveRegion(attributes); removeBlock.Block = (BlockStatement)stmt;
} else if (la.kind == 131) {
RemoveAccessorDecl(
-#line 1245 "cs.ATG"
+#line 1240 "cs.ATG"
out stmt);
-#line 1245 "cs.ATG"
+#line 1240 "cs.ATG"
removeBlock = new EventRemoveRegion(attributes); removeBlock.Block = (BlockStatement)stmt; attributes = new List();
while (la.kind == 18) {
AttributeSection(
-#line 1246 "cs.ATG"
+#line 1241 "cs.ATG"
out section);
-#line 1246 "cs.ATG"
+#line 1241 "cs.ATG"
attributes.Add(section);
}
AddAccessorDecl(
-#line 1247 "cs.ATG"
+#line 1242 "cs.ATG"
out stmt);
-#line 1247 "cs.ATG"
+#line 1242 "cs.ATG"
addBlock = new EventAddRegion(attributes); addBlock.Block = (BlockStatement)stmt;
} else SynErr(183);
}
void ConstructorInitializer(
-#line 1323 "cs.ATG"
+#line 1318 "cs.ATG"
out ConstructorInitializer ci) {
-#line 1324 "cs.ATG"
+#line 1319 "cs.ATG"
Expression expr; ci = new ConstructorInitializer();
Expect(9);
if (la.kind == 51) {
lexer.NextToken();
-#line 1328 "cs.ATG"
+#line 1323 "cs.ATG"
ci.ConstructorInitializerType = ConstructorInitializerType.Base;
} else if (la.kind == 111) {
lexer.NextToken();
-#line 1329 "cs.ATG"
+#line 1324 "cs.ATG"
ci.ConstructorInitializerType = ConstructorInitializerType.This;
} else SynErr(184);
Expect(20);
if (StartOf(26)) {
Argument(
-#line 1332 "cs.ATG"
+#line 1327 "cs.ATG"
out expr);
-#line 1332 "cs.ATG"
+#line 1327 "cs.ATG"
SafeAdd(ci, ci.Arguments, expr);
while (la.kind == 14) {
lexer.NextToken();
Argument(
-#line 1333 "cs.ATG"
+#line 1328 "cs.ATG"
out expr);
-#line 1333 "cs.ATG"
+#line 1328 "cs.ATG"
SafeAdd(ci, ci.Arguments, expr);
}
}
@@ -2802,161 +2797,161 @@ out expr);
}
void OverloadableOperator(
-#line 1346 "cs.ATG"
+#line 1341 "cs.ATG"
out OverloadableOperatorType op) {
-#line 1347 "cs.ATG"
+#line 1342 "cs.ATG"
op = OverloadableOperatorType.None;
switch (la.kind) {
case 4: {
lexer.NextToken();
-#line 1349 "cs.ATG"
+#line 1344 "cs.ATG"
op = OverloadableOperatorType.Add;
break;
}
case 5: {
lexer.NextToken();
-#line 1350 "cs.ATG"
+#line 1345 "cs.ATG"
op = OverloadableOperatorType.Subtract;
break;
}
case 24: {
lexer.NextToken();
-#line 1352 "cs.ATG"
+#line 1347 "cs.ATG"
op = OverloadableOperatorType.Not;
break;
}
case 27: {
lexer.NextToken();
-#line 1353 "cs.ATG"
+#line 1348 "cs.ATG"
op = OverloadableOperatorType.BitNot;
break;
}
case 31: {
lexer.NextToken();
-#line 1355 "cs.ATG"
+#line 1350 "cs.ATG"
op = OverloadableOperatorType.Increment;
break;
}
case 32: {
lexer.NextToken();
-#line 1356 "cs.ATG"
+#line 1351 "cs.ATG"
op = OverloadableOperatorType.Decrement;
break;
}
case 113: {
lexer.NextToken();
-#line 1358 "cs.ATG"
+#line 1353 "cs.ATG"
op = OverloadableOperatorType.IsTrue;
break;
}
case 72: {
lexer.NextToken();
-#line 1359 "cs.ATG"
+#line 1354 "cs.ATG"
op = OverloadableOperatorType.IsFalse;
break;
}
case 6: {
lexer.NextToken();
-#line 1361 "cs.ATG"
+#line 1356 "cs.ATG"
op = OverloadableOperatorType.Multiply;
break;
}
case 7: {
lexer.NextToken();
-#line 1362 "cs.ATG"
+#line 1357 "cs.ATG"
op = OverloadableOperatorType.Divide;
break;
}
case 8: {
lexer.NextToken();
-#line 1363 "cs.ATG"
+#line 1358 "cs.ATG"
op = OverloadableOperatorType.Modulus;
break;
}
case 28: {
lexer.NextToken();
-#line 1365 "cs.ATG"
+#line 1360 "cs.ATG"
op = OverloadableOperatorType.BitwiseAnd;
break;
}
case 29: {
lexer.NextToken();
-#line 1366 "cs.ATG"
+#line 1361 "cs.ATG"
op = OverloadableOperatorType.BitwiseOr;
break;
}
case 30: {
lexer.NextToken();
-#line 1367 "cs.ATG"
+#line 1362 "cs.ATG"
op = OverloadableOperatorType.ExclusiveOr;
break;
}
case 37: {
lexer.NextToken();
-#line 1369 "cs.ATG"
+#line 1364 "cs.ATG"
op = OverloadableOperatorType.ShiftLeft;
break;
}
case 33: {
lexer.NextToken();
-#line 1370 "cs.ATG"
+#line 1365 "cs.ATG"
op = OverloadableOperatorType.Equality;
break;
}
case 34: {
lexer.NextToken();
-#line 1371 "cs.ATG"
+#line 1366 "cs.ATG"
op = OverloadableOperatorType.InEquality;
break;
}
case 23: {
lexer.NextToken();
-#line 1372 "cs.ATG"
+#line 1367 "cs.ATG"
op = OverloadableOperatorType.LessThan;
break;
}
case 35: {
lexer.NextToken();
-#line 1373 "cs.ATG"
+#line 1368 "cs.ATG"
op = OverloadableOperatorType.GreaterThanOrEqual;
break;
}
case 36: {
lexer.NextToken();
-#line 1374 "cs.ATG"
+#line 1369 "cs.ATG"
op = OverloadableOperatorType.LessThanOrEqual;
break;
}
case 22: {
lexer.NextToken();
-#line 1375 "cs.ATG"
+#line 1370 "cs.ATG"
op = OverloadableOperatorType.GreaterThan;
if (la.kind == 22) {
lexer.NextToken();
-#line 1375 "cs.ATG"
+#line 1370 "cs.ATG"
op = OverloadableOperatorType.ShiftRight;
}
break;
@@ -2966,34 +2961,34 @@ out OverloadableOperatorType op) {
}
void VariableDeclarator(
-#line 1285 "cs.ATG"
+#line 1280 "cs.ATG"
FieldDeclaration parentFieldDeclaration) {
-#line 1286 "cs.ATG"
+#line 1281 "cs.ATG"
Expression expr = null;
Identifier();
-#line 1288 "cs.ATG"
+#line 1283 "cs.ATG"
VariableDeclaration f = new VariableDeclaration(t.val); f.StartLocation = t.Location;
if (la.kind == 3) {
lexer.NextToken();
VariableInitializer(
-#line 1289 "cs.ATG"
+#line 1284 "cs.ATG"
out expr);
-#line 1289 "cs.ATG"
+#line 1284 "cs.ATG"
f.Initializer = expr;
}
-#line 1290 "cs.ATG"
+#line 1285 "cs.ATG"
f.EndLocation = t.EndLocation; SafeAdd(parentFieldDeclaration, parentFieldDeclaration.Fields, f);
}
void AccessorDecls(
-#line 1177 "cs.ATG"
+#line 1172 "cs.ATG"
out PropertyGetRegion getBlock, out PropertySetRegion setBlock) {
-#line 1179 "cs.ATG"
+#line 1174 "cs.ATG"
List attributes = new List();
AttributeSection section;
getBlock = null;
@@ -3002,92 +2997,92 @@ out PropertyGetRegion getBlock, out PropertySetRegion setBlock) {
while (la.kind == 18) {
AttributeSection(
-#line 1186 "cs.ATG"
+#line 1181 "cs.ATG"
out section);
-#line 1186 "cs.ATG"
+#line 1181 "cs.ATG"
attributes.Add(section);
}
if (la.kind == 84 || la.kind == 96 || la.kind == 97) {
AccessorModifiers(
-#line 1187 "cs.ATG"
+#line 1182 "cs.ATG"
out modifiers);
}
if (la.kind == 128) {
GetAccessorDecl(
-#line 1189 "cs.ATG"
+#line 1184 "cs.ATG"
out getBlock, attributes);
-#line 1190 "cs.ATG"
+#line 1185 "cs.ATG"
if (modifiers != null) {getBlock.Modifier = modifiers.Modifier; }
if (StartOf(27)) {
-#line 1191 "cs.ATG"
+#line 1186 "cs.ATG"
attributes = new List(); modifiers = null;
while (la.kind == 18) {
AttributeSection(
-#line 1192 "cs.ATG"
+#line 1187 "cs.ATG"
out section);
-#line 1192 "cs.ATG"
+#line 1187 "cs.ATG"
attributes.Add(section);
}
if (la.kind == 84 || la.kind == 96 || la.kind == 97) {
AccessorModifiers(
-#line 1193 "cs.ATG"
+#line 1188 "cs.ATG"
out modifiers);
}
SetAccessorDecl(
-#line 1194 "cs.ATG"
+#line 1189 "cs.ATG"
out setBlock, attributes);
-#line 1195 "cs.ATG"
+#line 1190 "cs.ATG"
if (modifiers != null) {setBlock.Modifier = modifiers.Modifier; }
}
} else if (la.kind == 129) {
SetAccessorDecl(
-#line 1198 "cs.ATG"
+#line 1193 "cs.ATG"
out setBlock, attributes);
-#line 1199 "cs.ATG"
+#line 1194 "cs.ATG"
if (modifiers != null) {setBlock.Modifier = modifiers.Modifier; }
if (StartOf(28)) {
-#line 1200 "cs.ATG"
+#line 1195 "cs.ATG"
attributes = new List(); modifiers = null;
while (la.kind == 18) {
AttributeSection(
-#line 1201 "cs.ATG"
+#line 1196 "cs.ATG"
out section);
-#line 1201 "cs.ATG"
+#line 1196 "cs.ATG"
attributes.Add(section);
}
if (la.kind == 84 || la.kind == 96 || la.kind == 97) {
AccessorModifiers(
-#line 1202 "cs.ATG"
+#line 1197 "cs.ATG"
out modifiers);
}
GetAccessorDecl(
-#line 1203 "cs.ATG"
+#line 1198 "cs.ATG"
out getBlock, attributes);
-#line 1204 "cs.ATG"
+#line 1199 "cs.ATG"
if (modifiers != null) {getBlock.Modifier = modifiers.Modifier; }
}
} else if (StartOf(19)) {
Identifier();
-#line 1206 "cs.ATG"
+#line 1201 "cs.ATG"
Error("get or set accessor declaration expected");
} else SynErr(186);
}
void InterfaceAccessors(
-#line 1251 "cs.ATG"
+#line 1246 "cs.ATG"
out PropertyGetRegion getBlock, out PropertySetRegion setBlock) {
-#line 1253 "cs.ATG"
+#line 1248 "cs.ATG"
AttributeSection section;
List attributes = new List();
getBlock = null; setBlock = null;
@@ -3095,218 +3090,218 @@ out PropertyGetRegion getBlock, out PropertySetRegion setBlock) {
while (la.kind == 18) {
AttributeSection(
-#line 1259 "cs.ATG"
+#line 1254 "cs.ATG"
out section);
-#line 1259 "cs.ATG"
+#line 1254 "cs.ATG"
attributes.Add(section);
}
-#line 1260 "cs.ATG"
+#line 1255 "cs.ATG"
Location startLocation = la.Location;
if (la.kind == 128) {
lexer.NextToken();
-#line 1262 "cs.ATG"
+#line 1257 "cs.ATG"
getBlock = new PropertyGetRegion(null, attributes);
} else if (la.kind == 129) {
lexer.NextToken();
-#line 1263 "cs.ATG"
+#line 1258 "cs.ATG"
setBlock = new PropertySetRegion(null, attributes);
} else SynErr(187);
Expect(11);
-#line 1266 "cs.ATG"
+#line 1261 "cs.ATG"
if (getBlock != null) { getBlock.StartLocation = startLocation; getBlock.EndLocation = t.EndLocation; }
if (setBlock != null) { setBlock.StartLocation = startLocation; setBlock.EndLocation = t.EndLocation; }
attributes = new List();
if (la.kind == 18 || la.kind == 128 || la.kind == 129) {
while (la.kind == 18) {
AttributeSection(
-#line 1270 "cs.ATG"
+#line 1265 "cs.ATG"
out section);
-#line 1270 "cs.ATG"
+#line 1265 "cs.ATG"
attributes.Add(section);
}
-#line 1271 "cs.ATG"
+#line 1266 "cs.ATG"
startLocation = la.Location;
if (la.kind == 128) {
lexer.NextToken();
-#line 1273 "cs.ATG"
+#line 1268 "cs.ATG"
if (getBlock != null) Error("get already declared");
else { getBlock = new PropertyGetRegion(null, attributes); lastBlock = getBlock; }
} else if (la.kind == 129) {
lexer.NextToken();
-#line 1276 "cs.ATG"
+#line 1271 "cs.ATG"
if (setBlock != null) Error("set already declared");
else { setBlock = new PropertySetRegion(null, attributes); lastBlock = setBlock; }
} else SynErr(188);
Expect(11);
-#line 1281 "cs.ATG"
+#line 1276 "cs.ATG"
if (lastBlock != null) { lastBlock.StartLocation = startLocation; lastBlock.EndLocation = t.EndLocation; }
}
}
void GetAccessorDecl(
-#line 1210 "cs.ATG"
+#line 1205 "cs.ATG"
out PropertyGetRegion getBlock, List attributes) {
-#line 1211 "cs.ATG"
+#line 1206 "cs.ATG"
Statement stmt = null;
Expect(128);
-#line 1214 "cs.ATG"
+#line 1209 "cs.ATG"
Location startLocation = t.Location;
if (la.kind == 16) {
Block(
-#line 1215 "cs.ATG"
+#line 1210 "cs.ATG"
out stmt);
} else if (la.kind == 11) {
lexer.NextToken();
} else SynErr(189);
-#line 1216 "cs.ATG"
+#line 1211 "cs.ATG"
getBlock = new PropertyGetRegion((BlockStatement)stmt, attributes);
-#line 1217 "cs.ATG"
+#line 1212 "cs.ATG"
getBlock.StartLocation = startLocation; getBlock.EndLocation = t.EndLocation;
}
void SetAccessorDecl(
-#line 1220 "cs.ATG"
+#line 1215 "cs.ATG"
out PropertySetRegion setBlock, List attributes) {
-#line 1221 "cs.ATG"
+#line 1216 "cs.ATG"
Statement stmt = null;
Expect(129);
-#line 1224 "cs.ATG"
+#line 1219 "cs.ATG"
Location startLocation = t.Location;
if (la.kind == 16) {
Block(
-#line 1225 "cs.ATG"
+#line 1220 "cs.ATG"
out stmt);
} else if (la.kind == 11) {
lexer.NextToken();
} else SynErr(190);
-#line 1226 "cs.ATG"
+#line 1221 "cs.ATG"
setBlock = new PropertySetRegion((BlockStatement)stmt, attributes);
-#line 1227 "cs.ATG"
+#line 1222 "cs.ATG"
setBlock.StartLocation = startLocation; setBlock.EndLocation = t.EndLocation;
}
void AddAccessorDecl(
-#line 1309 "cs.ATG"
+#line 1304 "cs.ATG"
out Statement stmt) {
-#line 1310 "cs.ATG"
+#line 1305 "cs.ATG"
stmt = null;
Expect(130);
Block(
-#line 1313 "cs.ATG"
+#line 1308 "cs.ATG"
out stmt);
}
void RemoveAccessorDecl(
-#line 1316 "cs.ATG"
+#line 1311 "cs.ATG"
out Statement stmt) {
-#line 1317 "cs.ATG"
+#line 1312 "cs.ATG"
stmt = null;
Expect(131);
Block(
-#line 1320 "cs.ATG"
+#line 1315 "cs.ATG"
out stmt);
}
void VariableInitializer(
-#line 1338 "cs.ATG"
+#line 1333 "cs.ATG"
out Expression initializerExpression) {
-#line 1339 "cs.ATG"
+#line 1334 "cs.ATG"
TypeReference type = null; Expression expr = null; initializerExpression = null;
if (StartOf(6)) {
Expr(
-#line 1341 "cs.ATG"
+#line 1336 "cs.ATG"
out initializerExpression);
} else if (la.kind == 16) {
CollectionInitializer(
-#line 1342 "cs.ATG"
+#line 1337 "cs.ATG"
out initializerExpression);
} else if (la.kind == 106) {
lexer.NextToken();
Type(
-#line 1343 "cs.ATG"
+#line 1338 "cs.ATG"
out type);
Expect(18);
Expr(
-#line 1343 "cs.ATG"
+#line 1338 "cs.ATG"
out expr);
Expect(19);
-#line 1343 "cs.ATG"
+#line 1338 "cs.ATG"
initializerExpression = new StackAllocExpression(type, expr);
} else SynErr(191);
}
void Statement() {
-#line 1486 "cs.ATG"
+#line 1481 "cs.ATG"
Statement stmt = null;
Location startPos = la.Location;
while (!(StartOf(29))) {SynErr(192); lexer.NextToken(); }
if (
-#line 1493 "cs.ATG"
+#line 1488 "cs.ATG"
IsLabel()) {
Identifier();
-#line 1493 "cs.ATG"
+#line 1488 "cs.ATG"
compilationUnit.AddChild(new LabelStatement(t.val));
Expect(9);
Statement();
} else if (la.kind == 60) {
lexer.NextToken();
LocalVariableDecl(
-#line 1497 "cs.ATG"
+#line 1492 "cs.ATG"
out stmt);
-#line 1498 "cs.ATG"
+#line 1493 "cs.ATG"
if (stmt != null) { ((LocalVariableDeclaration)stmt).Modifier |= Modifiers.Const; }
Expect(11);
-#line 1499 "cs.ATG"
+#line 1494 "cs.ATG"
compilationUnit.AddChild(stmt);
} else if (
-#line 1501 "cs.ATG"
+#line 1496 "cs.ATG"
IsLocalVarDecl()) {
LocalVariableDecl(
-#line 1501 "cs.ATG"
+#line 1496 "cs.ATG"
out stmt);
Expect(11);
-#line 1501 "cs.ATG"
+#line 1496 "cs.ATG"
compilationUnit.AddChild(stmt);
} else if (StartOf(30)) {
EmbeddedStatement(
-#line 1503 "cs.ATG"
+#line 1498 "cs.ATG"
out stmt);
-#line 1503 "cs.ATG"
+#line 1498 "cs.ATG"
compilationUnit.AddChild(stmt);
} else SynErr(193);
-#line 1509 "cs.ATG"
+#line 1504 "cs.ATG"
if (stmt != null) {
stmt.StartLocation = startPos;
stmt.EndLocation = t.EndLocation;
@@ -3315,10 +3310,10 @@ out stmt);
}
void Argument(
-#line 1378 "cs.ATG"
+#line 1373 "cs.ATG"
out Expression argumentexpr) {
-#line 1380 "cs.ATG"
+#line 1375 "cs.ATG"
Expression expr;
FieldDirection fd = FieldDirection.None;
@@ -3326,51 +3321,51 @@ out Expression argumentexpr) {
if (la.kind == 100) {
lexer.NextToken();
-#line 1385 "cs.ATG"
+#line 1380 "cs.ATG"
fd = FieldDirection.Ref;
} else {
lexer.NextToken();
-#line 1386 "cs.ATG"
+#line 1381 "cs.ATG"
fd = FieldDirection.Out;
}
}
Expr(
-#line 1388 "cs.ATG"
+#line 1383 "cs.ATG"
out expr);
-#line 1389 "cs.ATG"
+#line 1384 "cs.ATG"
argumentexpr = fd != FieldDirection.None ? argumentexpr = new DirectionExpression(fd, expr) : expr;
}
void CollectionInitializer(
-#line 1409 "cs.ATG"
+#line 1404 "cs.ATG"
out Expression outExpr) {
-#line 1411 "cs.ATG"
+#line 1406 "cs.ATG"
Expression expr = null;
CollectionInitializerExpression initializer = new CollectionInitializerExpression();
Expect(16);
-#line 1415 "cs.ATG"
+#line 1410 "cs.ATG"
initializer.StartLocation = t.Location;
if (StartOf(31)) {
VariableInitializer(
-#line 1416 "cs.ATG"
+#line 1411 "cs.ATG"
out expr);
-#line 1417 "cs.ATG"
+#line 1412 "cs.ATG"
SafeAdd(initializer, initializer.CreateExpressions, expr);
while (
-#line 1418 "cs.ATG"
+#line 1413 "cs.ATG"
NotFinalComma()) {
Expect(14);
VariableInitializer(
-#line 1419 "cs.ATG"
+#line 1414 "cs.ATG"
out expr);
-#line 1420 "cs.ATG"
+#line 1415 "cs.ATG"
SafeAdd(initializer, initializer.CreateExpressions, expr);
}
if (la.kind == 14) {
@@ -3379,105 +3374,105 @@ out expr);
}
Expect(17);
-#line 1424 "cs.ATG"
+#line 1419 "cs.ATG"
initializer.EndLocation = t.Location; outExpr = initializer;
}
void AssignmentOperator(
-#line 1392 "cs.ATG"
+#line 1387 "cs.ATG"
out AssignmentOperatorType op) {
-#line 1393 "cs.ATG"
+#line 1388 "cs.ATG"
op = AssignmentOperatorType.None;
if (la.kind == 3) {
lexer.NextToken();
-#line 1395 "cs.ATG"
+#line 1390 "cs.ATG"
op = AssignmentOperatorType.Assign;
} else if (la.kind == 38) {
lexer.NextToken();
-#line 1396 "cs.ATG"
+#line 1391 "cs.ATG"
op = AssignmentOperatorType.Add;
} else if (la.kind == 39) {
lexer.NextToken();
-#line 1397 "cs.ATG"
+#line 1392 "cs.ATG"
op = AssignmentOperatorType.Subtract;
} else if (la.kind == 40) {
lexer.NextToken();
-#line 1398 "cs.ATG"
+#line 1393 "cs.ATG"
op = AssignmentOperatorType.Multiply;
} else if (la.kind == 41) {
lexer.NextToken();
-#line 1399 "cs.ATG"
+#line 1394 "cs.ATG"
op = AssignmentOperatorType.Divide;
} else if (la.kind == 42) {
lexer.NextToken();
-#line 1400 "cs.ATG"
+#line 1395 "cs.ATG"
op = AssignmentOperatorType.Modulus;
} else if (la.kind == 43) {
lexer.NextToken();
-#line 1401 "cs.ATG"
+#line 1396 "cs.ATG"
op = AssignmentOperatorType.BitwiseAnd;
} else if (la.kind == 44) {
lexer.NextToken();
-#line 1402 "cs.ATG"
+#line 1397 "cs.ATG"
op = AssignmentOperatorType.BitwiseOr;
} else if (la.kind == 45) {
lexer.NextToken();
-#line 1403 "cs.ATG"
+#line 1398 "cs.ATG"
op = AssignmentOperatorType.ExclusiveOr;
} else if (la.kind == 46) {
lexer.NextToken();
-#line 1404 "cs.ATG"
+#line 1399 "cs.ATG"
op = AssignmentOperatorType.ShiftLeft;
} else if (
-#line 1405 "cs.ATG"
+#line 1400 "cs.ATG"
la.kind == Tokens.GreaterThan && Peek(1).kind == Tokens.GreaterEqual) {
Expect(22);
Expect(35);
-#line 1406 "cs.ATG"
+#line 1401 "cs.ATG"
op = AssignmentOperatorType.ShiftRight;
} else SynErr(194);
}
void CollectionOrObjectInitializer(
-#line 1427 "cs.ATG"
+#line 1422 "cs.ATG"
out Expression outExpr) {
-#line 1429 "cs.ATG"
+#line 1424 "cs.ATG"
Expression expr = null;
CollectionInitializerExpression initializer = new CollectionInitializerExpression();
Expect(16);
-#line 1433 "cs.ATG"
+#line 1428 "cs.ATG"
initializer.StartLocation = t.Location;
if (StartOf(31)) {
ObjectPropertyInitializerOrVariableInitializer(
-#line 1434 "cs.ATG"
+#line 1429 "cs.ATG"
out expr);
-#line 1435 "cs.ATG"
+#line 1430 "cs.ATG"
SafeAdd(initializer, initializer.CreateExpressions, expr);
while (
-#line 1436 "cs.ATG"
+#line 1431 "cs.ATG"
NotFinalComma()) {
Expect(14);
ObjectPropertyInitializerOrVariableInitializer(
-#line 1437 "cs.ATG"
+#line 1432 "cs.ATG"
out expr);
-#line 1438 "cs.ATG"
+#line 1433 "cs.ATG"
SafeAdd(initializer, initializer.CreateExpressions, expr);
}
if (la.kind == 14) {
@@ -3486,280 +3481,280 @@ out expr);
}
Expect(17);
-#line 1442 "cs.ATG"
+#line 1437 "cs.ATG"
initializer.EndLocation = t.Location; outExpr = initializer;
}
void ObjectPropertyInitializerOrVariableInitializer(
-#line 1445 "cs.ATG"
+#line 1440 "cs.ATG"
out Expression expr) {
-#line 1446 "cs.ATG"
+#line 1441 "cs.ATG"
expr = null;
if (
-#line 1448 "cs.ATG"
+#line 1443 "cs.ATG"
IdentAndAsgn()) {
Identifier();
-#line 1450 "cs.ATG"
+#line 1445 "cs.ATG"
NamedArgumentExpression nae = new NamedArgumentExpression(t.val, null);
nae.StartLocation = t.Location;
Expression r = null;
Expect(3);
if (la.kind == 16) {
CollectionOrObjectInitializer(
-#line 1454 "cs.ATG"
+#line 1449 "cs.ATG"
out r);
} else if (StartOf(31)) {
VariableInitializer(
-#line 1455 "cs.ATG"
+#line 1450 "cs.ATG"
out r);
} else SynErr(195);
-#line 1456 "cs.ATG"
+#line 1451 "cs.ATG"
nae.Expression = r; nae.EndLocation = t.EndLocation; expr = nae;
} else if (StartOf(31)) {
VariableInitializer(
-#line 1458 "cs.ATG"
+#line 1453 "cs.ATG"
out expr);
} else SynErr(196);
}
void LocalVariableDecl(
-#line 1462 "cs.ATG"
+#line 1457 "cs.ATG"
out Statement stmt) {
-#line 1464 "cs.ATG"
+#line 1459 "cs.ATG"
TypeReference type;
VariableDeclaration var = null;
LocalVariableDeclaration localVariableDeclaration;
Location startPos = la.Location;
Type(
-#line 1470 "cs.ATG"
+#line 1465 "cs.ATG"
out type);
-#line 1470 "cs.ATG"
+#line 1465 "cs.ATG"
localVariableDeclaration = new LocalVariableDeclaration(type); localVariableDeclaration.StartLocation = startPos;
LocalVariableDeclarator(
-#line 1471 "cs.ATG"
+#line 1466 "cs.ATG"
out var);
-#line 1471 "cs.ATG"
+#line 1466 "cs.ATG"
SafeAdd(localVariableDeclaration, localVariableDeclaration.Variables, var);
while (la.kind == 14) {
lexer.NextToken();
LocalVariableDeclarator(
-#line 1472 "cs.ATG"
+#line 1467 "cs.ATG"
out var);
-#line 1472 "cs.ATG"
+#line 1467 "cs.ATG"
SafeAdd(localVariableDeclaration, localVariableDeclaration.Variables, var);
}
-#line 1473 "cs.ATG"
+#line 1468 "cs.ATG"
stmt = localVariableDeclaration; stmt.EndLocation = t.EndLocation;
}
void LocalVariableDeclarator(
-#line 1476 "cs.ATG"
+#line 1471 "cs.ATG"
out VariableDeclaration var) {
-#line 1477 "cs.ATG"
+#line 1472 "cs.ATG"
Expression expr = null;
Identifier();
-#line 1479 "cs.ATG"
+#line 1474 "cs.ATG"
var = new VariableDeclaration(t.val); var.StartLocation = t.Location;
if (la.kind == 3) {
lexer.NextToken();
VariableInitializer(
-#line 1480 "cs.ATG"
+#line 1475 "cs.ATG"
out expr);
-#line 1480 "cs.ATG"
+#line 1475 "cs.ATG"
var.Initializer = expr;
}
-#line 1481 "cs.ATG"
+#line 1476 "cs.ATG"
var.EndLocation = t.EndLocation;
}
void EmbeddedStatement(
-#line 1516 "cs.ATG"
+#line 1511 "cs.ATG"
out Statement statement) {
-#line 1518 "cs.ATG"
+#line 1513 "cs.ATG"
TypeReference type = null;
Expression expr = null;
Statement embeddedStatement = null;
statement = null;
-#line 1524 "cs.ATG"
+#line 1519 "cs.ATG"
Location startLocation = la.Location;
if (la.kind == 16) {
Block(
-#line 1526 "cs.ATG"
+#line 1521 "cs.ATG"
out statement);
} else if (la.kind == 11) {
lexer.NextToken();
-#line 1529 "cs.ATG"
+#line 1524 "cs.ATG"
statement = new EmptyStatement();
} else if (
-#line 1532 "cs.ATG"
+#line 1527 "cs.ATG"
UnCheckedAndLBrace()) {
-#line 1532 "cs.ATG"
+#line 1527 "cs.ATG"
Statement block; bool isChecked = true;
if (la.kind == 58) {
lexer.NextToken();
} else if (la.kind == 118) {
lexer.NextToken();
-#line 1533 "cs.ATG"
+#line 1528 "cs.ATG"
isChecked = false;
} else SynErr(197);
Block(
-#line 1534 "cs.ATG"
+#line 1529 "cs.ATG"
out block);
-#line 1534 "cs.ATG"
+#line 1529 "cs.ATG"
statement = isChecked ? (Statement)new CheckedStatement(block) : (Statement)new UncheckedStatement(block);
} else if (la.kind == 79) {
IfStatement(
-#line 1537 "cs.ATG"
+#line 1532 "cs.ATG"
out statement);
} else if (la.kind == 110) {
lexer.NextToken();
-#line 1539 "cs.ATG"
+#line 1534 "cs.ATG"
List switchSections = new List();
Expect(20);
Expr(
-#line 1540 "cs.ATG"
+#line 1535 "cs.ATG"
out expr);
Expect(21);
Expect(16);
SwitchSections(
-#line 1541 "cs.ATG"
+#line 1536 "cs.ATG"
switchSections);
Expect(17);
-#line 1543 "cs.ATG"
+#line 1538 "cs.ATG"
statement = new SwitchStatement(expr, switchSections);
} else if (la.kind == 125) {
lexer.NextToken();
Expect(20);
Expr(
-#line 1546 "cs.ATG"
+#line 1541 "cs.ATG"
out expr);
Expect(21);
EmbeddedStatement(
-#line 1547 "cs.ATG"
+#line 1542 "cs.ATG"
out embeddedStatement);
-#line 1548 "cs.ATG"
+#line 1543 "cs.ATG"
statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.Start);
} else if (la.kind == 65) {
lexer.NextToken();
EmbeddedStatement(
-#line 1550 "cs.ATG"
+#line 1545 "cs.ATG"
out embeddedStatement);
Expect(125);
Expect(20);
Expr(
-#line 1551 "cs.ATG"
+#line 1546 "cs.ATG"
out expr);
Expect(21);
Expect(11);
-#line 1552 "cs.ATG"
+#line 1547 "cs.ATG"
statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.End);
} else if (la.kind == 76) {
lexer.NextToken();
-#line 1554 "cs.ATG"
+#line 1549 "cs.ATG"
List initializer = null; List iterator = null;
Expect(20);
if (StartOf(6)) {
ForInitializer(
-#line 1555 "cs.ATG"
+#line 1550 "cs.ATG"
out initializer);
}
Expect(11);
if (StartOf(6)) {
Expr(
-#line 1556 "cs.ATG"
+#line 1551 "cs.ATG"
out expr);
}
Expect(11);
if (StartOf(6)) {
ForIterator(
-#line 1557 "cs.ATG"
+#line 1552 "cs.ATG"
out iterator);
}
Expect(21);
EmbeddedStatement(
-#line 1558 "cs.ATG"
+#line 1553 "cs.ATG"
out embeddedStatement);
-#line 1559 "cs.ATG"
+#line 1554 "cs.ATG"
statement = new ForStatement(initializer, expr, iterator, embeddedStatement);
} else if (la.kind == 77) {
lexer.NextToken();
Expect(20);
Type(
-#line 1561 "cs.ATG"
+#line 1556 "cs.ATG"
out type);
Identifier();
-#line 1561 "cs.ATG"
+#line 1556 "cs.ATG"
string varName = t.val;
Expect(81);
Expr(
-#line 1562 "cs.ATG"
+#line 1557 "cs.ATG"
out expr);
Expect(21);
EmbeddedStatement(
-#line 1563 "cs.ATG"
+#line 1558 "cs.ATG"
out embeddedStatement);
-#line 1564 "cs.ATG"
+#line 1559 "cs.ATG"
statement = new ForeachStatement(type, varName , expr, embeddedStatement);
} else if (la.kind == 53) {
lexer.NextToken();
Expect(11);
-#line 1567 "cs.ATG"
+#line 1562 "cs.ATG"
statement = new BreakStatement();
} else if (la.kind == 61) {
lexer.NextToken();
Expect(11);
-#line 1568 "cs.ATG"
+#line 1563 "cs.ATG"
statement = new ContinueStatement();
} else if (la.kind == 78) {
GotoStatement(
-#line 1569 "cs.ATG"
+#line 1564 "cs.ATG"
out statement);
} else if (
-#line 1571 "cs.ATG"
+#line 1566 "cs.ATG"
IsYieldStatement()) {
Expect(132);
if (la.kind == 101) {
lexer.NextToken();
Expr(
-#line 1572 "cs.ATG"
+#line 1567 "cs.ATG"
out expr);
-#line 1572 "cs.ATG"
+#line 1567 "cs.ATG"
statement = new YieldStatement(new ReturnStatement(expr));
} else if (la.kind == 53) {
lexer.NextToken();
-#line 1573 "cs.ATG"
+#line 1568 "cs.ATG"
statement = new YieldStatement(new BreakStatement());
} else SynErr(198);
Expect(11);
@@ -3767,90 +3762,90 @@ out expr);
lexer.NextToken();
if (StartOf(6)) {
Expr(
-#line 1576 "cs.ATG"
+#line 1571 "cs.ATG"
out expr);
}
Expect(11);
-#line 1576 "cs.ATG"
+#line 1571 "cs.ATG"
statement = new ReturnStatement(expr);
} else if (la.kind == 112) {
lexer.NextToken();
if (StartOf(6)) {
Expr(
-#line 1577 "cs.ATG"
+#line 1572 "cs.ATG"
out expr);
}
Expect(11);
-#line 1577 "cs.ATG"
+#line 1572 "cs.ATG"
statement = new ThrowStatement(expr);
} else if (StartOf(6)) {
StatementExpr(
-#line 1580 "cs.ATG"
+#line 1575 "cs.ATG"
out statement);
while (!(la.kind == 0 || la.kind == 11)) {SynErr(199); lexer.NextToken(); }
Expect(11);
} else if (la.kind == 114) {
TryStatement(
-#line 1583 "cs.ATG"
+#line 1578 "cs.ATG"
out statement);
} else if (la.kind == 86) {
lexer.NextToken();
Expect(20);
Expr(
-#line 1586 "cs.ATG"
+#line 1581 "cs.ATG"
out expr);
Expect(21);
EmbeddedStatement(
-#line 1587 "cs.ATG"
+#line 1582 "cs.ATG"
out embeddedStatement);
-#line 1587 "cs.ATG"
+#line 1582 "cs.ATG"
statement = new LockStatement(expr, embeddedStatement);
} else if (la.kind == 121) {
-#line 1590 "cs.ATG"
+#line 1585 "cs.ATG"
Statement resourceAcquisitionStmt = null;
lexer.NextToken();
Expect(20);
ResourceAcquisition(
-#line 1592 "cs.ATG"
+#line 1587 "cs.ATG"
out resourceAcquisitionStmt);
Expect(21);
EmbeddedStatement(
-#line 1593 "cs.ATG"
+#line 1588 "cs.ATG"
out embeddedStatement);
-#line 1593 "cs.ATG"
+#line 1588 "cs.ATG"
statement = new UsingStatement(resourceAcquisitionStmt, embeddedStatement);
} else if (la.kind == 119) {
lexer.NextToken();
Block(
-#line 1596 "cs.ATG"
+#line 1591 "cs.ATG"
out embeddedStatement);
-#line 1596 "cs.ATG"
+#line 1591 "cs.ATG"
statement = new UnsafeStatement(embeddedStatement);
} else if (la.kind == 74) {
-#line 1598 "cs.ATG"
+#line 1593 "cs.ATG"
Statement pointerDeclarationStmt = null;
lexer.NextToken();
Expect(20);
ResourceAcquisition(
-#line 1600 "cs.ATG"
+#line 1595 "cs.ATG"
out pointerDeclarationStmt);
Expect(21);
EmbeddedStatement(
-#line 1601 "cs.ATG"
+#line 1596 "cs.ATG"
out embeddedStatement);
-#line 1601 "cs.ATG"
+#line 1596 "cs.ATG"
statement = new FixedStatement(pointerDeclarationStmt, embeddedStatement);
} else SynErr(200);
-#line 1603 "cs.ATG"
+#line 1598 "cs.ATG"
if (statement != null) {
statement.StartLocation = startLocation;
statement.EndLocation = t.EndLocation;
@@ -3859,10 +3854,10 @@ out embeddedStatement);
}
void IfStatement(
-#line 1610 "cs.ATG"
+#line 1605 "cs.ATG"
out Statement statement) {
-#line 1612 "cs.ATG"
+#line 1607 "cs.ATG"
Expression expr = null;
Statement embeddedStatement = null;
statement = null;
@@ -3870,26 +3865,26 @@ out Statement statement) {
Expect(79);
Expect(20);
Expr(
-#line 1618 "cs.ATG"
+#line 1613 "cs.ATG"
out expr);
Expect(21);
EmbeddedStatement(
-#line 1619 "cs.ATG"
+#line 1614 "cs.ATG"
out embeddedStatement);
-#line 1620 "cs.ATG"
+#line 1615 "cs.ATG"
Statement elseStatement = null;
if (la.kind == 67) {
lexer.NextToken();
EmbeddedStatement(
-#line 1621 "cs.ATG"
+#line 1616 "cs.ATG"
out elseStatement);
}
-#line 1622 "cs.ATG"
+#line 1617 "cs.ATG"
statement = elseStatement != null ? new IfElseStatement(expr, embeddedStatement, elseStatement) : new IfElseStatement(expr, embeddedStatement);
-#line 1623 "cs.ATG"
+#line 1618 "cs.ATG"
if (elseStatement is IfElseStatement && (elseStatement as IfElseStatement).TrueStatement.Count == 1) {
/* else if-section (otherwise we would have a BlockStatment) */
(statement as IfElseStatement).ElseIfSections.Add(
@@ -3902,29 +3897,29 @@ out elseStatement);
}
void SwitchSections(
-#line 1653 "cs.ATG"
+#line 1648 "cs.ATG"
List switchSections) {
-#line 1655 "cs.ATG"
+#line 1650 "cs.ATG"
SwitchSection switchSection = new SwitchSection();
CaseLabel label;
SwitchLabel(
-#line 1659 "cs.ATG"
+#line 1654 "cs.ATG"
out label);
-#line 1659 "cs.ATG"
+#line 1654 "cs.ATG"
SafeAdd(switchSection, switchSection.SwitchLabels, label);
-#line 1660 "cs.ATG"
+#line 1655 "cs.ATG"
compilationUnit.BlockStart(switchSection);
while (StartOf(32)) {
if (la.kind == 55 || la.kind == 63) {
SwitchLabel(
-#line 1662 "cs.ATG"
+#line 1657 "cs.ATG"
out label);
-#line 1663 "cs.ATG"
+#line 1658 "cs.ATG"
if (label != null) {
if (switchSection.Children.Count > 0) {
// open new section
@@ -3940,145 +3935,145 @@ out label);
}
}
-#line 1675 "cs.ATG"
+#line 1670 "cs.ATG"
compilationUnit.BlockEnd(); switchSections.Add(switchSection);
}
void ForInitializer(
-#line 1634 "cs.ATG"
+#line 1629 "cs.ATG"
out List initializer) {
-#line 1636 "cs.ATG"
+#line 1631 "cs.ATG"
Statement stmt;
initializer = new List();
if (
-#line 1640 "cs.ATG"
+#line 1635 "cs.ATG"
IsLocalVarDecl()) {
LocalVariableDecl(
-#line 1640 "cs.ATG"
+#line 1635 "cs.ATG"
out stmt);
-#line 1640 "cs.ATG"
+#line 1635 "cs.ATG"
initializer.Add(stmt);
} else if (StartOf(6)) {
StatementExpr(
-#line 1641 "cs.ATG"
+#line 1636 "cs.ATG"
out stmt);
-#line 1641 "cs.ATG"
+#line 1636 "cs.ATG"
initializer.Add(stmt);
while (la.kind == 14) {
lexer.NextToken();
StatementExpr(
-#line 1641 "cs.ATG"
+#line 1636 "cs.ATG"
out stmt);
-#line 1641 "cs.ATG"
+#line 1636 "cs.ATG"
initializer.Add(stmt);
}
} else SynErr(201);
}
void ForIterator(
-#line 1644 "cs.ATG"
+#line 1639 "cs.ATG"
out List iterator) {
-#line 1646 "cs.ATG"
+#line 1641 "cs.ATG"
Statement stmt;
iterator = new List();
StatementExpr(
-#line 1650 "cs.ATG"
+#line 1645 "cs.ATG"
out stmt);
-#line 1650 "cs.ATG"
+#line 1645 "cs.ATG"
iterator.Add(stmt);
while (la.kind == 14) {
lexer.NextToken();
StatementExpr(
-#line 1650 "cs.ATG"
+#line 1645 "cs.ATG"
out stmt);
-#line 1650 "cs.ATG"
+#line 1645 "cs.ATG"
iterator.Add(stmt);
}
}
void GotoStatement(
-#line 1732 "cs.ATG"
+#line 1727 "cs.ATG"
out Statement stmt) {
-#line 1733 "cs.ATG"
+#line 1728 "cs.ATG"
Expression expr; stmt = null;
Expect(78);
if (StartOf(19)) {
Identifier();
-#line 1737 "cs.ATG"
+#line 1732 "cs.ATG"
stmt = new GotoStatement(t.val);
Expect(11);
} else if (la.kind == 55) {
lexer.NextToken();
Expr(
-#line 1738 "cs.ATG"
+#line 1733 "cs.ATG"
out expr);
Expect(11);
-#line 1738 "cs.ATG"
+#line 1733 "cs.ATG"
stmt = new GotoCaseStatement(expr);
} else if (la.kind == 63) {
lexer.NextToken();
Expect(11);
-#line 1739 "cs.ATG"
+#line 1734 "cs.ATG"
stmt = new GotoCaseStatement(null);
} else SynErr(202);
}
void StatementExpr(
-#line 1759 "cs.ATG"
+#line 1754 "cs.ATG"
out Statement stmt) {
-#line 1760 "cs.ATG"
+#line 1755 "cs.ATG"
Expression expr;
Expr(
-#line 1762 "cs.ATG"
+#line 1757 "cs.ATG"
out expr);
-#line 1765 "cs.ATG"
+#line 1760 "cs.ATG"
stmt = new ExpressionStatement(expr);
}
void TryStatement(
-#line 1685 "cs.ATG"
+#line 1680 "cs.ATG"
out Statement tryStatement) {
-#line 1687 "cs.ATG"
+#line 1682 "cs.ATG"
Statement blockStmt = null, finallyStmt = null;
CatchClause catchClause = null;
List catchClauses = new List();
Expect(114);
Block(
-#line 1692 "cs.ATG"
+#line 1687 "cs.ATG"
out blockStmt);
while (la.kind == 56) {
CatchClause(
-#line 1694 "cs.ATG"
+#line 1689 "cs.ATG"
out catchClause);
-#line 1695 "cs.ATG"
+#line 1690 "cs.ATG"
if (catchClause != null) catchClauses.Add(catchClause);
}
if (la.kind == 73) {
lexer.NextToken();
Block(
-#line 1697 "cs.ATG"
+#line 1692 "cs.ATG"
out finallyStmt);
}
-#line 1699 "cs.ATG"
+#line 1694 "cs.ATG"
tryStatement = new TryCatchStatement(blockStmt, catchClauses, finallyStmt);
if (catchClauses != null) {
foreach (CatchClause cc in catchClauses) cc.Parent = tryStatement;
@@ -4087,59 +4082,59 @@ out finallyStmt);
}
void ResourceAcquisition(
-#line 1743 "cs.ATG"
+#line 1738 "cs.ATG"
out Statement stmt) {
-#line 1745 "cs.ATG"
+#line 1740 "cs.ATG"
stmt = null;
Expression expr;
if (
-#line 1750 "cs.ATG"
+#line 1745 "cs.ATG"
IsLocalVarDecl()) {
LocalVariableDecl(
-#line 1750 "cs.ATG"
+#line 1745 "cs.ATG"
out stmt);
} else if (StartOf(6)) {
Expr(
-#line 1751 "cs.ATG"
+#line 1746 "cs.ATG"
out expr);
-#line 1755 "cs.ATG"
+#line 1750 "cs.ATG"
stmt = new ExpressionStatement(expr);
} else SynErr(203);
}
void SwitchLabel(
-#line 1678 "cs.ATG"
+#line 1673 "cs.ATG"
out CaseLabel label) {
-#line 1679 "cs.ATG"
+#line 1674 "cs.ATG"
Expression expr = null; label = null;
if (la.kind == 55) {
lexer.NextToken();
Expr(
-#line 1681 "cs.ATG"
+#line 1676 "cs.ATG"
out expr);
Expect(9);
-#line 1681 "cs.ATG"
+#line 1676 "cs.ATG"
label = new CaseLabel(expr);
} else if (la.kind == 63) {
lexer.NextToken();
Expect(9);
-#line 1682 "cs.ATG"
+#line 1677 "cs.ATG"
label = new CaseLabel();
} else SynErr(204);
}
void CatchClause(
-#line 1706 "cs.ATG"
+#line 1701 "cs.ATG"
out CatchClause catchClause) {
Expect(56);
-#line 1708 "cs.ATG"
+#line 1703 "cs.ATG"
string identifier;
Statement stmt;
TypeReference typeRef;
@@ -4148,35 +4143,35 @@ out CatchClause catchClause) {
if (la.kind == 16) {
Block(
-#line 1716 "cs.ATG"
+#line 1711 "cs.ATG"
out stmt);
-#line 1716 "cs.ATG"
+#line 1711 "cs.ATG"
catchClause = new CatchClause(stmt);
} else if (la.kind == 20) {
lexer.NextToken();
ClassType(
-#line 1719 "cs.ATG"
+#line 1714 "cs.ATG"
out typeRef, false);
-#line 1719 "cs.ATG"
+#line 1714 "cs.ATG"
identifier = null;
if (StartOf(19)) {
Identifier();
-#line 1720 "cs.ATG"
+#line 1715 "cs.ATG"
identifier = t.val;
}
Expect(21);
Block(
-#line 1721 "cs.ATG"
+#line 1716 "cs.ATG"
out stmt);
-#line 1722 "cs.ATG"
+#line 1717 "cs.ATG"
catchClause = new CatchClause(typeRef, identifier, stmt);
} else SynErr(205);
-#line 1725 "cs.ATG"
+#line 1720 "cs.ATG"
if (catchClause != null) {
catchClause.StartLocation = startPos;
catchClause.EndLocation = t.Location;
@@ -4185,75 +4180,75 @@ out stmt);
}
void UnaryExpr(
-#line 1794 "cs.ATG"
+#line 1789 "cs.ATG"
out Expression uExpr) {
-#line 1796 "cs.ATG"
+#line 1791 "cs.ATG"
TypeReference type = null;
Expression expr = null;
ArrayList expressions = new ArrayList();
uExpr = null;
while (StartOf(33) ||
-#line 1818 "cs.ATG"
+#line 1813 "cs.ATG"
IsTypeCast()) {
if (la.kind == 4) {
lexer.NextToken();
-#line 1805 "cs.ATG"
+#line 1800 "cs.ATG"
expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Plus));
} else if (la.kind == 5) {
lexer.NextToken();
-#line 1806 "cs.ATG"
+#line 1801 "cs.ATG"
expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Minus));
} else if (la.kind == 24) {
lexer.NextToken();
-#line 1807 "cs.ATG"
+#line 1802 "cs.ATG"
expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Not));
} else if (la.kind == 27) {
lexer.NextToken();
-#line 1808 "cs.ATG"
+#line 1803 "cs.ATG"
expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.BitNot));
} else if (la.kind == 6) {
lexer.NextToken();
-#line 1809 "cs.ATG"
+#line 1804 "cs.ATG"
expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Dereference));
} else if (la.kind == 31) {
lexer.NextToken();
-#line 1810 "cs.ATG"
+#line 1805 "cs.ATG"
expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Increment));
} else if (la.kind == 32) {
lexer.NextToken();
-#line 1811 "cs.ATG"
+#line 1806 "cs.ATG"
expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Decrement));
} else if (la.kind == 28) {
lexer.NextToken();
-#line 1812 "cs.ATG"
+#line 1807 "cs.ATG"
expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.AddressOf));
} else {
Expect(20);
Type(
-#line 1818 "cs.ATG"
+#line 1813 "cs.ATG"
out type);
Expect(21);
-#line 1818 "cs.ATG"
+#line 1813 "cs.ATG"
expressions.Add(new CastExpression(type));
}
}
if (
-#line 1823 "cs.ATG"
+#line 1818 "cs.ATG"
LastExpressionIsUnaryMinus(expressions) && IsMostNegativeIntegerWithoutTypeSuffix()) {
Expect(2);
-#line 1826 "cs.ATG"
+#line 1821 "cs.ATG"
expressions.RemoveAt(expressions.Count - 1);
if (t.literalValue is uint) {
expr = new PrimitiveExpression(int.MinValue, int.MinValue.ToString());
@@ -4265,11 +4260,11 @@ LastExpressionIsUnaryMinus(expressions) && IsMostNegativeIntegerWithoutTypeSuffi
} else if (StartOf(34)) {
PrimaryExpr(
-#line 1835 "cs.ATG"
+#line 1830 "cs.ATG"
out expr);
} else SynErr(206);
-#line 1837 "cs.ATG"
+#line 1832 "cs.ATG"
for (int i = 0; i < expressions.Count; ++i) {
Expression nextExpression = i + 1 < expressions.Count ? (Expression)expressions[i + 1] : expr;
if (expressions[i] is CastExpression) {
@@ -4287,325 +4282,325 @@ out expr);
}
void ConditionalOrExpr(
-#line 2161 "cs.ATG"
+#line 2156 "cs.ATG"
ref Expression outExpr) {
-#line 2162 "cs.ATG"
+#line 2157 "cs.ATG"
Expression expr;
ConditionalAndExpr(
-#line 2164 "cs.ATG"
+#line 2159 "cs.ATG"
ref outExpr);
while (la.kind == 26) {
lexer.NextToken();
UnaryExpr(
-#line 2164 "cs.ATG"
+#line 2159 "cs.ATG"
out expr);
ConditionalAndExpr(
-#line 2164 "cs.ATG"
+#line 2159 "cs.ATG"
ref expr);
-#line 2164 "cs.ATG"
+#line 2159 "cs.ATG"
outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.LogicalOr, expr);
}
}
void PrimaryExpr(
-#line 1854 "cs.ATG"
+#line 1849 "cs.ATG"
out Expression pexpr) {
-#line 1856 "cs.ATG"
+#line 1851 "cs.ATG"
TypeReference type = null;
Expression expr;
pexpr = null;
-#line 1861 "cs.ATG"
+#line 1856 "cs.ATG"
Location startLocation = la.Location;
if (la.kind == 113) {
lexer.NextToken();
-#line 1863 "cs.ATG"
+#line 1858 "cs.ATG"
pexpr = new PrimitiveExpression(true, "true");
} else if (la.kind == 72) {
lexer.NextToken();
-#line 1864 "cs.ATG"
+#line 1859 "cs.ATG"
pexpr = new PrimitiveExpression(false, "false");
} else if (la.kind == 90) {
lexer.NextToken();
-#line 1865 "cs.ATG"
+#line 1860 "cs.ATG"
pexpr = new PrimitiveExpression(null, "null");
} else if (la.kind == 2) {
lexer.NextToken();
-#line 1866 "cs.ATG"
+#line 1861 "cs.ATG"
pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };
} else if (
-#line 1867 "cs.ATG"
+#line 1862 "cs.ATG"
StartOfQueryExpression()) {
QueryExpression(
-#line 1868 "cs.ATG"
+#line 1863 "cs.ATG"
out pexpr);
} else if (
-#line 1869 "cs.ATG"
+#line 1864 "cs.ATG"
IdentAndDoubleColon()) {
Identifier();
-#line 1870 "cs.ATG"
+#line 1865 "cs.ATG"
type = new TypeReference(t.val);
Expect(10);
-#line 1871 "cs.ATG"
+#line 1866 "cs.ATG"
pexpr = new TypeReferenceExpression(type);
Identifier();
-#line 1872 "cs.ATG"
+#line 1867 "cs.ATG"
if (type.Type == "global") { type.IsGlobal = true; type.Type = t.val ?? "?"; } else type.Type += "." + (t.val ?? "?");
} else if (StartOf(19)) {
Identifier();
-#line 1876 "cs.ATG"
+#line 1871 "cs.ATG"
pexpr = new IdentifierExpression(t.val);
if (la.kind == 48 ||
-#line 1879 "cs.ATG"
+#line 1874 "cs.ATG"
IsGenericInSimpleNameOrMemberAccess()) {
if (la.kind == 48) {
ShortedLambdaExpression(
-#line 1878 "cs.ATG"
+#line 1873 "cs.ATG"
(IdentifierExpression)pexpr, out pexpr);
} else {
-#line 1880 "cs.ATG"
+#line 1875 "cs.ATG"
List typeList;
TypeArgumentList(
-#line 1881 "cs.ATG"
+#line 1876 "cs.ATG"
out typeList, false);
-#line 1882 "cs.ATG"
+#line 1877 "cs.ATG"
((IdentifierExpression)pexpr).TypeArguments = typeList;
}
}
} else if (
-#line 1884 "cs.ATG"
+#line 1879 "cs.ATG"
IsLambdaExpression()) {
LambdaExpression(
-#line 1885 "cs.ATG"
+#line 1880 "cs.ATG"
out pexpr);
} else if (la.kind == 20) {
lexer.NextToken();
Expr(
-#line 1888 "cs.ATG"
+#line 1883 "cs.ATG"
out expr);
Expect(21);
-#line 1888 "cs.ATG"
+#line 1883 "cs.ATG"
pexpr = new ParenthesizedExpression(expr);
} else if (StartOf(35)) {
-#line 1891 "cs.ATG"
+#line 1886 "cs.ATG"
string val = null;
switch (la.kind) {
case 52: {
lexer.NextToken();
-#line 1892 "cs.ATG"
+#line 1887 "cs.ATG"
val = "System.Boolean";
break;
}
case 54: {
lexer.NextToken();
-#line 1893 "cs.ATG"
+#line 1888 "cs.ATG"
val = "System.Byte";
break;
}
case 57: {
lexer.NextToken();
-#line 1894 "cs.ATG"
+#line 1889 "cs.ATG"
val = "System.Char";
break;
}
case 62: {
lexer.NextToken();
-#line 1895 "cs.ATG"
+#line 1890 "cs.ATG"
val = "System.Decimal";
break;
}
case 66: {
lexer.NextToken();
-#line 1896 "cs.ATG"
+#line 1891 "cs.ATG"
val = "System.Double";
break;
}
case 75: {
lexer.NextToken();
-#line 1897 "cs.ATG"
+#line 1892 "cs.ATG"
val = "System.Single";
break;
}
case 82: {
lexer.NextToken();
-#line 1898 "cs.ATG"
+#line 1893 "cs.ATG"
val = "System.Int32";
break;
}
case 87: {
lexer.NextToken();
-#line 1899 "cs.ATG"
+#line 1894 "cs.ATG"
val = "System.Int64";
break;
}
case 91: {
lexer.NextToken();
-#line 1900 "cs.ATG"
+#line 1895 "cs.ATG"
val = "System.Object";
break;
}
case 102: {
lexer.NextToken();
-#line 1901 "cs.ATG"
+#line 1896 "cs.ATG"
val = "System.SByte";
break;
}
case 104: {
lexer.NextToken();
-#line 1902 "cs.ATG"
+#line 1897 "cs.ATG"
val = "System.Int16";
break;
}
case 108: {
lexer.NextToken();
-#line 1903 "cs.ATG"
+#line 1898 "cs.ATG"
val = "System.String";
break;
}
case 116: {
lexer.NextToken();
-#line 1904 "cs.ATG"
+#line 1899 "cs.ATG"
val = "System.UInt32";
break;
}
case 117: {
lexer.NextToken();
-#line 1905 "cs.ATG"
+#line 1900 "cs.ATG"
val = "System.UInt64";
break;
}
case 120: {
lexer.NextToken();
-#line 1906 "cs.ATG"
+#line 1901 "cs.ATG"
val = "System.UInt16";
break;
}
case 123: {
lexer.NextToken();
-#line 1907 "cs.ATG"
+#line 1902 "cs.ATG"
val = "System.Void";
break;
}
}
-#line 1909 "cs.ATG"
+#line 1904 "cs.ATG"
pexpr = new TypeReferenceExpression(new TypeReference(val, true)) { StartLocation = t.Location, EndLocation = t.EndLocation };
} else if (la.kind == 111) {
lexer.NextToken();
-#line 1912 "cs.ATG"
+#line 1907 "cs.ATG"
pexpr = new ThisReferenceExpression(); pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation;
} else if (la.kind == 51) {
lexer.NextToken();
-#line 1914 "cs.ATG"
+#line 1909 "cs.ATG"
pexpr = new BaseReferenceExpression(); pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation;
} else if (la.kind == 89) {
NewExpression(
-#line 1917 "cs.ATG"
+#line 1912 "cs.ATG"
out pexpr);
} else if (la.kind == 115) {
lexer.NextToken();
Expect(20);
if (
-#line 1921 "cs.ATG"
+#line 1916 "cs.ATG"
NotVoidPointer()) {
Expect(123);
-#line 1921 "cs.ATG"
+#line 1916 "cs.ATG"
type = new TypeReference("System.Void", true);
} else if (StartOf(10)) {
TypeWithRestriction(
-#line 1922 "cs.ATG"
+#line 1917 "cs.ATG"
out type, true, true);
} else SynErr(207);
Expect(21);
-#line 1924 "cs.ATG"
+#line 1919 "cs.ATG"
pexpr = new TypeOfExpression(type);
} else if (la.kind == 63) {
lexer.NextToken();
Expect(20);
Type(
-#line 1926 "cs.ATG"
+#line 1921 "cs.ATG"
out type);
Expect(21);
-#line 1926 "cs.ATG"
+#line 1921 "cs.ATG"
pexpr = new DefaultValueExpression(type);
} else if (la.kind == 105) {
lexer.NextToken();
Expect(20);
Type(
-#line 1927 "cs.ATG"
+#line 1922 "cs.ATG"
out type);
Expect(21);
-#line 1927 "cs.ATG"
+#line 1922 "cs.ATG"
pexpr = new SizeOfExpression(type);
} else if (la.kind == 58) {
lexer.NextToken();
Expect(20);
Expr(
-#line 1928 "cs.ATG"
+#line 1923 "cs.ATG"
out expr);
Expect(21);
-#line 1928 "cs.ATG"
+#line 1923 "cs.ATG"
pexpr = new CheckedExpression(expr);
} else if (la.kind == 118) {
lexer.NextToken();
Expect(20);
Expr(
-#line 1929 "cs.ATG"
+#line 1924 "cs.ATG"
out expr);
Expect(21);
-#line 1929 "cs.ATG"
+#line 1924 "cs.ATG"
pexpr = new UncheckedExpression(expr);
} else if (la.kind == 64) {
lexer.NextToken();
AnonymousMethodExpr(
-#line 1930 "cs.ATG"
+#line 1925 "cs.ATG"
out expr);
-#line 1930 "cs.ATG"
+#line 1925 "cs.ATG"
pexpr = expr;
} else SynErr(208);
-#line 1932 "cs.ATG"
+#line 1927 "cs.ATG"
if (pexpr != null) {
if (pexpr.StartLocation.IsEmpty)
pexpr.StartLocation = startLocation;
@@ -4615,57 +4610,57 @@ out expr);
while (StartOf(36)) {
-#line 1940 "cs.ATG"
+#line 1935 "cs.ATG"
startLocation = la.Location;
switch (la.kind) {
case 31: {
lexer.NextToken();
-#line 1942 "cs.ATG"
+#line 1937 "cs.ATG"
pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostIncrement);
break;
}
case 32: {
lexer.NextToken();
-#line 1944 "cs.ATG"
+#line 1939 "cs.ATG"
pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostDecrement);
break;
}
case 47: {
PointerMemberAccess(
-#line 1946 "cs.ATG"
+#line 1941 "cs.ATG"
out pexpr, pexpr);
break;
}
case 15: {
MemberAccess(
-#line 1947 "cs.ATG"
+#line 1942 "cs.ATG"
out pexpr, pexpr);
break;
}
case 20: {
lexer.NextToken();
-#line 1951 "cs.ATG"
+#line 1946 "cs.ATG"
List parameters = new List();
-#line 1952 "cs.ATG"
+#line 1947 "cs.ATG"
pexpr = new InvocationExpression(pexpr, parameters);
if (StartOf(26)) {
Argument(
-#line 1953 "cs.ATG"
+#line 1948 "cs.ATG"
out expr);
-#line 1953 "cs.ATG"
+#line 1948 "cs.ATG"
SafeAdd(pexpr, parameters, expr);
while (la.kind == 14) {
lexer.NextToken();
Argument(
-#line 1954 "cs.ATG"
+#line 1949 "cs.ATG"
out expr);
-#line 1954 "cs.ATG"
+#line 1949 "cs.ATG"
SafeAdd(pexpr, parameters, expr);
}
}
@@ -4674,24 +4669,24 @@ out expr);
}
case 18: {
-#line 1960 "cs.ATG"
+#line 1955 "cs.ATG"
List indices = new List();
pexpr = new IndexerExpression(pexpr, indices);
lexer.NextToken();
Expr(
-#line 1963 "cs.ATG"
+#line 1958 "cs.ATG"
out expr);
-#line 1963 "cs.ATG"
+#line 1958 "cs.ATG"
SafeAdd(pexpr, indices, expr);
while (la.kind == 14) {
lexer.NextToken();
Expr(
-#line 1964 "cs.ATG"
+#line 1959 "cs.ATG"
out expr);
-#line 1964 "cs.ATG"
+#line 1959 "cs.ATG"
SafeAdd(pexpr, indices, expr);
}
Expect(19);
@@ -4699,7 +4694,7 @@ out expr);
}
}
-#line 1967 "cs.ATG"
+#line 1962 "cs.ATG"
if (pexpr != null) {
if (pexpr.StartLocation.IsEmpty)
pexpr.StartLocation = startLocation;
@@ -4711,83 +4706,83 @@ out expr);
}
void QueryExpression(
-#line 2399 "cs.ATG"
+#line 2394 "cs.ATG"
out Expression outExpr) {
-#line 2400 "cs.ATG"
+#line 2395 "cs.ATG"
QueryExpression q = new QueryExpression(); outExpr = q; q.StartLocation = la.Location;
QueryExpressionFromClause fromClause;
QueryExpressionFromClause(
-#line 2404 "cs.ATG"
+#line 2399 "cs.ATG"
out fromClause);
-#line 2404 "cs.ATG"
+#line 2399 "cs.ATG"
q.FromClause = fromClause;
QueryExpressionBody(
-#line 2405 "cs.ATG"
+#line 2400 "cs.ATG"
ref q);
-#line 2406 "cs.ATG"
+#line 2401 "cs.ATG"
q.EndLocation = t.EndLocation;
outExpr = q; /* set outExpr to q again if QueryExpressionBody changed it (can happen with 'into' clauses) */
}
void ShortedLambdaExpression(
-#line 2081 "cs.ATG"
+#line 2076 "cs.ATG"
IdentifierExpression ident, out Expression pexpr) {
-#line 2082 "cs.ATG"
+#line 2077 "cs.ATG"
LambdaExpression lambda = new LambdaExpression(); pexpr = lambda;
Expect(48);
-#line 2087 "cs.ATG"
+#line 2082 "cs.ATG"
lambda.StartLocation = ident.StartLocation;
SafeAdd(lambda, lambda.Parameters, new ParameterDeclarationExpression(null, ident.Identifier));
lambda.Parameters[0].StartLocation = ident.StartLocation;
lambda.Parameters[0].EndLocation = ident.EndLocation;
LambdaExpressionBody(
-#line 2092 "cs.ATG"
+#line 2087 "cs.ATG"
lambda);
}
void TypeArgumentList(
-#line 2333 "cs.ATG"
+#line 2328 "cs.ATG"
out List types, bool canBeUnbound) {
-#line 2335 "cs.ATG"
+#line 2330 "cs.ATG"
types = new List();
TypeReference type = null;
Expect(23);
if (
-#line 2340 "cs.ATG"
+#line 2335 "cs.ATG"
canBeUnbound && (la.kind == Tokens.GreaterThan || la.kind == Tokens.Comma)) {
-#line 2341 "cs.ATG"
+#line 2336 "cs.ATG"
types.Add(TypeReference.Null);
while (la.kind == 14) {
lexer.NextToken();
-#line 2342 "cs.ATG"
+#line 2337 "cs.ATG"
types.Add(TypeReference.Null);
}
} else if (StartOf(10)) {
Type(
-#line 2343 "cs.ATG"
+#line 2338 "cs.ATG"
out type);
-#line 2343 "cs.ATG"
+#line 2338 "cs.ATG"
if (type != null) { types.Add(type); }
while (la.kind == 14) {
lexer.NextToken();
Type(
-#line 2344 "cs.ATG"
+#line 2339 "cs.ATG"
out type);
-#line 2344 "cs.ATG"
+#line 2339 "cs.ATG"
if (type != null) { types.Add(type); }
}
} else SynErr(209);
@@ -4795,10 +4790,10 @@ out type);
}
void LambdaExpression(
-#line 2061 "cs.ATG"
+#line 2056 "cs.ATG"
out Expression outExpr) {
-#line 2063 "cs.ATG"
+#line 2058 "cs.ATG"
LambdaExpression lambda = new LambdaExpression();
lambda.StartLocation = la.Location;
ParameterDeclarationExpression p;
@@ -4807,33 +4802,33 @@ out Expression outExpr) {
Expect(20);
if (StartOf(18)) {
LambdaExpressionParameter(
-#line 2071 "cs.ATG"
+#line 2066 "cs.ATG"
out p);
-#line 2071 "cs.ATG"
+#line 2066 "cs.ATG"
SafeAdd(lambda, lambda.Parameters, p);
while (la.kind == 14) {
lexer.NextToken();
LambdaExpressionParameter(
-#line 2073 "cs.ATG"
+#line 2068 "cs.ATG"
out p);
-#line 2073 "cs.ATG"
+#line 2068 "cs.ATG"
SafeAdd(lambda, lambda.Parameters, p);
}
}
Expect(21);
Expect(48);
LambdaExpressionBody(
-#line 2078 "cs.ATG"
+#line 2073 "cs.ATG"
lambda);
}
void NewExpression(
-#line 2008 "cs.ATG"
+#line 2003 "cs.ATG"
out Expression pexpr) {
-#line 2009 "cs.ATG"
+#line 2004 "cs.ATG"
pexpr = null;
List parameters = new List();
TypeReference type = null;
@@ -4842,65 +4837,65 @@ out Expression pexpr) {
Expect(89);
if (StartOf(10)) {
NonArrayType(
-#line 2016 "cs.ATG"
+#line 2011 "cs.ATG"
out type);
}
if (la.kind == 16 || la.kind == 20) {
if (la.kind == 20) {
-#line 2022 "cs.ATG"
+#line 2017 "cs.ATG"
ObjectCreateExpression oce = new ObjectCreateExpression(type, parameters);
lexer.NextToken();
-#line 2023 "cs.ATG"
+#line 2018 "cs.ATG"
if (type == null) Error("Cannot use an anonymous type with arguments for the constructor");
if (StartOf(26)) {
Argument(
-#line 2024 "cs.ATG"
+#line 2019 "cs.ATG"
out expr);
-#line 2024 "cs.ATG"
+#line 2019 "cs.ATG"
SafeAdd(oce, parameters, expr);
while (la.kind == 14) {
lexer.NextToken();
Argument(
-#line 2025 "cs.ATG"
+#line 2020 "cs.ATG"
out expr);
-#line 2025 "cs.ATG"
+#line 2020 "cs.ATG"
SafeAdd(oce, parameters, expr);
}
}
Expect(21);
-#line 2027 "cs.ATG"
+#line 2022 "cs.ATG"
pexpr = oce;
if (la.kind == 16) {
CollectionOrObjectInitializer(
-#line 2028 "cs.ATG"
+#line 2023 "cs.ATG"
out expr);
-#line 2028 "cs.ATG"
+#line 2023 "cs.ATG"
oce.ObjectInitializer = (CollectionInitializerExpression)expr;
}
} else {
-#line 2029 "cs.ATG"
+#line 2024 "cs.ATG"
ObjectCreateExpression oce = new ObjectCreateExpression(type, parameters);
CollectionOrObjectInitializer(
-#line 2030 "cs.ATG"
+#line 2025 "cs.ATG"
out expr);
-#line 2030 "cs.ATG"
+#line 2025 "cs.ATG"
oce.ObjectInitializer = (CollectionInitializerExpression)expr;
-#line 2031 "cs.ATG"
+#line 2026 "cs.ATG"
pexpr = oce;
}
} else if (la.kind == 18) {
lexer.NextToken();
-#line 2036 "cs.ATG"
+#line 2031 "cs.ATG"
ArrayCreateExpression ace = new ArrayCreateExpression(type);
/* we must not change RankSpecifier on the null type reference*/
if (ace.CreateType.IsNull) { ace.CreateType = new TypeReference(""); }
@@ -4911,80 +4906,80 @@ out expr);
while (la.kind == 14) {
lexer.NextToken();
-#line 2043 "cs.ATG"
+#line 2038 "cs.ATG"
dims += 1;
}
Expect(19);
-#line 2044 "cs.ATG"
+#line 2039 "cs.ATG"
ranks.Add(dims); dims = 0;
while (la.kind == 18) {
lexer.NextToken();
while (la.kind == 14) {
lexer.NextToken();
-#line 2045 "cs.ATG"
+#line 2040 "cs.ATG"
++dims;
}
Expect(19);
-#line 2045 "cs.ATG"
+#line 2040 "cs.ATG"
ranks.Add(dims); dims = 0;
}
-#line 2046 "cs.ATG"
+#line 2041 "cs.ATG"
ace.CreateType.RankSpecifier = ranks.ToArray();
CollectionInitializer(
-#line 2047 "cs.ATG"
+#line 2042 "cs.ATG"
out expr);
-#line 2047 "cs.ATG"
+#line 2042 "cs.ATG"
ace.ArrayInitializer = (CollectionInitializerExpression)expr;
} else if (StartOf(6)) {
Expr(
-#line 2048 "cs.ATG"
+#line 2043 "cs.ATG"
out expr);
-#line 2048 "cs.ATG"
+#line 2043 "cs.ATG"
if (expr != null) parameters.Add(expr);
while (la.kind == 14) {
lexer.NextToken();
-#line 2049 "cs.ATG"
+#line 2044 "cs.ATG"
dims += 1;
Expr(
-#line 2050 "cs.ATG"
+#line 2045 "cs.ATG"
out expr);
-#line 2050 "cs.ATG"
+#line 2045 "cs.ATG"
if (expr != null) parameters.Add(expr);
}
Expect(19);
-#line 2052 "cs.ATG"
+#line 2047 "cs.ATG"
ranks.Add(dims); ace.Arguments = parameters; dims = 0;
while (la.kind == 18) {
lexer.NextToken();
while (la.kind == 14) {
lexer.NextToken();
-#line 2053 "cs.ATG"
+#line 2048 "cs.ATG"
++dims;
}
Expect(19);
-#line 2053 "cs.ATG"
+#line 2048 "cs.ATG"
ranks.Add(dims); dims = 0;
}
-#line 2054 "cs.ATG"
+#line 2049 "cs.ATG"
ace.CreateType.RankSpecifier = ranks.ToArray();
if (la.kind == 16) {
CollectionInitializer(
-#line 2055 "cs.ATG"
+#line 2050 "cs.ATG"
out expr);
-#line 2055 "cs.ATG"
+#line 2050 "cs.ATG"
ace.ArrayInitializer = (CollectionInitializerExpression)expr;
}
} else SynErr(210);
@@ -4992,10 +4987,10 @@ out expr);
}
void AnonymousMethodExpr(
-#line 2128 "cs.ATG"
+#line 2123 "cs.ATG"
out Expression outExpr) {
-#line 2130 "cs.ATG"
+#line 2125 "cs.ATG"
AnonymousMethodExpression expr = new AnonymousMethodExpression();
expr.StartLocation = t.Location;
BlockStatement stmt;
@@ -5006,59 +5001,59 @@ out Expression outExpr) {
lexer.NextToken();
if (StartOf(11)) {
FormalParameterList(
-#line 2139 "cs.ATG"
+#line 2134 "cs.ATG"
p);
-#line 2139 "cs.ATG"
+#line 2134 "cs.ATG"
expr.Parameters = p;
}
Expect(21);
-#line 2141 "cs.ATG"
+#line 2136 "cs.ATG"
expr.HasParameterList = true;
}
BlockInsideExpression(
-#line 2143 "cs.ATG"
+#line 2138 "cs.ATG"
out stmt);
-#line 2143 "cs.ATG"
+#line 2138 "cs.ATG"
expr.Body = stmt;
-#line 2144 "cs.ATG"
+#line 2139 "cs.ATG"
expr.EndLocation = t.Location;
}
void PointerMemberAccess(
-#line 1996 "cs.ATG"
+#line 1991 "cs.ATG"
out Expression expr, Expression target) {
-#line 1997 "cs.ATG"
+#line 1992 "cs.ATG"
List typeList;
Expect(47);
Identifier();
-#line 2001 "cs.ATG"
+#line 1996 "cs.ATG"
expr = new PointerReferenceExpression(target, t.val); expr.StartLocation = t.Location; expr.EndLocation = t.EndLocation;
if (
-#line 2002 "cs.ATG"
+#line 1997 "cs.ATG"
IsGenericInSimpleNameOrMemberAccess()) {
TypeArgumentList(
-#line 2003 "cs.ATG"
+#line 1998 "cs.ATG"
out typeList, false);
-#line 2004 "cs.ATG"
+#line 1999 "cs.ATG"
((MemberReferenceExpression)expr).TypeArguments = typeList;
}
}
void MemberAccess(
-#line 1977 "cs.ATG"
+#line 1972 "cs.ATG"
out Expression expr, Expression target) {
-#line 1978 "cs.ATG"
+#line 1973 "cs.ATG"
List typeList;
-#line 1980 "cs.ATG"
+#line 1975 "cs.ATG"
if (ShouldConvertTargetExpressionToTypeReference(target)) {
TypeReference type = GetTypeReferenceFromExpression(target);
if (type != null) {
@@ -5068,39 +5063,39 @@ out Expression expr, Expression target) {
Expect(15);
-#line 1987 "cs.ATG"
+#line 1982 "cs.ATG"
Location startLocation = t.Location;
Identifier();
-#line 1989 "cs.ATG"
+#line 1984 "cs.ATG"
expr = new MemberReferenceExpression(target, t.val); expr.StartLocation = startLocation; expr.EndLocation = t.EndLocation;
if (
-#line 1990 "cs.ATG"
+#line 1985 "cs.ATG"
IsGenericInSimpleNameOrMemberAccess()) {
TypeArgumentList(
-#line 1991 "cs.ATG"
+#line 1986 "cs.ATG"
out typeList, false);
-#line 1992 "cs.ATG"
+#line 1987 "cs.ATG"
((MemberReferenceExpression)expr).TypeArguments = typeList;
}
}
void LambdaExpressionParameter(
-#line 2095 "cs.ATG"
+#line 2090 "cs.ATG"
out ParameterDeclarationExpression p) {
-#line 2096 "cs.ATG"
+#line 2091 "cs.ATG"
Location start = la.Location; p = null;
TypeReference type;
ParameterModifiers mod = ParameterModifiers.In;
if (
-#line 2101 "cs.ATG"
+#line 2096 "cs.ATG"
Peek(1).kind == Tokens.Comma || Peek(1).kind == Tokens.CloseParenthesis) {
Identifier();
-#line 2103 "cs.ATG"
+#line 2098 "cs.ATG"
p = new ParameterDeclarationExpression(null, t.val);
p.StartLocation = start; p.EndLocation = t.EndLocation;
@@ -5109,21 +5104,21 @@ Peek(1).kind == Tokens.Comma || Peek(1).kind == Tokens.CloseParenthesis) {
if (la.kind == 100) {
lexer.NextToken();
-#line 2106 "cs.ATG"
+#line 2101 "cs.ATG"
mod = ParameterModifiers.Ref;
} else {
lexer.NextToken();
-#line 2107 "cs.ATG"
+#line 2102 "cs.ATG"
mod = ParameterModifiers.Out;
}
}
Type(
-#line 2109 "cs.ATG"
+#line 2104 "cs.ATG"
out type);
Identifier();
-#line 2111 "cs.ATG"
+#line 2106 "cs.ATG"
p = new ParameterDeclarationExpression(type, t.val, mod);
p.StartLocation = start; p.EndLocation = t.EndLocation;
@@ -5131,263 +5126,263 @@ out type);
}
void LambdaExpressionBody(
-#line 2117 "cs.ATG"
+#line 2112 "cs.ATG"
LambdaExpression lambda) {
-#line 2118 "cs.ATG"
+#line 2113 "cs.ATG"
Expression expr; BlockStatement stmt;
if (la.kind == 16) {
BlockInsideExpression(
-#line 2121 "cs.ATG"
+#line 2116 "cs.ATG"
out stmt);
-#line 2121 "cs.ATG"
+#line 2116 "cs.ATG"
lambda.StatementBody = stmt;
} else if (StartOf(6)) {
Expr(
-#line 2122 "cs.ATG"
+#line 2117 "cs.ATG"
out expr);
-#line 2122 "cs.ATG"
+#line 2117 "cs.ATG"
lambda.ExpressionBody = expr;
} else SynErr(213);
-#line 2124 "cs.ATG"
+#line 2119 "cs.ATG"
lambda.EndLocation = t.EndLocation;
-#line 2125 "cs.ATG"
+#line 2120 "cs.ATG"
lambda.ExtendedEndLocation = la.Location;
}
void BlockInsideExpression(
-#line 2147 "cs.ATG"
+#line 2142 "cs.ATG"
out BlockStatement outStmt) {
-#line 2148 "cs.ATG"
+#line 2143 "cs.ATG"
Statement stmt = null; outStmt = null;
-#line 2152 "cs.ATG"
+#line 2147 "cs.ATG"
if (compilationUnit != null) {
Block(
-#line 2153 "cs.ATG"
+#line 2148 "cs.ATG"
out stmt);
-#line 2153 "cs.ATG"
+#line 2148 "cs.ATG"
outStmt = (BlockStatement)stmt;
-#line 2154 "cs.ATG"
+#line 2149 "cs.ATG"
} else {
Expect(16);
-#line 2156 "cs.ATG"
+#line 2151 "cs.ATG"
lexer.SkipCurrentBlock(0);
Expect(17);
-#line 2158 "cs.ATG"
+#line 2153 "cs.ATG"
}
}
void ConditionalAndExpr(
-#line 2167 "cs.ATG"
+#line 2162 "cs.ATG"
ref Expression outExpr) {
-#line 2168 "cs.ATG"
+#line 2163 "cs.ATG"
Expression expr;
InclusiveOrExpr(
-#line 2170 "cs.ATG"
+#line 2165 "cs.ATG"
ref outExpr);
while (la.kind == 25) {
lexer.NextToken();
UnaryExpr(
-#line 2170 "cs.ATG"
+#line 2165 "cs.ATG"
out expr);
InclusiveOrExpr(
-#line 2170 "cs.ATG"
+#line 2165 "cs.ATG"
ref expr);
-#line 2170 "cs.ATG"
+#line 2165 "cs.ATG"
outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.LogicalAnd, expr);
}
}
void InclusiveOrExpr(
-#line 2173 "cs.ATG"
+#line 2168 "cs.ATG"
ref Expression outExpr) {
-#line 2174 "cs.ATG"
+#line 2169 "cs.ATG"
Expression expr;
ExclusiveOrExpr(
-#line 2176 "cs.ATG"
+#line 2171 "cs.ATG"
ref outExpr);
while (la.kind == 29) {
lexer.NextToken();
UnaryExpr(
-#line 2176 "cs.ATG"
+#line 2171 "cs.ATG"
out expr);
ExclusiveOrExpr(
-#line 2176 "cs.ATG"
+#line 2171 "cs.ATG"
ref expr);
-#line 2176 "cs.ATG"
+#line 2171 "cs.ATG"
outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.BitwiseOr, expr);
}
}
void ExclusiveOrExpr(
-#line 2179 "cs.ATG"
+#line 2174 "cs.ATG"
ref Expression outExpr) {
-#line 2180 "cs.ATG"
+#line 2175 "cs.ATG"
Expression expr;
AndExpr(
-#line 2182 "cs.ATG"
+#line 2177 "cs.ATG"
ref outExpr);
while (la.kind == 30) {
lexer.NextToken();
UnaryExpr(
-#line 2182 "cs.ATG"
+#line 2177 "cs.ATG"
out expr);
AndExpr(
-#line 2182 "cs.ATG"
+#line 2177 "cs.ATG"
ref expr);
-#line 2182 "cs.ATG"
+#line 2177 "cs.ATG"
outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.ExclusiveOr, expr);
}
}
void AndExpr(
-#line 2185 "cs.ATG"
+#line 2180 "cs.ATG"
ref Expression outExpr) {
-#line 2186 "cs.ATG"
+#line 2181 "cs.ATG"
Expression expr;
EqualityExpr(
-#line 2188 "cs.ATG"
+#line 2183 "cs.ATG"
ref outExpr);
while (la.kind == 28) {
lexer.NextToken();
UnaryExpr(
-#line 2188 "cs.ATG"
+#line 2183 "cs.ATG"
out expr);
EqualityExpr(
-#line 2188 "cs.ATG"
+#line 2183 "cs.ATG"
ref expr);
-#line 2188 "cs.ATG"
+#line 2183 "cs.ATG"
outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.BitwiseAnd, expr);
}
}
void EqualityExpr(
-#line 2191 "cs.ATG"
+#line 2186 "cs.ATG"
ref Expression outExpr) {
-#line 2193 "cs.ATG"
+#line 2188 "cs.ATG"
Expression expr;
BinaryOperatorType op = BinaryOperatorType.None;
RelationalExpr(
-#line 2197 "cs.ATG"
+#line 2192 "cs.ATG"
ref outExpr);
while (la.kind == 33 || la.kind == 34) {
if (la.kind == 34) {
lexer.NextToken();
-#line 2200 "cs.ATG"
+#line 2195 "cs.ATG"
op = BinaryOperatorType.InEquality;
} else {
lexer.NextToken();
-#line 2201 "cs.ATG"
+#line 2196 "cs.ATG"
op = BinaryOperatorType.Equality;
}
UnaryExpr(
-#line 2203 "cs.ATG"
+#line 2198 "cs.ATG"
out expr);
RelationalExpr(
-#line 2203 "cs.ATG"
+#line 2198 "cs.ATG"
ref expr);
-#line 2203 "cs.ATG"
+#line 2198 "cs.ATG"
outExpr = new BinaryOperatorExpression(outExpr, op, expr);
}
}
void RelationalExpr(
-#line 2207 "cs.ATG"
+#line 2202 "cs.ATG"
ref Expression outExpr) {
-#line 2209 "cs.ATG"
+#line 2204 "cs.ATG"
TypeReference type;
Expression expr;
BinaryOperatorType op = BinaryOperatorType.None;
ShiftExpr(
-#line 2214 "cs.ATG"
+#line 2209 "cs.ATG"
ref outExpr);
while (StartOf(37)) {
if (StartOf(38)) {
if (la.kind == 23) {
lexer.NextToken();
-#line 2216 "cs.ATG"
+#line 2211 "cs.ATG"
op = BinaryOperatorType.LessThan;
} else if (la.kind == 22) {
lexer.NextToken();
-#line 2217 "cs.ATG"
+#line 2212 "cs.ATG"
op = BinaryOperatorType.GreaterThan;
} else if (la.kind == 36) {
lexer.NextToken();
-#line 2218 "cs.ATG"
+#line 2213 "cs.ATG"
op = BinaryOperatorType.LessThanOrEqual;
} else if (la.kind == 35) {
lexer.NextToken();
-#line 2219 "cs.ATG"
+#line 2214 "cs.ATG"
op = BinaryOperatorType.GreaterThanOrEqual;
} else SynErr(214);
UnaryExpr(
-#line 2221 "cs.ATG"
+#line 2216 "cs.ATG"
out expr);
ShiftExpr(
-#line 2222 "cs.ATG"
+#line 2217 "cs.ATG"
ref expr);
-#line 2223 "cs.ATG"
+#line 2218 "cs.ATG"
outExpr = new BinaryOperatorExpression(outExpr, op, expr);
} else {
if (la.kind == 85) {
lexer.NextToken();
TypeWithRestriction(
-#line 2226 "cs.ATG"
+#line 2221 "cs.ATG"
out type, false, false);
if (
-#line 2227 "cs.ATG"
+#line 2222 "cs.ATG"
la.kind == Tokens.Question && !IsPossibleExpressionStart(Peek(1).kind)) {
NullableQuestionMark(
-#line 2228 "cs.ATG"
+#line 2223 "cs.ATG"
ref type);
}
-#line 2229 "cs.ATG"
+#line 2224 "cs.ATG"
outExpr = new TypeOfIsExpression(outExpr, type);
} else if (la.kind == 50) {
lexer.NextToken();
TypeWithRestriction(
-#line 2231 "cs.ATG"
+#line 2226 "cs.ATG"
out type, false, false);
if (
-#line 2232 "cs.ATG"
+#line 2227 "cs.ATG"
la.kind == Tokens.Question && !IsPossibleExpressionStart(Peek(1).kind)) {
NullableQuestionMark(
-#line 2233 "cs.ATG"
+#line 2228 "cs.ATG"
ref type);
}
-#line 2234 "cs.ATG"
+#line 2229 "cs.ATG"
outExpr = new CastExpression(type, outExpr, CastType.TryCast);
} else SynErr(215);
}
@@ -5395,83 +5390,83 @@ ref type);
}
void ShiftExpr(
-#line 2239 "cs.ATG"
+#line 2234 "cs.ATG"
ref Expression outExpr) {
-#line 2241 "cs.ATG"
+#line 2236 "cs.ATG"
Expression expr;
BinaryOperatorType op = BinaryOperatorType.None;
AdditiveExpr(
-#line 2245 "cs.ATG"
+#line 2240 "cs.ATG"
ref outExpr);
while (la.kind == 37 ||
-#line 2248 "cs.ATG"
+#line 2243 "cs.ATG"
IsShiftRight()) {
if (la.kind == 37) {
lexer.NextToken();
-#line 2247 "cs.ATG"
+#line 2242 "cs.ATG"
op = BinaryOperatorType.ShiftLeft;
} else {
Expect(22);
Expect(22);
-#line 2249 "cs.ATG"
+#line 2244 "cs.ATG"
op = BinaryOperatorType.ShiftRight;
}
UnaryExpr(
-#line 2252 "cs.ATG"
+#line 2247 "cs.ATG"
out expr);
AdditiveExpr(
-#line 2252 "cs.ATG"
+#line 2247 "cs.ATG"
ref expr);
-#line 2252 "cs.ATG"
+#line 2247 "cs.ATG"
outExpr = new BinaryOperatorExpression(outExpr, op, expr);
}
}
void AdditiveExpr(
-#line 2256 "cs.ATG"
+#line 2251 "cs.ATG"
ref Expression outExpr) {
-#line 2258 "cs.ATG"
+#line 2253 "cs.ATG"
Expression expr;
BinaryOperatorType op = BinaryOperatorType.None;
MultiplicativeExpr(
-#line 2262 "cs.ATG"
+#line 2257 "cs.ATG"
ref outExpr);
while (la.kind == 4 || la.kind == 5) {
if (la.kind == 4) {
lexer.NextToken();
-#line 2265 "cs.ATG"
+#line 2260 "cs.ATG"
op = BinaryOperatorType.Add;
} else {
lexer.NextToken();
-#line 2266 "cs.ATG"
+#line 2261 "cs.ATG"
op = BinaryOperatorType.Subtract;
}
UnaryExpr(
-#line 2268 "cs.ATG"
+#line 2263 "cs.ATG"
out expr);
MultiplicativeExpr(
-#line 2268 "cs.ATG"
+#line 2263 "cs.ATG"
ref expr);
-#line 2268 "cs.ATG"
+#line 2263 "cs.ATG"
outExpr = new BinaryOperatorExpression(outExpr, op, expr);
}
}
void MultiplicativeExpr(
-#line 2272 "cs.ATG"
+#line 2267 "cs.ATG"
ref Expression outExpr) {
-#line 2274 "cs.ATG"
+#line 2269 "cs.ATG"
Expression expr;
BinaryOperatorType op = BinaryOperatorType.None;
@@ -5479,82 +5474,82 @@ ref Expression outExpr) {
if (la.kind == 6) {
lexer.NextToken();
-#line 2280 "cs.ATG"
+#line 2275 "cs.ATG"
op = BinaryOperatorType.Multiply;
} else if (la.kind == 7) {
lexer.NextToken();
-#line 2281 "cs.ATG"
+#line 2276 "cs.ATG"
op = BinaryOperatorType.Divide;
} else {
lexer.NextToken();
-#line 2282 "cs.ATG"
+#line 2277 "cs.ATG"
op = BinaryOperatorType.Modulus;
}
UnaryExpr(
-#line 2284 "cs.ATG"
+#line 2279 "cs.ATG"
out expr);
-#line 2284 "cs.ATG"
+#line 2279 "cs.ATG"
outExpr = new BinaryOperatorExpression(outExpr, op, expr);
}
}
void TypeParameterConstraintsClauseBase(
-#line 2390 "cs.ATG"
+#line 2385 "cs.ATG"
out TypeReference type) {
-#line 2391 "cs.ATG"
+#line 2386 "cs.ATG"
TypeReference t; type = null;
if (la.kind == 109) {
lexer.NextToken();
-#line 2393 "cs.ATG"
+#line 2388 "cs.ATG"
type = TypeReference.StructConstraint;
} else if (la.kind == 59) {
lexer.NextToken();
-#line 2394 "cs.ATG"
+#line 2389 "cs.ATG"
type = TypeReference.ClassConstraint;
} else if (la.kind == 89) {
lexer.NextToken();
Expect(20);
Expect(21);
-#line 2395 "cs.ATG"
+#line 2390 "cs.ATG"
type = TypeReference.NewConstraint;
} else if (StartOf(10)) {
Type(
-#line 2396 "cs.ATG"
+#line 2391 "cs.ATG"
out t);
-#line 2396 "cs.ATG"
+#line 2391 "cs.ATG"
type = t;
} else SynErr(216);
}
void QueryExpressionFromClause(
-#line 2411 "cs.ATG"
+#line 2406 "cs.ATG"
out QueryExpressionFromClause fc) {
-#line 2412 "cs.ATG"
+#line 2407 "cs.ATG"
fc = new QueryExpressionFromClause(); fc.StartLocation = la.Location;
Expect(137);
QueryExpressionFromOrJoinClause(
-#line 2416 "cs.ATG"
+#line 2411 "cs.ATG"
fc);
-#line 2417 "cs.ATG"
+#line 2412 "cs.ATG"
fc.EndLocation = t.EndLocation;
}
void QueryExpressionBody(
-#line 2447 "cs.ATG"
+#line 2442 "cs.ATG"
ref QueryExpression q) {
-#line 2448 "cs.ATG"
+#line 2443 "cs.ATG"
QueryExpressionFromClause fromClause; QueryExpressionWhereClause whereClause;
QueryExpressionLetClause letClause; QueryExpressionJoinClause joinClause;
QueryExpressionOrderClause orderClause;
@@ -5563,249 +5558,249 @@ ref QueryExpression q) {
while (StartOf(39)) {
if (la.kind == 137) {
QueryExpressionFromClause(
-#line 2454 "cs.ATG"
+#line 2449 "cs.ATG"
out fromClause);
-#line 2454 "cs.ATG"
+#line 2449 "cs.ATG"
SafeAdd(q, q.MiddleClauses, fromClause);
} else if (la.kind == 127) {
QueryExpressionWhereClause(
-#line 2455 "cs.ATG"
+#line 2450 "cs.ATG"
out whereClause);
-#line 2455 "cs.ATG"
+#line 2450 "cs.ATG"
SafeAdd(q, q.MiddleClauses, whereClause);
} else if (la.kind == 141) {
QueryExpressionLetClause(
-#line 2456 "cs.ATG"
+#line 2451 "cs.ATG"
out letClause);
-#line 2456 "cs.ATG"
+#line 2451 "cs.ATG"
SafeAdd(q, q.MiddleClauses, letClause);
} else if (la.kind == 142) {
QueryExpressionJoinClause(
-#line 2457 "cs.ATG"
+#line 2452 "cs.ATG"
out joinClause);
-#line 2457 "cs.ATG"
+#line 2452 "cs.ATG"
SafeAdd(q, q.MiddleClauses, joinClause);
} else {
QueryExpressionOrderByClause(
-#line 2458 "cs.ATG"
+#line 2453 "cs.ATG"
out orderClause);
-#line 2458 "cs.ATG"
+#line 2453 "cs.ATG"
SafeAdd(q, q.MiddleClauses, orderClause);
}
}
if (la.kind == 133) {
QueryExpressionSelectClause(
-#line 2460 "cs.ATG"
+#line 2455 "cs.ATG"
out selectClause);
-#line 2460 "cs.ATG"
+#line 2455 "cs.ATG"
q.SelectOrGroupClause = selectClause;
} else if (la.kind == 134) {
QueryExpressionGroupClause(
-#line 2461 "cs.ATG"
+#line 2456 "cs.ATG"
out groupClause);
-#line 2461 "cs.ATG"
+#line 2456 "cs.ATG"
q.SelectOrGroupClause = groupClause;
} else SynErr(217);
if (la.kind == 136) {
QueryExpressionIntoClause(
-#line 2463 "cs.ATG"
+#line 2458 "cs.ATG"
ref q);
}
}
void QueryExpressionFromOrJoinClause(
-#line 2437 "cs.ATG"
+#line 2432 "cs.ATG"
QueryExpressionFromOrJoinClause fjc) {
-#line 2438 "cs.ATG"
+#line 2433 "cs.ATG"
TypeReference type; Expression expr;
-#line 2440 "cs.ATG"
+#line 2435 "cs.ATG"
fjc.Type = null;
if (
-#line 2441 "cs.ATG"
+#line 2436 "cs.ATG"
IsLocalVarDecl()) {
Type(
-#line 2441 "cs.ATG"
+#line 2436 "cs.ATG"
out type);
-#line 2441 "cs.ATG"
+#line 2436 "cs.ATG"
fjc.Type = type;
}
Identifier();
-#line 2442 "cs.ATG"
+#line 2437 "cs.ATG"
fjc.Identifier = t.val;
Expect(81);
Expr(
-#line 2444 "cs.ATG"
+#line 2439 "cs.ATG"
out expr);
-#line 2444 "cs.ATG"
+#line 2439 "cs.ATG"
fjc.InExpression = expr;
}
void QueryExpressionJoinClause(
-#line 2420 "cs.ATG"
+#line 2415 "cs.ATG"
out QueryExpressionJoinClause jc) {
-#line 2421 "cs.ATG"
+#line 2416 "cs.ATG"
jc = new QueryExpressionJoinClause(); jc.StartLocation = la.Location;
Expression expr;
Expect(142);
QueryExpressionFromOrJoinClause(
-#line 2426 "cs.ATG"
+#line 2421 "cs.ATG"
jc);
Expect(143);
Expr(
-#line 2428 "cs.ATG"
+#line 2423 "cs.ATG"
out expr);
-#line 2428 "cs.ATG"
+#line 2423 "cs.ATG"
jc.OnExpression = expr;
Expect(144);
Expr(
-#line 2430 "cs.ATG"
+#line 2425 "cs.ATG"
out expr);
-#line 2430 "cs.ATG"
+#line 2425 "cs.ATG"
jc.EqualsExpression = expr;
if (la.kind == 136) {
lexer.NextToken();
Identifier();
-#line 2432 "cs.ATG"
+#line 2427 "cs.ATG"
jc.IntoIdentifier = t.val;
}
-#line 2434 "cs.ATG"
+#line 2429 "cs.ATG"
jc.EndLocation = t.EndLocation;
}
void QueryExpressionWhereClause(
-#line 2466 "cs.ATG"
+#line 2461 "cs.ATG"
out QueryExpressionWhereClause wc) {
-#line 2467 "cs.ATG"
+#line 2462 "cs.ATG"
Expression expr; wc = new QueryExpressionWhereClause(); wc.StartLocation = la.Location;
Expect(127);
Expr(
-#line 2470 "cs.ATG"
+#line 2465 "cs.ATG"
out expr);
-#line 2470 "cs.ATG"
+#line 2465 "cs.ATG"
wc.Condition = expr;
-#line 2471 "cs.ATG"
+#line 2466 "cs.ATG"
wc.EndLocation = t.EndLocation;
}
void QueryExpressionLetClause(
-#line 2474 "cs.ATG"
+#line 2469 "cs.ATG"
out QueryExpressionLetClause wc) {
-#line 2475 "cs.ATG"
+#line 2470 "cs.ATG"
Expression expr; wc = new QueryExpressionLetClause(); wc.StartLocation = la.Location;
Expect(141);
Identifier();
-#line 2478 "cs.ATG"
+#line 2473 "cs.ATG"
wc.Identifier = t.val;
Expect(3);
Expr(
-#line 2480 "cs.ATG"
+#line 2475 "cs.ATG"
out expr);
-#line 2480 "cs.ATG"
+#line 2475 "cs.ATG"
wc.Expression = expr;
-#line 2481 "cs.ATG"
+#line 2476 "cs.ATG"
wc.EndLocation = t.EndLocation;
}
void QueryExpressionOrderByClause(
-#line 2484 "cs.ATG"
+#line 2479 "cs.ATG"
out QueryExpressionOrderClause oc) {
-#line 2485 "cs.ATG"
+#line 2480 "cs.ATG"
QueryExpressionOrdering ordering; oc = new QueryExpressionOrderClause(); oc.StartLocation = la.Location;
Expect(140);
QueryExpressionOrdering(
-#line 2488 "cs.ATG"
+#line 2483 "cs.ATG"
out ordering);
-#line 2488 "cs.ATG"
+#line 2483 "cs.ATG"
SafeAdd(oc, oc.Orderings, ordering);
while (la.kind == 14) {
lexer.NextToken();
QueryExpressionOrdering(
-#line 2490 "cs.ATG"
+#line 2485 "cs.ATG"
out ordering);
-#line 2490 "cs.ATG"
+#line 2485 "cs.ATG"
SafeAdd(oc, oc.Orderings, ordering);
}
-#line 2492 "cs.ATG"
+#line 2487 "cs.ATG"
oc.EndLocation = t.EndLocation;
}
void QueryExpressionSelectClause(
-#line 2505 "cs.ATG"
+#line 2500 "cs.ATG"
out QueryExpressionSelectClause sc) {
-#line 2506 "cs.ATG"
+#line 2501 "cs.ATG"
Expression expr; sc = new QueryExpressionSelectClause(); sc.StartLocation = la.Location;
Expect(133);
Expr(
-#line 2509 "cs.ATG"
+#line 2504 "cs.ATG"
out expr);
-#line 2509 "cs.ATG"
+#line 2504 "cs.ATG"
sc.Projection = expr;
-#line 2510 "cs.ATG"
+#line 2505 "cs.ATG"
sc.EndLocation = t.EndLocation;
}
void QueryExpressionGroupClause(
-#line 2513 "cs.ATG"
+#line 2508 "cs.ATG"
out QueryExpressionGroupClause gc) {
-#line 2514 "cs.ATG"
+#line 2509 "cs.ATG"
Expression expr; gc = new QueryExpressionGroupClause(); gc.StartLocation = la.Location;
Expect(134);
Expr(
-#line 2517 "cs.ATG"
+#line 2512 "cs.ATG"
out expr);
-#line 2517 "cs.ATG"
+#line 2512 "cs.ATG"
gc.Projection = expr;
Expect(135);
Expr(
-#line 2519 "cs.ATG"
+#line 2514 "cs.ATG"
out expr);
-#line 2519 "cs.ATG"
+#line 2514 "cs.ATG"
gc.GroupBy = expr;
-#line 2520 "cs.ATG"
+#line 2515 "cs.ATG"
gc.EndLocation = t.EndLocation;
}
void QueryExpressionIntoClause(
-#line 2523 "cs.ATG"
+#line 2518 "cs.ATG"
ref QueryExpression q) {
-#line 2524 "cs.ATG"
+#line 2519 "cs.ATG"
QueryExpression firstQuery = q;
QueryExpression continuedQuery = new QueryExpression();
continuedQuery.StartLocation = q.StartLocation;
@@ -5820,43 +5815,43 @@ ref QueryExpression q) {
Expect(136);
Identifier();
-#line 2537 "cs.ATG"
+#line 2532 "cs.ATG"
continuedQuery.FromClause.Identifier = t.val;
-#line 2538 "cs.ATG"
+#line 2533 "cs.ATG"
continuedQuery.FromClause.EndLocation = t.EndLocation;
QueryExpressionBody(
-#line 2539 "cs.ATG"
+#line 2534 "cs.ATG"
ref q);
}
void QueryExpressionOrdering(
-#line 2495 "cs.ATG"
+#line 2490 "cs.ATG"
out QueryExpressionOrdering ordering) {
-#line 2496 "cs.ATG"
+#line 2491 "cs.ATG"
Expression expr; ordering = new QueryExpressionOrdering(); ordering.StartLocation = la.Location;
Expr(
-#line 2498 "cs.ATG"
+#line 2493 "cs.ATG"
out expr);
-#line 2498 "cs.ATG"
+#line 2493 "cs.ATG"
ordering.Criteria = expr;
if (la.kind == 138 || la.kind == 139) {
if (la.kind == 138) {
lexer.NextToken();
-#line 2499 "cs.ATG"
+#line 2494 "cs.ATG"
ordering.Direction = QueryExpressionOrderingDirection.Ascending;
} else {
lexer.NextToken();
-#line 2500 "cs.ATG"
+#line 2495 "cs.ATG"
ordering.Direction = QueryExpressionOrderingDirection.Descending;
}
}
-#line 2502 "cs.ATG"
+#line 2497 "cs.ATG"
ordering.EndLocation = t.EndLocation;
}
diff --git a/src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG b/src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG
index 3084b7ba5e..7056dc0f8f 100644
--- a/src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG
+++ b/src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG
@@ -297,12 +297,7 @@ AttributeSection
[ IF (IsLocalAttrTarget())
( "event" (. attributeTarget = "event";.)
| "return" (. attributeTarget = "return";.)
- | Identifier (. if (t.val != "field" && t.val != "method" &&
- t.val != "param" &&
- t.val != "property" && t.val != "type")
- Error("attribute target specifier (field, event, method, param, property, return or type) expected");
- attributeTarget = t.val;
- .)
+ | Identifier (. attributeTarget = t.val; .)
) ":"
]
/*--- attribute list: */
diff --git a/src/Libraries/NRefactory/Test/Parser/Expressions/InvocationExpressionTests.cs b/src/Libraries/NRefactory/Test/Parser/Expressions/InvocationExpressionTests.cs
index 87f3560d24..043a3d0ae2 100644
--- a/src/Libraries/NRefactory/Test/Parser/Expressions/InvocationExpressionTests.cs
+++ b/src/Libraries/NRefactory/Test/Parser/Expressions/InvocationExpressionTests.cs
@@ -117,6 +117,47 @@ namespace ICSharpCode.NRefactory.Tests.Ast
Assert.AreEqual(new Location(4, 1), mre.TargetObject.StartLocation);
Assert.AreEqual(new Location(6, 1), mre.TargetObject.EndLocation);
}
+
+ [Test]
+ public void InvocationOnGenericType()
+ {
+ InvocationExpression expr = ParseUtilCSharp.ParseExpression("A.Foo()");
+ MemberReferenceExpression mre = (MemberReferenceExpression)expr.TargetObject;
+ Assert.AreEqual("Foo", mre.MemberName);
+ TypeReferenceExpression tre = (TypeReferenceExpression)mre.TargetObject;
+ Assert.AreEqual("A", tre.TypeReference.Type);
+ Assert.AreEqual("T", tre.TypeReference.GenericTypes[0].Type);
+ }
+
+ [Test]
+ public void InvocationOnInnerClassInGenericType()
+ {
+ InvocationExpression expr = ParseUtilCSharp.ParseExpression("A.B.Foo()");
+ MemberReferenceExpression mre = (MemberReferenceExpression)expr.TargetObject;
+ Assert.AreEqual("Foo", mre.MemberName);
+ MemberReferenceExpression mre2 = (MemberReferenceExpression)mre.TargetObject;
+ Assert.AreEqual("B", mre2.MemberName);
+ TypeReferenceExpression tre = (TypeReferenceExpression)mre2.TargetObject;
+ Assert.AreEqual("A", tre.TypeReference.Type);
+ Assert.AreEqual("T", tre.TypeReference.GenericTypes[0].Type);
+ }
+
+ [Test]
+ public void InvocationOnGenericInnerClassInGenericType()
+ {
+ InvocationExpression expr = ParseUtilCSharp.ParseExpression("A.B.C.Foo()");
+ MemberReferenceExpression mre = (MemberReferenceExpression)expr.TargetObject;
+ Assert.AreEqual("Foo", mre.MemberName);
+ TypeReferenceExpression tre = (TypeReferenceExpression)mre.TargetObject;
+ InnerClassTypeReference ictr = (InnerClassTypeReference)tre.TypeReference;
+ Assert.AreEqual("B.C", ictr.Type);
+ Assert.AreEqual(1, ictr.GenericTypes.Count);
+ Assert.AreEqual("U", ictr.GenericTypes[0].Type);
+
+ Assert.AreEqual("A", ictr.BaseType.Type);
+ Assert.AreEqual(1, ictr.BaseType.GenericTypes.Count);
+ Assert.AreEqual("T", ictr.BaseType.GenericTypes[0].Type);
+ }
#endregion
#region VB.NET
@@ -145,6 +186,49 @@ namespace ICSharpCode.NRefactory.Tests.Ast
Assert.AreEqual(0, ie.Arguments.Count);
}
+ [Test]
+ public void VBInvocationOnGenericType()
+ {
+ InvocationExpression expr = ParseUtilVBNet.ParseExpression("A(Of T).Foo()");
+ MemberReferenceExpression mre = (MemberReferenceExpression)expr.TargetObject;
+ Assert.AreEqual("Foo", mre.MemberName);
+ IdentifierExpression tre = (IdentifierExpression)mre.TargetObject;
+ Assert.AreEqual("A", tre.Identifier);
+ Assert.AreEqual("T", tre.TypeArguments[0].Type);
+ }
+
+ [Test]
+ public void VBInvocationOnInnerClassInGenericType()
+ {
+ InvocationExpression expr = ParseUtilVBNet.ParseExpression("A(Of T).B.Foo()");
+ MemberReferenceExpression mre = (MemberReferenceExpression)expr.TargetObject;
+ Assert.AreEqual("Foo", mre.MemberName);
+ MemberReferenceExpression mre2 = (MemberReferenceExpression)mre.TargetObject;
+ Assert.AreEqual("B", mre2.MemberName);
+ IdentifierExpression tre = (IdentifierExpression)mre2.TargetObject;
+ Assert.AreEqual("A", tre.Identifier);
+ Assert.AreEqual("T", tre.TypeArguments[0].Type);
+ }
+
+ [Test]
+ public void VBInvocationOnGenericInnerClassInGenericType()
+ {
+ InvocationExpression expr = ParseUtilVBNet.ParseExpression("A(Of T).B.C(Of U).Foo()");
+ MemberReferenceExpression mre = (MemberReferenceExpression)expr.TargetObject;
+ Assert.AreEqual("Foo", mre.MemberName);
+
+ MemberReferenceExpression mre2 = (MemberReferenceExpression)mre.TargetObject;
+ Assert.AreEqual("C", mre2.MemberName);
+ Assert.AreEqual("U", mre2.TypeArguments[0].Type);
+
+ MemberReferenceExpression mre3 = (MemberReferenceExpression)mre2.TargetObject;
+ Assert.AreEqual("B", mre3.MemberName);
+
+ IdentifierExpression tre = (IdentifierExpression)mre3.TargetObject;
+ Assert.AreEqual("A", tre.Identifier);
+ Assert.AreEqual("T", tre.TypeArguments[0].Type);
+ }
+
#endregion
}
}
diff --git a/src/Libraries/NRefactory/Test/Parser/GlobalScope/TypeDeclarationTests.cs b/src/Libraries/NRefactory/Test/Parser/GlobalScope/TypeDeclarationTests.cs
index af7af94e49..e428bae70b 100644
--- a/src/Libraries/NRefactory/Test/Parser/GlobalScope/TypeDeclarationTests.cs
+++ b/src/Libraries/NRefactory/Test/Parser/GlobalScope/TypeDeclarationTests.cs
@@ -179,6 +179,28 @@ public abstract class MyClass : MyBase, Interface1, My.Test.Interface2
Assert.AreEqual(ClassType.Enum, td.Type);
Assert.AreEqual("MyEnum", td.Name);
}
+
+ [Test]
+ public void ContextSensitiveKeywordTest()
+ {
+ TypeDeclaration td = ParseUtilCSharp.ParseGlobal("partial class partial<[partial: where] where> where where : partial { }");
+
+ Assert.AreEqual(Modifiers.Partial, td.Modifier);
+ Assert.AreEqual("partial", td.Name);
+
+ Assert.AreEqual(1, td.Templates.Count);
+ TemplateDefinition tp = td.Templates[0];
+ Assert.AreEqual("where", tp.Name);
+
+ Assert.AreEqual(1, tp.Attributes.Count);
+ Assert.AreEqual("partial", tp.Attributes[0].AttributeTarget);
+ Assert.AreEqual(1, tp.Attributes[0].Attributes.Count);
+ Assert.AreEqual("where", tp.Attributes[0].Attributes[0].Name);
+
+ Assert.AreEqual(1, tp.Bases.Count);
+ Assert.AreEqual("partial", tp.Bases[0].Type);
+ Assert.AreEqual("where", tp.Bases[0].GenericTypes[0].Type);
+ }
#endregion
#region VB.NET
diff --git a/src/Main/Base/Project/Src/Services/RefactoringService/NamespaceRefactoringService.cs b/src/Main/Base/Project/Src/Services/RefactoringService/NamespaceRefactoringService.cs
index caaab50dca..d9755fb07d 100644
--- a/src/Main/Base/Project/Src/Services/RefactoringService/NamespaceRefactoringService.cs
+++ b/src/Main/Base/Project/Src/Services/RefactoringService/NamespaceRefactoringService.cs
@@ -33,7 +33,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring
} else if (!IsSystemNamespace(u1) && IsSystemNamespace(u2)) {
return 1;
}
- return a.Usings[0].CompareTo(b.Usings[0]);
+ return u1.CompareTo(u2);
}
if (a.Aliases.Count != 0 && b.Aliases.Count != 0) {
return a.Aliases.Keys.First().CompareTo(b.Aliases.Keys.First());
@@ -96,6 +96,17 @@ namespace ICSharpCode.SharpDevelop.Refactoring
public static void AddUsingDeclaration(ICompilationUnit cu, IDocument document, string newNamespace, bool sortExistingUsings)
{
+ if (cu == null)
+ throw new ArgumentNullException("cu");
+ if (document == null)
+ throw new ArgumentNullException("document");
+ if (newNamespace == null)
+ throw new ArgumentNullException("newNamespace");
+
+ ParseInformation info = ParserService.ParseFile(cu.FileName, document);
+ if (info != null)
+ cu = info.CompilationUnit;
+
IUsing newUsingDecl = new DefaultUsing(cu.ProjectContent);
newUsingDecl.Usings.Add(newNamespace);
@@ -105,9 +116,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring
}
bool inserted = false;
for (int i = 0; i < newUsings.Count; i++) {
- if (newUsings[i].Usings.Count >= 1
- && cu.ProjectContent.Language.NameComparer.Compare(newNamespace, newUsings[i].Usings[0]) <= 0)
- {
+ if (CompareUsings(newUsingDecl, newUsings[i]) <= 0) {
newUsings.Insert(i, newUsingDecl);
inserted = true;
break;
diff --git a/src/Main/Base/Project/Src/Services/RefactoringService/RefactoringMenuBuilder.cs b/src/Main/Base/Project/Src/Services/RefactoringService/RefactoringMenuBuilder.cs
index 188a75842e..67959ce270 100644
--- a/src/Main/Base/Project/Src/Services/RefactoringService/RefactoringMenuBuilder.cs
+++ b/src/Main/Base/Project/Src/Services/RefactoringService/RefactoringMenuBuilder.cs
@@ -196,6 +196,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring
item.Items.Add(subItem);
subItem.Click += delegate {
NamespaceRefactoringService.AddUsingDeclaration(callingClass.CompilationUnit, textArea.Document, newNamespace, true);
+ ParserService.BeginParse(textArea.FileName, textArea.Document);
};
}
return item;
diff --git a/src/Main/Base/Project/Src/TextEditor/Commands/ClassMemberMenuBuilder.cs b/src/Main/Base/Project/Src/TextEditor/Commands/ClassMemberMenuBuilder.cs
index f8260c37c9..b43c33afb1 100644
--- a/src/Main/Base/Project/Src/TextEditor/Commands/ClassMemberMenuBuilder.cs
+++ b/src/Main/Base/Project/Src/TextEditor/Commands/ClassMemberMenuBuilder.cs
@@ -52,7 +52,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Commands
member.DeclaringType.ProjectContent.Language.CodeGenerator != null
&& !FindReferencesAndRenameHelper.IsReadOnly(member.DeclaringType);
- if (method == null || !method.IsConstructor) {
+ if (method == null || !method.IsConstructor && !method.IsOperator) {
if (!FindReferencesAndRenameHelper.IsReadOnly(member.DeclaringType) &&
!(member is IProperty && ((IProperty)member).IsIndexer)) {
cmd = new MenuCommand("${res:SharpDevelop.Refactoring.RenameCommand}", Rename);
diff --git a/src/Main/Base/Project/Src/TextEditor/Gui/Editor/InsightWindow/MethodInsightDataProvider.cs b/src/Main/Base/Project/Src/TextEditor/Gui/Editor/InsightWindow/MethodInsightDataProvider.cs
index 6841b42d75..96fa0f47c3 100644
--- a/src/Main/Base/Project/Src/TextEditor/Gui/Editor/InsightWindow/MethodInsightDataProvider.cs
+++ b/src/Main/Base/Project/Src/TextEditor/Gui/Editor/InsightWindow/MethodInsightDataProvider.cs
@@ -144,11 +144,6 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
if (trr != null || expressionResult.Context == ExpressionContext.BaseConstructorCall) {
if (results.ResolvedType != null) {
methods.AddRange(GetConstructorMethods(results.ResolvedType.GetMethods()));
- IClass resolvedClass = (trr != null) ? trr.ResolvedClass : results.ResolvedType.GetUnderlyingClass();
- if (methods.Count == 0 && resolvedClass != null && !resolvedClass.IsStatic) {
- // add default constructor
- methods.Add(Constructor.CreateDefault(resolvedClass));
- }
}
}
} else {
diff --git a/src/Main/Base/Test/GenerateOverrideMethodTests.cs b/src/Main/Base/Test/GenerateOverrideMethodTests.cs
index b6a990dff8..ef8e594cdb 100644
--- a/src/Main/Base/Test/GenerateOverrideMethodTests.cs
+++ b/src/Main/Base/Test/GenerateOverrideMethodTests.cs
@@ -6,6 +6,7 @@
//
using System;
+using System.Linq;
using ICSharpCode.NRefactory.Ast;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Dom.Refactoring;
@@ -28,10 +29,10 @@ namespace ICSharpCode.SharpDevelop.Tests
Assert.AreEqual(2, cu.Classes.Count);
Assert.AreEqual(1, cu.Classes[0].Methods.Count + cu.Classes[0].Properties.Count);
IMember virtualMember;
- if (cu.Classes[0].Methods.Count > 0)
- virtualMember = cu.Classes[0].Methods[0];
- else //if (cu.Classes[0].Properties.Count > 0)
+ if (cu.Classes[0].Properties.Count > 0)
virtualMember = cu.Classes[0].Properties[0];
+ else
+ virtualMember = cu.Classes[0].Methods[0];
CSharpCodeGenerator ccg = new CSharpCodeGenerator();
AttributedNode result = ccg.GetOverridingMethod(virtualMember, new ClassFinder(cu.Classes[1], 3, 1));
Assert.IsNotNull(result);
diff --git a/src/Main/Base/Test/NRefactoryResolverTests.cs b/src/Main/Base/Test/NRefactoryResolverTests.cs
index 2bc86599de..eff41f3333 100644
--- a/src/Main/Base/Test/NRefactoryResolverTests.cs
+++ b/src/Main/Base/Test/NRefactoryResolverTests.cs
@@ -579,11 +579,50 @@ class A {
IMethod m = (IMethod)result.ResolvedMember;
Assert.IsNotNull(m);
Assert.AreEqual("A", result.ResolvedType.FullyQualifiedName);
+ Assert.AreEqual(0, m.Parameters.Count);
var ar = result.GetCompletionData(result.CallingClass.ProjectContent);
Assert.IsTrue(ContainsMember(ar, "A.Method"));
}
+ [Test]
+ public void DefaultStructCTorOverloadLookupTest()
+ {
+ string program = @"struct A {
+ void Method() {
+
+ }
+
+ public A(int x) {}
+}
+";
+ MemberResolveResult result = Resolve(program, "new A()", 3);
+ IMethod m = (IMethod)result.ResolvedMember;
+ Assert.IsNotNull(m);
+ Assert.AreEqual("A", result.ResolvedType.FullyQualifiedName);
+ Assert.AreEqual(0, m.Parameters.Count);
+
+ var ar = result.GetCompletionData(result.CallingClass.ProjectContent);
+ Assert.IsTrue(ContainsMember(ar, "A.Method"));
+ }
+
+ [Test]
+ public void ReflectionStructCTorOverloadLookupTest()
+ {
+ string program = @"using System;
+class A {
+ void Method() {
+
+ }
+}
+";
+ MemberResolveResult result = Resolve(program, "new DateTime()", 4);
+ IMethod m = (IMethod)result.ResolvedMember;
+ Assert.IsNotNull(m);
+ Assert.AreEqual("System.DateTime", result.ResolvedType.FullyQualifiedName);
+ Assert.AreEqual(0, m.Parameters.Count);
+ }
+
[Test]
public void ValueInsideSetterTest()
{
diff --git a/src/Main/Base/Test/ReflectionLayerTests.cs b/src/Main/Base/Test/ReflectionLayerTests.cs
index 96d572ae01..fd36f4d2e3 100644
--- a/src/Main/Base/Test/ReflectionLayerTests.cs
+++ b/src/Main/Base/Test/ReflectionLayerTests.cs
@@ -171,6 +171,22 @@ namespace ICSharpCode.SharpDevelop.Tests
Assert.AreEqual("System.Void", prt.BaseType.FullyQualifiedName);
}
+ [Test]
+ public void DateTimeDefaultConstructor()
+ {
+ IClass c = mscorlib.GetClass("System.DateTime", 0);
+ Assert.IsFalse(c.Methods.Any(p => p.IsConstructor && p.Parameters.Count == 0));
+ Assert.IsTrue(c.GetAddDefaultConstructorIfRequired());
+ }
+
+ [Test]
+ public void NoEncodingInfoDefaultConstructor()
+ {
+ IClass c = mscorlib.GetClass("System.Text.EncodingInfo", 0);
+ Assert.IsFalse(c.Methods.Any(p => p.IsConstructor)); // EncodingInfo only has an internal constructor
+ Assert.IsFalse(c.GetAddDefaultConstructorIfRequired());
+ }
+
[Test]
public void ParameterComparisonTest()
{
diff --git a/src/Main/Core/Project/Src/Services/FileUtility/FileUtility.cs b/src/Main/Core/Project/Src/Services/FileUtility/FileUtility.cs
index 5c045898cb..d78f30e602 100644
--- a/src/Main/Core/Project/Src/Services/FileUtility/FileUtility.cs
+++ b/src/Main/Core/Project/Src/Services/FileUtility/FileUtility.cs
@@ -131,6 +131,19 @@ namespace ICSharpCode.Core
}
}
+ static string windowsSdk70InstallRoot = null;
+ ///
+ /// Location of the .NET 3.5 SP1 SDK (Windows SDK 7.0) install root.
+ ///
+ public static string WindowsSdk70InstallRoot {
+ get {
+ if (windowsSdk70InstallRoot == null) {
+ windowsSdk70InstallRoot = GetPathFromRegistry(@"SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0", "InstallationFolder") ?? string.Empty;
+ }
+ return windowsSdk70InstallRoot;
+ }
+ }
+
#endregion
public static string Combine(params string[] paths)
@@ -187,6 +200,10 @@ namespace ICSharpCode.Core
/// The path of the executable, or null if the exe is not found.
public static string GetSdkPath(string exeName) {
string execPath;
+ if (!string.IsNullOrEmpty(WindowsSdk70InstallRoot)) {
+ execPath = Path.Combine(WindowsSdk70InstallRoot, "bin\\" + exeName);
+ if (File.Exists(execPath)) { return execPath; }
+ }
if (!string.IsNullOrEmpty(WindowsSdk61InstallRoot)) {
execPath = Path.Combine(WindowsSdk61InstallRoot, "bin\\" + exeName);
if (File.Exists(execPath)) { return execPath; }
diff --git a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/CSharp/CSharpAmbience.cs b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/CSharp/CSharpAmbience.cs
index 8b6c30ab79..d295c7f050 100644
--- a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/CSharp/CSharpAmbience.cs
+++ b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/CSharp/CSharpAmbience.cs
@@ -534,6 +534,8 @@ namespace ICSharpCode.SharpDevelop.Dom.CSharp
static IReturnType GetElementType(IReturnType potentialArrayType)
{
+ if (potentialArrayType == null)
+ return null;
ArrayReturnType result;
while ((result = potentialArrayType.CastToArrayReturnType()) != null) {
potentialArrayType = result.ArrayElementType;
diff --git a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/CecilReader.cs b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/CecilReader.cs
index 41d2e73566..01e54df0e3 100644
--- a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/CecilReader.cs
+++ b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/CecilReader.cs
@@ -324,6 +324,7 @@ namespace ICSharpCode.SharpDevelop.Dom
foreach (MethodDefinition method in type.Constructors) {
AddMethod(method);
}
+ this.AddDefaultConstructorIfRequired = (this.ClassType == ClassType.Struct || this.ClassType == ClassType.Enum);
foreach (MethodDefinition method in type.Methods) {
if (!method.IsSpecialName) {
AddMethod(method);
diff --git a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/CompoundClass.cs b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/CompoundClass.cs
index bb9db4fab9..5e44a5bfdb 100644
--- a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/CompoundClass.cs
+++ b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/CompoundClass.cs
@@ -107,6 +107,8 @@ namespace ICSharpCode.SharpDevelop.Dom
this.Properties.AddRange(part.Properties);
this.Events.AddRange(part.Events);
this.Fields.AddRange(part.Fields);
+
+ this.AddDefaultConstructorIfRequired |= part.GetAddDefaultConstructorIfRequired();
}
this.CompilationUnit.FileName = shortestFileName;
if ((modifier & ModifierEnum.VisibilityMask) == ModifierEnum.None) {
diff --git a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/DefaultClass.cs b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/DefaultClass.cs
index ea6a9df3a1..cb8653b2fe 100644
--- a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/DefaultClass.cs
+++ b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/DefaultClass.cs
@@ -12,7 +12,7 @@ using System.Threading;
namespace ICSharpCode.SharpDevelop.Dom
{
- public class DefaultClass : AbstractEntity, IClass, IComparable
+ public class DefaultClass : AbstractEntity, IClass2, IComparable
{
ClassType classType;
DomRegion region;
@@ -64,13 +64,16 @@ namespace ICSharpCode.SharpDevelop.Dom
}
*/
- byte flags;
+ byte flags = addDefaultConstructorIfRequiredFlag;
+ const byte calculatedFlagsReady = 0x01;
const byte hasPublicOrInternalStaticMembersFlag = 0x02;
const byte hasExtensionMethodsFlag = 0x04;
- internal byte Flags {
+ const byte addDefaultConstructorIfRequiredFlag = 0x08;
+
+ internal byte CalculatedFlags {
get {
- if (flags == 0) {
- flags = 1;
+ if ((flags & calculatedFlagsReady) == 0) {
+ flags |= calculatedFlagsReady;
foreach (IMember m in this.Fields) {
if (m.IsStatic && (m.IsPublic || m.IsInternal)) {
flags |= hasPublicOrInternalStaticMembersFlag;
@@ -112,12 +115,23 @@ namespace ICSharpCode.SharpDevelop.Dom
}
public bool HasPublicOrInternalStaticMembers {
get {
- return (Flags & hasPublicOrInternalStaticMembersFlag) == hasPublicOrInternalStaticMembersFlag;
+ return (CalculatedFlags & hasPublicOrInternalStaticMembersFlag) == hasPublicOrInternalStaticMembersFlag;
}
}
public bool HasExtensionMethods {
get {
- return (Flags & hasExtensionMethodsFlag) == hasExtensionMethodsFlag;
+ return (CalculatedFlags & hasExtensionMethodsFlag) == hasExtensionMethodsFlag;
+ }
+ }
+ public bool AddDefaultConstructorIfRequired {
+ get {
+ return (flags & addDefaultConstructorIfRequiredFlag) == addDefaultConstructorIfRequiredFlag;
+ }
+ set {
+ if (value)
+ flags |= addDefaultConstructorIfRequiredFlag;
+ else
+ flags &= unchecked((byte)~addDefaultConstructorIfRequiredFlag);
}
}
diff --git a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/DefaultMethod.cs b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/DefaultMethod.cs
index 91f11f435d..ea33e5bd61 100644
--- a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/DefaultMethod.cs
+++ b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/DefaultMethod.cs
@@ -7,6 +7,7 @@
using System;
using System.Collections.Generic;
+using System.Linq;
using System.Text;
namespace ICSharpCode.SharpDevelop.Dom
@@ -36,7 +37,13 @@ namespace ICSharpCode.SharpDevelop.Dom
if (c == null)
throw new ArgumentNullException("c");
- Constructor con = new Constructor(ModifierEnum.Public, c.Region, c.Region, c);
+ ModifierEnum modifiers = ModifierEnum.Synthetic;
+ if (c.IsAbstract)
+ modifiers |= ModifierEnum.Protected;
+ else
+ modifiers |= ModifierEnum.Public;
+ DomRegion region = new DomRegion(c.Region.BeginLine, c.Region.BeginColumn, c.Region.BeginLine, c.Region.BeginColumn);
+ Constructor con = new Constructor(modifiers, region, region, c);
con.Documentation = "Default constructor of " + c.Name;
return con;
}
diff --git a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/DefaultReturnType.cs b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/DefaultReturnType.cs
index e9c8442a79..ce8709545a 100644
--- a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/DefaultReturnType.cs
+++ b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Implementations/DefaultReturnType.cs
@@ -81,6 +81,16 @@ namespace ICSharpCode.SharpDevelop.Dom
using (var busyLock = busyManager.Enter(this)) {
if (busyLock.Success) {
l.AddRange(c.Methods);
+ if (c.GetAddDefaultConstructorIfRequired() && !c.IsStatic) {
+ // A constructor is added for classes that do not have a default constructor;
+ // and for all structs.
+ if (c.ClassType == ClassType.Class && !l.Exists(m => m.IsConstructor)) {
+ l.Add(Constructor.CreateDefault(c));
+ } else if (c.ClassType == ClassType.Struct || c.ClassType == ClassType.Enum) {
+ l.Add(Constructor.CreateDefault(c));
+ }
+ }
+
if (c.ClassType == ClassType.Interface) {
if (c.BaseTypes.Count == 0) {
AddMethodsFromBaseType(l, c.ProjectContent.SystemTypes.Object);
diff --git a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Interfaces/IClass.cs b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Interfaces/IClass.cs
index c2fa52a8cd..2b53ed5f19 100644
--- a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Interfaces/IClass.cs
+++ b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Interfaces/IClass.cs
@@ -148,4 +148,30 @@ namespace ICSharpCode.SharpDevelop.Dom
/////
//IClass Unfreeze();
}
+
+ public interface IClass2 : IClass
+ {
+ ///
+ /// Gets whether a default constructor should be added to this class if it is required.
+ /// Such automatic default constructors will not appear in IClass.Methods, but will be present
+ /// in IClass.DefaultReturnType.GetMethods().
+ ///
+ /// This way of creating the default constructor is necessary because
+ /// we cannot create it directly in the IClass - we need to consider partial classes.
+ bool AddDefaultConstructorIfRequired {
+ get;
+ }
+ }
+
+ public static class Class2Compatibility
+ {
+ public static bool GetAddDefaultConstructorIfRequired(this IClass c)
+ {
+ IClass2 c2 = c as IClass2;
+ if (c2 != null)
+ return c2.AddDefaultConstructorIfRequired;
+ else
+ return false;
+ }
+ }
}
diff --git a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/NRefactoryResolver/ResolveVisitor.cs b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/NRefactoryResolver/ResolveVisitor.cs
index f85efb3821..a51d1eef59 100644
--- a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/NRefactoryResolver/ResolveVisitor.cs
+++ b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/NRefactoryResolver/ResolveVisitor.cs
@@ -444,11 +444,6 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
bool resultIsAcceptable;
IMethod result = MemberLookupHelper.FindOverload(methods, argumentTypes, out resultIsAcceptable);
- if (result == null) {
- IClass c = rt.GetUnderlyingClass();
- if (c != null)
- result = Constructor.CreateDefault(c);
- }
ResolveResult rr = CreateMemberResolveResult(result);
if (rr != null)
rr.ResolvedType = rt;
diff --git a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/ReflectionLayer/DomPersistence.cs b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/ReflectionLayer/DomPersistence.cs
index 5ce179a497..3dcdaad875 100644
--- a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/ReflectionLayer/DomPersistence.cs
+++ b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/ReflectionLayer/DomPersistence.cs
@@ -20,7 +20,7 @@ namespace ICSharpCode.SharpDevelop.Dom
{
public const long FileMagic = 0x11635233ED2F428C;
public const long IndexFileMagic = 0x11635233ED2F427D;
- public const short FileVersion = 24;
+ public const short FileVersion = 25;
ProjectContentRegistry registry;
string cacheDirectory;
@@ -384,7 +384,7 @@ namespace ICSharpCode.SharpDevelop.Dom
}
writer.Write((int)c.Modifiers);
if (c is DefaultClass) {
- writer.Write(((DefaultClass)c).Flags);
+ writer.Write(((DefaultClass)c).CalculatedFlags);
} else {
writer.Write((byte)0);
}
@@ -453,7 +453,7 @@ namespace ICSharpCode.SharpDevelop.Dom
c.BaseTypes.Add(ReadType());
}
c.Modifiers = (ModifierEnum)reader.ReadInt32();
- c.Flags = reader.ReadByte();
+ c.CalculatedFlags = reader.ReadByte();
c.ClassType = (ClassType)reader.ReadByte();
ReadAttributes(c);
count = reader.ReadInt32();
diff --git a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/ReflectionLayer/ReflectionClass.cs b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/ReflectionLayer/ReflectionClass.cs
index 1cd06d01d3..dff9d6ba6b 100644
--- a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/ReflectionLayer/ReflectionClass.cs
+++ b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/ReflectionLayer/ReflectionClass.cs
@@ -55,6 +55,7 @@ namespace ICSharpCode.SharpDevelop.Dom.ReflectionLayer
Methods.Add(new ReflectionMethod(methodInfo, this));
}
}
+ this.AddDefaultConstructorIfRequired = (this.ClassType == ClassType.Struct || this.ClassType == ClassType.Enum);
foreach (EventInfo eventInfo in type.GetEvents(flags)) {
Events.Add(new ReflectionEvent(eventInfo, this));
diff --git a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/VBNet/VBNetAmbience.cs b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/VBNet/VBNetAmbience.cs
index b5502c139d..0fc70994e9 100644
--- a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/VBNet/VBNetAmbience.cs
+++ b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/VBNet/VBNetAmbience.cs
@@ -552,6 +552,8 @@ namespace ICSharpCode.SharpDevelop.Dom.VBNet
static IReturnType GetElementType(IReturnType potentialArrayType)
{
+ if (potentialArrayType == null)
+ return null;
ArrayReturnType result;
while ((result = potentialArrayType.CastToArrayReturnType()) != null) {
potentialArrayType = result.ArrayElementType;
diff --git a/src/Main/ICSharpCode.SharpDevelop.Dom/Tests/ICSharpCode.SharpDevelop.Dom.Tests/NRefactoryAstConverterTests.cs b/src/Main/ICSharpCode.SharpDevelop.Dom/Tests/ICSharpCode.SharpDevelop.Dom.Tests/NRefactoryAstConverterTests.cs
index e720318568..da9c1a5ad8 100644
--- a/src/Main/ICSharpCode.SharpDevelop.Dom/Tests/ICSharpCode.SharpDevelop.Dom.Tests/NRefactoryAstConverterTests.cs
+++ b/src/Main/ICSharpCode.SharpDevelop.Dom/Tests/ICSharpCode.SharpDevelop.Dom.Tests/NRefactoryAstConverterTests.cs
@@ -6,6 +6,7 @@
//
using System;
+using System.Collections.Generic;
using System.Linq;
using System.IO;
using ICSharpCode.NRefactory;
@@ -242,5 +243,67 @@ class Outer where T1 : IDisposable {
Assert.AreSame(inner.TypeParameters[1], method.TypeParameters[0].Constraints[0].CastToGenericReturnType().TypeParameter);
}
+
+ [Test]
+ public void DefaultConstructorTest()
+ {
+ ICompilationUnit cu = Parse("class X { }", SupportedLanguage.CSharp, true);
+
+ Assert.AreEqual(0, cu.Classes[0].Methods.Count);
+
+ IMethod ctor = cu.Classes[0].DefaultReturnType.GetMethods().Single(m => m.IsConstructor);
+ Assert.AreEqual(ModifierEnum.Public | ModifierEnum.Synthetic, ctor.Modifiers);
+ Assert.AreEqual(0, ctor.Parameters.Count);
+ }
+
+ [Test]
+ public void DefaultConstructorOnAbstractClassTest()
+ {
+ ICompilationUnit cu = Parse("abstract class X { }", SupportedLanguage.CSharp, true);
+
+ Assert.AreEqual(0, cu.Classes[0].Methods.Count);
+
+ IMethod ctor = cu.Classes[0].DefaultReturnType.GetMethods().Single(m => m.IsConstructor);
+ Assert.AreEqual(ModifierEnum.Protected | ModifierEnum.Synthetic, ctor.Modifiers);
+ Assert.AreEqual(0, ctor.Parameters.Count);
+ }
+
+ [Test]
+ public void NoDefaultConstructorWithExplicitConstructorTest()
+ {
+ ICompilationUnit cu = Parse("class X { private X(int a) {} }", SupportedLanguage.CSharp, true);
+
+ Assert.AreEqual(1, cu.Classes[0].Methods.Count);
+
+ IMethod ctor = cu.Classes[0].DefaultReturnType.GetMethods().Single(m => m.IsConstructor);
+ Assert.AreEqual(ModifierEnum.Private, ctor.Modifiers);
+ Assert.AreEqual(1, ctor.Parameters.Count);
+ }
+
+ [Test]
+ public void DefaultConstructorWithExplicitConstructorOnStructTest()
+ {
+ ICompilationUnit cu = Parse("struct X { private X(int a) {} }", SupportedLanguage.CSharp, true);
+
+ Assert.AreEqual(1, cu.Classes[0].Methods.Count);
+
+ List ctors = cu.Classes[0].DefaultReturnType.GetMethods().FindAll(m => m.IsConstructor);
+ Assert.AreEqual(2, ctors.Count);
+
+ Assert.AreEqual(ModifierEnum.Private, ctors[0].Modifiers);
+ Assert.AreEqual(1, ctors[0].Parameters.Count);
+
+ Assert.AreEqual(ModifierEnum.Public | ModifierEnum.Synthetic, ctors[1].Modifiers);
+ Assert.AreEqual(0, ctors[1].Parameters.Count);
+ }
+
+ [Test]
+ public void NoDefaultConstructorOnStaticClassTest()
+ {
+ ICompilationUnit cu = Parse("static class X { }", SupportedLanguage.CSharp, true);
+
+ Assert.AreEqual(0, cu.Classes[0].Methods.Count);
+ Assert.IsFalse(cu.Classes[0].DefaultReturnType.GetMethods().Any(m => m.IsConstructor));
+ }
}
}