nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
parser: node locations are not nullable
[nit.git]
/
src
/
parser
/
parser_nodes.nit
diff --git
a/src/parser/parser_nodes.nit
b/src/parser/parser_nodes.nit
index
c9fde5e
..
36c5ceb
100644
(file)
--- a/
src/parser/parser_nodes.nit
+++ b/
src/parser/parser_nodes.nit
@@
-23,7
+23,10
@@
import mmloader
# Root of the AST hierarchy
abstract class ANode
# Root of the AST hierarchy
abstract class ANode
- readable var _location: nullable Location
+ var _location: nullable Location
+ # Location is set during AST building. Once built, location cannon be null
+ # However, manual instanciated nodes may need mode care
+ fun location: Location do return _location.as(not null)
end
# Ancestor of all tokens
end
# Ancestor of all tokens
@@
-34,7
+37,7
@@
end
# Ancestor of all productions
abstract class Prod
special ANode
# Ancestor of all productions
abstract class Prod
special ANode
- fun location=(loc: nullable Location) do _location = loc
+ fun location=(l: Location) do _location = l
end
class TEol
special Token
end
class TEol
special Token