forked from icsharpcode/NRefactory
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge NRefactory changes from the SharpDevelop repository.
Includes Siegfried's work on the output visitor (ITokenWriter) and some minor bugfixes.
- Loading branch information
Showing
26 changed files
with
1,482 additions
and
791 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// | ||
// NullReferenceExpression.cs | ||
// | ||
// | ||
// Author: | ||
// Mike Krüger <[email protected]> | ||
// | ||
|
@@ -38,6 +38,12 @@ public override TextLocation StartLocation { | |
} | ||
} | ||
|
||
internal void SetStartLocation(TextLocation value) | ||
{ | ||
ThrowIfFrozen(); | ||
this.location = value; | ||
} | ||
|
||
public override TextLocation EndLocation { | ||
get { | ||
return new TextLocation (location.Line, location.Column + "null".Length); | ||
|
@@ -57,7 +63,7 @@ public override void AcceptVisitor (IAstVisitor visitor) | |
{ | ||
visitor.VisitNullReferenceExpression (this); | ||
} | ||
|
||
public override T AcceptVisitor<T> (IAstVisitor<T> visitor) | ||
{ | ||
return visitor.VisitNullReferenceExpression (this); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// | ||
// PrimitiveExpression.cs | ||
// | ||
// | ||
// Author: | ||
// Mike Krüger <[email protected]> | ||
// | ||
|
@@ -42,13 +42,20 @@ public override TextLocation StartLocation { | |
} | ||
} | ||
|
||
internal void SetStartLocation(TextLocation value) | ||
{ | ||
ThrowIfFrozen(); | ||
this.startLocation = value; | ||
this.endLocation = null; | ||
} | ||
|
||
string literalValue; | ||
TextLocation? endLocation; | ||
public override TextLocation EndLocation { | ||
get { | ||
if (!endLocation.HasValue) { | ||
endLocation = value is string ? AdvanceLocation (StartLocation, literalValue) : | ||
new TextLocation (StartLocation.Line, StartLocation.Column + literalValue.Length); | ||
endLocation = value is string ? AdvanceLocation (StartLocation, literalValue ?? "") : | ||
new TextLocation (StartLocation.Line, StartLocation.Column + (literalValue ?? "").Length); | ||
} | ||
return endLocation.Value; | ||
} | ||
|
@@ -58,46 +65,56 @@ public override TextLocation EndLocation { | |
|
||
public object Value { | ||
get { return this.value; } | ||
set { | ||
ThrowIfFrozen(); | ||
set { | ||
ThrowIfFrozen(); | ||
this.value = value; | ||
literalValue = null; | ||
} | ||
} | ||
|
||
/// <remarks>Never returns null.</remarks> | ||
public string LiteralValue { | ||
get { return literalValue ?? ""; } | ||
} | ||
|
||
/// <remarks>Can be null.</remarks> | ||
public string UnsafeLiteralValue { | ||
get { return literalValue; } | ||
set { | ||
if (value == null) | ||
throw new ArgumentNullException(); | ||
ThrowIfFrozen(); | ||
literalValue = value; | ||
} | ||
} | ||
|
||
public void SetValue(object value, string literalValue) | ||
{ | ||
if (value == null) | ||
throw new ArgumentNullException(); | ||
ThrowIfFrozen(); | ||
this.value = value; | ||
this.literalValue = literalValue; | ||
} | ||
|
||
public PrimitiveExpression (object value) | ||
{ | ||
this.Value = value; | ||
this.literalValue = ""; | ||
this.literalValue = null; | ||
} | ||
|
||
public PrimitiveExpression (object value, string literalValue) | ||
{ | ||
this.Value = value; | ||
this.literalValue = literalValue ?? ""; | ||
this.literalValue = literalValue; | ||
} | ||
|
||
public PrimitiveExpression (object value, TextLocation startLocation, string literalValue) | ||
{ | ||
this.Value = value; | ||
this.startLocation = startLocation; | ||
this.literalValue = literalValue ?? ""; | ||
this.literalValue = literalValue; | ||
} | ||
|
||
public override void AcceptVisitor (IAstVisitor visitor) | ||
{ | ||
visitor.VisitPrimitiveExpression (this); | ||
} | ||
|
||
public override T AcceptVisitor<T> (IAstVisitor<T> visitor) | ||
{ | ||
return visitor.VisitPrimitiveExpression (this); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.