Fix reversed axes in `atan2`, but since it is actually just a change in the name of the variables (and doc) it should not break the clients.
Also sorting points of a polygon in `triangulate` completely invalidated some complex polygons.
Pull-Request: #1958
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Romain Chanoir <romain.chanoir@viacesi.fr>
# All classes, from this pass and from other passes
var all_classes: HashMap[String, JavaClass] is noserialize, lazy do
var classes = new HashMap[String, JavaClass]
- classes.recover_with self.classes
+ classes.add_all self.classes
for model_path in sys.opt_load_models.value do
if not model_path.file_exists then
continue
end
- classes.recover_with model.classes
+ classes.add_all model.classes
end
return classes
res.add "\t\tREDUCE {r}\n"
end
end
- return res.to_s
+ return res.join
end
# Generate a graphviz file of the automaton
var name: String
# Mangled name
- fun cname: String do return name.to_cmangle
+ var cname: String is lazy do return name.to_cmangle
# Number
var number: Int = -1
super
if not is_dirty and not wiki.force_render or not has_source then return
content = md_proc.process(md.as(not null))
- headlines.recover_with(md_proc.emitter.decorator.headlines)
+ headlines.add_all(md_proc.emitter.decorator.headlines)
end
end
obj["period"] = period
obj["owner"] = owner.key
var values = new JsonObject
- values.recover_with(self)
+ values.add_all(self)
obj["values"] = values
return obj
end
fun copy: RangeMap
do
var c = new RangeMap
- c.recover_with(self)
+ c.add_all(self)
return c
end
redef fun accept_range_analysis(v, ins, outs)
do
visit_all(v)
- if ins != null then outs.recover_with(ins)
+ if ins != null then outs.add_all(ins)
end
end
do
visit_all(v)
- if ins != null then outs.recover_with(ins)
+ if ins != null then outs.add_all(ins)
var variable = def_var
#var add = new RangeMap[Var, ValRange](variable,
do
visit_all(v)
- if ins != null then outs.recover_with(ins)
+ if ins != null then outs.add_all(ins)
var src = src_var # reg
var def = def_var # mem
do
visit_all(v)
- if ins != null then outs.recover_with(ins)
+ if ins != null then outs.add_all(ins)
var def = def_var # mem
v.current_range = null
visit_all(v)
- if ins != null then outs.recover_with(ins)
+ if ins != null then outs.add_all(ins)
var reg = reg_var
v.current_range = null
visit_all(v)
- if ins != null then outs.recover_with(ins)
+ if ins != null then outs.add_all(ins)
var reg = reg_var
if ins.has_key(reg) then
v.current_range = null
visit_all(v)
- if ins != null then outs.recover_with(ins)
+ if ins != null then outs.add_all(ins)
var reg = new RegisterVar('A')
if outs.has_key(reg) then
redef class AInstruction
redef fun accept_reaching_defs_analysis(v, ins, outs)
do
- if ins != null then outs.recover_with(ins)
+ if ins != null then outs.add_all(ins)
end
end
redef class ALoadInstruction
redef fun accept_reaching_defs_analysis(v, ins, outs)
do
- if ins != null then outs.recover_with(ins)
+ if ins != null then outs.add_all(ins)
var variable = def_var
if variable != null then
redef class AStoreInstruction
redef fun accept_reaching_defs_analysis(v, ins, outs)
do
- if ins != null then outs.recover_with(ins)
+ if ins != null then outs.add_all(ins)
var variable = def_var
if variable != null then
import android.app.Notification;
`}
-redef class NativeActivity
+redef class NativeContext
fun notification_manager: NativeNotificationManager in "Java" `{
return (NotificationManager)self.getSystemService(Context.NOTIFICATION_SERVICE);
`}
extern class NativeNotificationBuilder in "Java" `{ android.app.Notification$Builder `}
- new (context: NativeActivity) in "Java" `{ return new Notification.Builder(context); `}
+ new (context: NativeContext) in "Java" `{ return new Notification.Builder(context); `}
fun create: NativeNotification in "Java" `{
// Deprecated since API 16, which introduces `build`,
var adapter = new Android_widget_ArrayAdapter(app.native_activity,
android_r_layout_simple_list_item_1, self)
native.set_adapter adapter
- return adapter
+ return adapter.new_global_ref
end
redef fun add(item)
private new (context: NativeActivity, sender_object: Button)
import Button.on_click in "Java" `{
final int final_sender_object = sender_object;
+ Button_incr_ref(final_sender_object);
return new android.widget.Button(context){
@Override
# It is memory-efficient but relies on `has` so may be CPU-inefficient for some kind of collections.
fun has_all(other: Collection[nullable Object]): Bool
do
+ if is_same_instance(other) then return true
+ var ol = other.length
+ var l = length
+ if ol == 0 then return true
+ if l == 0 then return false
+ if ol == 1 then return has(other.first)
for x in other do if not has(x) then return false
return true
end
# Add each (key,value) of `map` into `self`.
# If a same key exists in `map` and `self`, then the value in self is discarded.
#
- # It is the analogous of `SimpleCollection::add_all`
- #
# var x = new HashMap[String, Int]
# x["four"] = 4
# x["five"] = 5
# var y = new HashMap[String, Int]
# y["four"] = 40
# y["nine"] = 90
- # x.recover_with y
+ # x.add_all y
# assert x["four"] == 40
# assert x["five"] == 5
# assert x["nine"] == 90
- fun recover_with(map: MapRead[K, V])
+ fun add_all(map: MapRead[K, V])
do
var i = map.iterator
while i.is_ok do
end
end
+ # Alias for `add_all`
+ fun recover_with(map: MapRead[K, V]) is deprecated do add_all(map)
+
# Remove all items
#
# var x = new HashMap[String, Int]
redef fun clone
do
var res = new ArrayMap[K,E]
- res.recover_with self
+ res.add_all self
return res
end
end
# Build a list filled with the items of `coll`.
init from(coll: Map[K, V]) do
init
- recover_with(coll)
+ add_all(coll)
end
redef var keys: RemovableCollection[K] = new HashMapKeys[K, V](self) is lazy
redef class JsonObject
# Inits `self` from a BSON object.
- private init from_bson(bson: BSON) do recover_with(bson.to_json)
+ private init from_bson(bson: BSON) do add_all(bson.to_json)
# Returns a new BSON object from `self`.
private fun to_bson: BSON do return new BSON.from_json(self)
var rel_type = json_edge["type"].as(String)
var json_properties = json_edge["properties"].as(JsonObject)
var edge = new NeoEdge(from, rel_type, to)
- edge.properties.recover_with(json_properties)
+ edge.properties.add_all(json_properties)
edges.add edge
end
end
var labels = o["labels"].as(JsonArray)
for lab in labels do self.labels.add(lab.as(String))
var json_properties = o["properties"].as(JsonObject)
- properties.recover_with(json_properties)
+ properties.add_all(json_properties)
end
redef fun to_json do return to_json_by_append
var parse_url = parse_url
http_request.get_args = parse_url
- http_request.all_args.recover_with parse_url
+ http_request.all_args.add_all parse_url
else
http_request.uri = first_line[1]
end
if prefix_table != null then
var old_prefix_table = prefix_table.as(not null)
prefix_table = new HashMap[String, String]
- prefix_table.recover_with(old_prefix_table)
+ prefix_table.add_all(old_prefix_table)
else
prefix_table = new HashMap[String, String]
end
self.header.add_decl(" #define be32toh(val) ((be16toh((val) << 16) | (be16toh((val) >> 16))))")
self.header.add_decl("#endif")
self.header.add_decl("#ifdef ANDROID")
- self.header.add_decl(" #define be32toh(val) betoh32(val)")
+ self.header.add_decl(" #ifndef be32toh")
+ self.header.add_decl(" #define be32toh(val) betoh32(val)")
+ self.header.add_decl(" #endif")
self.header.add_decl(" #include <android/log.h>")
self.header.add_decl(" #define PRINT_ERROR(...) (void)__android_log_print(ANDROID_LOG_WARN, \"Nit\", __VA_ARGS__)")
self.header.add_decl("#else")
print str.search_all("rés".to_re).join(", ")
str = "あついあのあほ"
-print str.split("あ(の)?".to_re).join("")
+print str.split("あ(の)?".to_re).join
for i in str.search_all("あ(の)?".to_re) do
print "Match found : {i}"