[Mono-devel-list] mcs patch for precise location handling

Marek Safar marek.safar at seznam.cz
Tue Jun 28 08:38:33 EDT 2005

Hello Eno,

That is massive ;-)
In the most cases we don't need to pass Location as extra parameter now.
It would be nice to remove also this redundant casts and arguments.
For example.

$$ = new ComposedCast ((Expression) $1, "*", ((Expression) $1).Location);


$$ = new Invocation ((Expression) $1, args, ((Expression) $1).Location);

replaced by

$$ = new ComposedCast ((Expression) $1, "*");

$$ = new Invocation ((Expression) $1, args)


>I once posted a patch but it seems waiting for approval and
>Miguel still could not see, so am reposting the message without
>patch. The patch itself is here:
>Here is the latest mcs patch for precise location handling. With
>this patch mcs reports
>	- the column number as well as line number, and
>	- the line number which is not shifted to next token
>	  (you would have seen mcs reporting "next line" to the
>	   actual related line number).
>As long as I tested it does not fail under mcs/tests and mcs/errors.
>This patch sadly has a bad side effect that it increases memory
>consumption than before. Here are the profile results for
>building sys.xml (I ran "make BOOTSTRAP_MCS="mono ../../mcs/mcs.exe"):
>For summary, total memory consumption became 77765 KB from 74023 KB.
>For the change details (will form ChangeLog):
>	- I added Column support in location.cs that is originally
>	  suggested by Ben (checkpoints) last year, and added
>	  Location to MemberName to store location for identifiers.
>	- I changed tokenizer to return Location for keywords, and
>	  new "LocatedToken" for IDENTIFIERS, unary operators and
>	  some symbols such as SEMICOLON. And modified cs-parser.jay
>	  to cast correct types (especially for IDENTIFIERS).
>	- I replaced most of "lexer.Location" with
>	  corresponding locations. I also removed "_mark_" hack in
>	  cs-parser.jay and shifted some item numbers in the rules.
>(Ben and Miguel: there are some changes since the last patch you
>guys might have seen: unary operators return Location in tokenizer,
>and I removed _mark_ in cs-parser.jay.)
>There are still a few things I cannot remove lexer.Location and thus
>for them it still reports "shifted" location (but with column).
>I'll clarify more if any of them are not clear.
>Atsushi Eno
>Mono-devel-list mailing list
>Mono-devel-list at lists.ximian.com

More information about the Mono-devel-list mailing list