mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
java: beware not to alias the locations of the various symbols
* examples/java/calc/Calc.y, tests/calc.at, tests/local.at (getStartPos, getEndPos): Always return a new object. * doc/bison.texi: Clarify this.
This commit is contained in:
@@ -99,11 +99,11 @@ class CalcLexer implements Calc.Lexer {
|
||||
Position end = new Position (1, 0);
|
||||
|
||||
public Position getStartPos () {
|
||||
return start;
|
||||
return new Position (start);
|
||||
}
|
||||
|
||||
public Position getEndPos () {
|
||||
return end;
|
||||
return new Position (end);
|
||||
}
|
||||
|
||||
public void yyreportSyntaxError (Calc.Context ctx)
|
||||
@@ -175,6 +175,12 @@ class Position {
|
||||
column = t;
|
||||
}
|
||||
|
||||
public Position (Position p)
|
||||
{
|
||||
line = p.line;
|
||||
column = p.column;
|
||||
}
|
||||
|
||||
public void set (Position p)
|
||||
{
|
||||
line = p.line;
|
||||
|
||||
Reference in New Issue
Block a user