nitc :: ScopeVisitor :: make_escape_mark
Display an error on toolcontext if a label with the same name is masked.
# Create a new escape mark (possibly with a label)
# Display an error on toolcontext if a label with the same name is masked.
fun make_escape_mark(nlabel: nullable ALabel, for_loop: Bool): EscapeMark
do
var name: nullable String
if nlabel != null then
var nid = nlabel.n_id
if nid == null then
var res = search_label("")
if res != null then
self.error(nlabel, "Syntax Error: anonymous label already defined.")
end
name = ""
else
name = nid.text
var found = self.search_label(name)
if found != null then
self.error(nlabel, "Syntax Error: label `{name}` already defined.")
end
end
else
name = null
end
var res = new EscapeMark(name)
if for_loop then res.continue_mark = new EscapeMark(name)
return res
end
src/semantize/scope.nit:157,2--183,4