fun build_layout(elements: Set[E]): Layout[E] is abstract
end
-abstract class PropertyLayoutBuilder[E: MProperty]
-
- type LAYOUT: PropertyLayout[E]
-
- # Compute properties ids and position
- fun build_layout(mclasses: Set[MClass]): LAYOUT is abstract
+interface PropertyLayoutBuilder[E: MProperty]
+ # Build table layout for attributes, methods and virtual types
+ fun build_layout(elements: Set[MClass]): Layout[E] is abstract
end
# Layout builder for MProperty using Coloring (CL)
# Compute mclasses ids and position using BM
redef fun build_layout(mclasses) do
- var result = new PropertyLayout[E]
- result.pos = self.colorer.colorize(mclasses)
- return result
+ return self.colorer.build_layout(mclasses)
end
end
# MProperty coloring
abstract class MPropertyColorer[E: MProperty]
+ super PropertyLayoutBuilder[E]
private var mmodule: MModule
private var class_colorer: MClassColorer
self.class_colorer = new MClassColorer(mmodule)
end
- fun colorize(mclasses: Set[MClass]): Map[E, Int] do
+ # Compute mclasses ids and position using BM
+ redef fun build_layout(mclasses: Set[MClass]): Layout[E] do
+ var result = new Layout[E]
+ result.pos = self.colorize(mclasses)
+ return result
+ end
+
+ private fun colorize(mclasses: Set[MClass]): Map[E, Int] do
self.class_colorer.tag_elements(mclasses)
self.class_colorer.build_conflicts_graph(mclasses)
self.colorize_core(self.class_colorer.core)
private var type_layout: nullable Layout[MType]
private var resolution_layout: nullable Layout[MType]
- protected var method_layout: nullable PropertyLayout[MMethod]
- protected var attr_layout: nullable PropertyLayout[MAttribute]
+ protected var method_layout: nullable Layout[MMethod]
+ protected var attr_layout: nullable Layout[MAttribute]
init(mainmodule: MModule, mmbuilder: ModelBuilder, runtime_type_analysis: RapidTypeAnalysis) do
super(mainmodule, mmbuilder)
self.attr_layout = attr_layout
end
- fun build_method_tables(mclasses: Set[MClass], layout: PropertyLayout[MProperty]): Map[MClass, Array[nullable MPropDef]] do
+ fun build_method_tables(mclasses: Set[MClass], layout: Layout[MProperty]): Map[MClass, Array[nullable MPropDef]] do
var tables = new HashMap[MClass, Array[nullable MPropDef]]
for mclass in mclasses do
var table = new Array[nullable MPropDef]
return tables
end
- fun build_attr_tables(mclasses: Set[MClass], layout: PropertyLayout[MProperty]): Map[MClass, Array[nullable MPropDef]] do
+ fun build_attr_tables(mclasses: Set[MClass], layout: Layout[MProperty]): Map[MClass, Array[nullable MPropDef]] do
var tables = new HashMap[MClass, Array[nullable MPropDef]]
for mclass in mclasses do
var table = new Array[nullable MPropDef]
super SeparateCompiler
private var class_layout: nullable Layout[MClass]
- protected var vt_layout: nullable PropertyLayout[MVirtualTypeProp]
+ protected var vt_layout: nullable Layout[MVirtualTypeProp]
init(mainmodule: MModule, mmbuilder: ModelBuilder, runtime_type_analysis: RapidTypeAnalysis) do
super
self.vt_layout = vt_layout
end
- fun build_vt_tables(mclasses: Set[MClass], layout: PropertyLayout[MProperty]): Map[MClass, Array[nullable MPropDef]] do
+ fun build_vt_tables(mclasses: Set[MClass], layout: Layout[MProperty]): Map[MClass, Array[nullable MPropDef]] do
var tables = new HashMap[MClass, Array[nullable MPropDef]]
for mclass in mclasses do
var table = new Array[nullable MPropDef]