redef fun pretty_default
do
- if default_value != null then
- return " ({values[default_value]})"
- else
- return ""
- end
+ return " ({values[default_value]})"
end
end
var valtype = value.mtype.as(MClassType)
var res = self.new_var(mtype)
- if compiler.runtime_type_analysis != null and not compiler.runtime_type_analysis.live_types.has(value.mtype.as(MClassType)) then
+ if not compiler.runtime_type_analysis.live_types.has(value.mtype.as(MClassType)) then
self.add("/*no boxing of {value.mtype}: {value.mtype} is not live! */")
self.add("PRINT_ERROR(\"Dead code executed!\\n\"); show_backtrace(1);")
return res
redef fun tpl_namespace do
var tpl = new Template
- if mproject != null then
- tpl.add mproject.tpl_namespace
- else if parent != null then
- tpl.add parent.tpl_namespace
- end
- if mproject != null and mproject.root != self then
+ tpl.add mproject.tpl_namespace
+ if mproject.root != self then
tpl.add "::"
tpl.add tpl_link
end
private fun insert_artificial_callbacks(toolcontext: ToolContext)
do
var fcc = foreign_callbacks
- assert fcc != null
var modelbuilder = toolcontext.modelbuilder
var mmodule = mpropdef.mclassdef.mmodule
else if pname == "is_same_type" then
return v.bool_instance(args[0].mtype == args[1].mtype)
else if pname == "is_same_instance" then
- return v.bool_instance(args[1] != null and args[0].eq_is(args[1]))
+ return v.bool_instance(args[0].eq_is(args[1]))
else if pname == "exit" then
exit(args[1].to_i)
abort
if header != null then add header
var name = name
- if name != null then add "module {name}\n\n"
+ add "module {name}\n\n"
for i in imports do add "import {i}\n"
add "\n"
redef fun accept_auto_super_init(v)
do
var mproperty = self.callsite.mproperty
- if mproperty == null then return
if mproperty.is_init then
v.has_explicit_super_init = self
end
if not mmodule2nmodule.has_key(mmodule) then return ts
var nmodule = mmodule2nmodule[mmodule]
- assert nmodule != null
# usualy, only the original module must be imported in the unit test.
var o = mmodule
addn " COMPREPLY=()"
addn " cur=\"$\{COMP_WORDS[COMP_CWORD]\}\""
addn " prev=\"$\{COMP_WORDS[COMP_CWORD-1]\}\""
- if option_names != null then
+ if not option_names.is_empty then
addn " opts=\"{option_names.join(" ")}\""
addn " if [[ $\{cur\} == -* ]] ; then"
addn " COMPREPLY=( $(compgen -W \"$\{opts\}\" -- $\{cur\}) )"
# Sub can be discovered inside a Generic type during the subtyping test
if not sub.mclass.loaded then create_class(sub.mclass)
- if anchor == null then anchor = sub
if sup isa MGenericType then
var sub2 = sub.supertype_to(mainmodule, anchor, sup.mclass)
assert sub2.mclass == sup.mclass