nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lib: intro `prompt`, basic Apache 2.0 service to display a prompt
[nit.git]
/
src
/
astprinter.nit
diff --git
a/src/astprinter.nit
b/src/astprinter.nit
index
e0aceee
..
91aee2f
100644
(file)
--- a/
src/astprinter.nit
+++ b/
src/astprinter.nit
@@
-41,21
+41,12
@@
private class ASTPrinterVisitor
has_eol = true
end
has_eol = true
end
- var last_current: nullable ANode
+ var last_current: nullable ANode = null
fun write(s: String)
do
if last_current != current_node then
last_current = current_node
fun write(s: String)
do
if last_current != current_node then
last_current = current_node
- var l = current_node._location
- if l != null then
- eol
- out.add(s)
- out.add("\t# {l.colored_line("0;32").split_with('\n').first}")
- has_eol = false
- eol
- return
- end
end
out.add(s)
has_eol = false
end
out.add(s)
has_eol = false
@@
-99,7
+90,7
@@
redef class ABlockExpr
end
end
end
end
-redef class AIntExpr
+redef class AIntegerExpr
redef fun accept_printer(v)
do
v.write(value.to_s)
redef fun accept_printer(v)
do
v.write(value.to_s)
@@
-109,7
+100,7
@@
end
redef class ANewExpr
redef fun accept_printer(v)
do
redef class ANewExpr
redef fun accept_printer(v)
do
- v.write("new {mtype.as(not null)}.{mproperty.as(not null)}")
+ v.write("new {mtype.as(not null)}.{callsite.mproperty}")
if not n_args.n_exprs.is_empty then
v.write("(")
v.indent
if not n_args.n_exprs.is_empty then
v.write("(")
v.indent
@@
-128,12
+119,12
@@
redef class ASendExpr
redef fun accept_printer(v)
do
v.enter_visit(n_expr)
redef fun accept_printer(v)
do
v.enter_visit(n_expr)
- v.write(".{mproperty.name}")
+ v.write(".{callsite.mproperty.name}")
if not raw_arguments.is_empty then
v.write("(")
v.indent
var is_first = true
if not raw_arguments.is_empty then
v.write("(")
v.indent
var is_first = true
- for a in raw_arguments.as(not null) do
+ for a in raw_arguments do
if is_first then is_first = false else v.write(",")
v.enter_visit(a)
end
if is_first then is_first = false else v.write(",")
v.enter_visit(a)
end