Commit 57dc9129 authored by Rico Tzschichholz's avatar Rico Tzschichholz

libvaladoc: Replace void* with corresponding Vala API

parent 75c8c4b4
......@@ -36,7 +36,7 @@ public class Valadoc.Api.Array : Item {
get;
}
public Array (Item parent, void* data) {
public Array (Item parent, Vala.ArrayType data) {
base (data);
this.parent = parent;
......
......@@ -32,7 +32,7 @@ public class Valadoc.Api.Attribute : Item {
get;
}
public Attribute (Node parent, SourceFile file, string name, void* data) {
public Attribute (Node parent, SourceFile file, string name, Vala.Attribute data) {
base (data);
this.parent = parent;
......@@ -52,25 +52,25 @@ public class Valadoc.Api.Attribute : Item {
return null;
}
public AttributeArgument add_boolean (string name, bool value, void* data = null) {
public AttributeArgument add_boolean (string name, bool value, Vala.Attribute data) {
AttributeArgument arg = new AttributeArgument.boolean (this, file, name, value, data);
args.add (arg);
return arg;
}
public AttributeArgument add_integer (string name, int value, void* data = null) {
public AttributeArgument add_integer (string name, int value, Vala.Attribute data) {
AttributeArgument arg = new AttributeArgument.integer (this, file, name, value, data);
args.add (arg);
return arg;
}
public AttributeArgument add_double (string name, double value, void* data = null) {
public AttributeArgument add_double (string name, double value, Vala.Attribute data) {
AttributeArgument arg = new AttributeArgument.double (this, file, name, value, data);
args.add (arg);
return arg;
}
public AttributeArgument add_string (string name, string value, void* data = null) {
public AttributeArgument add_string (string name, string value, Vala.Attribute data) {
AttributeArgument arg = new AttributeArgument.string (this, file, name, value, data);
args.add (arg);
return arg;
......
......@@ -48,23 +48,23 @@ public class Valadoc.Api.AttributeArgument : Item {
get;
}
public AttributeArgument.boolean (Attribute parent, SourceFile file, string name, bool value, void* data) {
public AttributeArgument.boolean (Attribute parent, SourceFile file, string name, bool value, Vala.Attribute data) {
this (parent, file, name, Type.BOOLEAN, value.to_string (), data);
}
public AttributeArgument.integer (Attribute parent, SourceFile file, string name, int value, void* data) {
public AttributeArgument.integer (Attribute parent, SourceFile file, string name, int value, Vala.Attribute data) {
this (parent, file, name, Type.INTEGER, value.to_string (), data);
}
public AttributeArgument.double (Attribute parent, SourceFile file, string name, double value, void* data) {
public AttributeArgument.double (Attribute parent, SourceFile file, string name, double value, Vala.Attribute data) {
this (parent, file, name, Type.DOUBLE, value.to_string (), data);
}
public AttributeArgument.string (Attribute parent, SourceFile file, string name, string value, void* data) {
public AttributeArgument.string (Attribute parent, SourceFile file, string name, string value, Vala.Attribute data) {
this (parent, file, name, Type.STRING, value, data);
}
private AttributeArgument (Attribute parent, SourceFile file, string name, Type type, string value, void* data) {
private AttributeArgument (Attribute parent, SourceFile file, string name, Type type, string value, Vala.Attribute data) {
base (data);
this.argument_type = type;
......
......@@ -52,7 +52,7 @@ public class Valadoc.Api.Class : TypeSymbol {
string? dbus_name, string? type_id, string? param_spec_function_name, string? ref_function_name,
string? unref_function_name, string? free_function_name, string? finalize_function_name,
string? take_value_function_cname, string? get_value_function_cname, string? set_value_function_cname,
bool is_fundamental, bool is_abstract, bool is_basic_type, void* data)
bool is_fundamental, bool is_abstract, bool is_basic_type, Vala.Class data)
{
base (parent, file, name, accessibility, comment, type_macro_name,
is_type_macro_name, type_cast_macro_name, type_function_name, is_basic_type, data);
......
......@@ -38,7 +38,7 @@ public class Valadoc.Api.Constant : Member {
}
public Constant (Node parent, SourceFile file, string name, SymbolAccessibility accessibility,
SourceComment? comment, string? cname, void* data)
SourceComment? comment, string? cname, Vala.Constant data)
{
base (parent, file, name, accessibility, comment, data);
......
......@@ -40,7 +40,7 @@ public class Valadoc.Api.Delegate : TypeSymbol, Callable {
public Delegate (Node parent, SourceFile file, string name, SymbolAccessibility accessibility,
SourceComment? comment, string? cname, bool is_static, void* data)
SourceComment? comment, string? cname, bool is_static, Vala.Delegate data)
{
base (parent, file, name, accessibility, comment, null, null, null, null, false, data);
......
......@@ -31,7 +31,7 @@ public class Valadoc.Api.Enum : TypeSymbol {
public Enum (Node parent, SourceFile file, string name, SymbolAccessibility accessibility,
SourceComment? comment, string? cname, string? type_macro_name,
string? type_function_name, void* data)
string? type_function_name, Vala.Enum data)
{
base (parent, file, name, accessibility, comment, type_macro_name, null, null,
type_function_name, false, data);
......
......@@ -44,7 +44,7 @@ public class Valadoc.Api.EnumValue: Symbol {
}
}
public EnumValue (Enum parent, SourceFile file, string name, SourceComment? comment, string? cname, void* data) {
public EnumValue (Enum parent, SourceFile file, string name, SourceComment? comment, string? cname, Vala.EnumValue data) {
base (parent, file, name, parent.accessibility, data);
this.source_comment = comment;
......
......@@ -32,7 +32,7 @@ public class Valadoc.Api.ErrorCode : Symbol {
private string? cname;
public ErrorCode (ErrorDomain parent, SourceFile file, string name, SourceComment? comment,
string? cname, string? dbus_name, void* data)
string? cname, string? dbus_name, Vala.ErrorCode data)
{
base (parent, file, name, parent.accessibility, data);
......
......@@ -34,7 +34,7 @@ public class Valadoc.Api.ErrorDomain : TypeSymbol {
public ErrorDomain (Node parent, SourceFile file, string name, SymbolAccessibility accessibility,
SourceComment? comment, string? cname, string? quark_macro_name,
string? quark_function_name, string? dbus_name, void* data)
string? quark_function_name, string? dbus_name, Vala.ErrorDomain data)
{
base (parent, file, name, accessibility, comment, null, null, null, null, false, data);
......
......@@ -31,7 +31,7 @@ public class Valadoc.Api.Field : Member {
public Field (Node parent, SourceFile file, string name, SymbolAccessibility accessibility,
SourceComment? comment, string? cname, bool is_static, bool is_volatile,
void* data)
Vala.Field data)
{
base (parent, file, name, accessibility, comment, data);
......
......@@ -58,7 +58,7 @@ public class Valadoc.Api.FormalParameter : Symbol {
private FormalParameterType type;
public FormalParameter (Node parent, SourceFile file, string? name, SymbolAccessibility accessibility, FormalParameterType type, bool ellipsis, void* data) {
public FormalParameter (Node parent, SourceFile file, string? name, SymbolAccessibility accessibility, FormalParameterType type, bool ellipsis, Vala.Parameter data) {
base (parent, file, name, accessibility, data);
assert ((name == null && ellipsis) || (name != null && !ellipsis));
......
......@@ -35,7 +35,7 @@ public class Valadoc.Api.Interface : TypeSymbol {
public Interface (Node parent, SourceFile file, string name, SymbolAccessibility accessibility,
SourceComment? comment, string? cname, string? type_macro_name, string? is_type_macro_name,
string? type_cast_macro_name, string? type_function_name, string interface_macro_name,
string? dbus_name, void* data)
string? dbus_name, Vala.Interface data)
{
base (parent, file, name, accessibility, comment, type_macro_name, is_type_macro_name,
type_cast_macro_name, type_function_name, false, data);
......
......@@ -29,7 +29,7 @@ using Valadoc.Content;
public abstract class Valadoc.Api.Item : Object {
private Inline _signature;
public void* data {
public Vala.CodeNode? data {
private set;
get;
}
......@@ -42,7 +42,7 @@ public abstract class Valadoc.Api.Item : Object {
get;
}
public Item (void* data) {
public Item (Vala.CodeNode? data) {
this.data = data;
}
......
......@@ -26,7 +26,7 @@ public abstract class Valadoc.Api.Member : Symbol {
private SourceComment? source_comment;
public Member (Node parent, SourceFile file, string name, SymbolAccessibility accessibility,
SourceComment? comment, void* data)
SourceComment? comment, Vala.Symbol data)
{
base (parent, file, name, accessibility, data);
......
......@@ -46,7 +46,7 @@ public class Valadoc.Api.Method : Member, Callable {
public Method (Node parent, SourceFile file, string name, SymbolAccessibility accessibility,
SourceComment? comment, string? cname, string? dbus_name, string? dbus_result_name,
string? finish_function_cname, MethodBindingType binding_type, bool is_yields,
bool is_dbus_visible, bool is_constructor, void* data)
bool is_dbus_visible, bool is_constructor, Vala.Method data)
{
base (parent, file, name, accessibility, comment, data);
......
......@@ -29,7 +29,7 @@ using Valadoc.Content;
public class Valadoc.Api.Namespace : Symbol {
private SourceComment? source_comment;
public Namespace (Api.Node parent, SourceFile file, string? name, SourceComment? comment, void* data) {
public Namespace (Api.Node parent, SourceFile file, string? name, SourceComment? comment, Vala.Namespace data) {
base (parent, file, name, SymbolAccessibility.PUBLIC, data);
this.source_comment = comment;
......
......@@ -50,7 +50,7 @@ public abstract class Valadoc.Api.Node : Item, Browsable, Documentation {
private Vala.Map<NodeType, Vala.List<Node>> per_type_children;
public Node (Node? parent, SourceFile? file, string? name, void* data) {
public Node (Node? parent, SourceFile? file, string? name, Vala.CodeNode? data) {
base (data);
per_name_children = new Vala.HashMap<string, Node> (str_hash, str_equal);
......
......@@ -73,7 +73,7 @@ public class Valadoc.Api.Package : Node {
return this._dependencies;
}
public Package (string name, bool is_package, void* data) {
public Package (string name, bool is_package, Vala.CodeNode? data) {
base (null, null, name, data);
this.is_package = is_package;
......
......@@ -36,7 +36,7 @@ public class Valadoc.Api.Pointer : Item {
get;
}
public Pointer (Item parent, void* data) {
public Pointer (Item parent, Vala.PointerType data) {
base (data);
this.parent = parent;
......
......@@ -33,7 +33,7 @@ public class Valadoc.Api.Property : Member {
public Property (Node parent, SourceFile file, string name, SymbolAccessibility accessibility,
SourceComment? comment, string? cname, string? dbus_name, bool is_dbus_visible,
PropertyBindingType binding_type, void* data)
PropertyBindingType binding_type, Vala.Property data)
{
base (parent, file, name, accessibility, comment, data);
......
......@@ -32,7 +32,7 @@ public class Valadoc.Api.PropertyAccessor : Symbol {
private string? cname;
public PropertyAccessor (Property parent, SourceFile file, string name, SymbolAccessibility accessibility,
string? cname, PropertyAccessorType type, Ownership ownership, void* data)
string? cname, PropertyAccessorType type, Ownership ownership, Vala.PropertyAccessor data)
{
base (parent, file, name, accessibility, data);
......
......@@ -43,7 +43,7 @@ public class Valadoc.Api.Signal : Member, Callable {
public Signal (Node parent, SourceFile file, string name, SymbolAccessibility accessibility,
SourceComment? comment, string? cname, string? default_impl_cname, string? dbus_name, bool is_dbus_visible,
bool is_virtual, void* data)
bool is_virtual, Vala.Signal data)
{
base (parent, file, name, accessibility, comment, data);
......
......@@ -45,12 +45,12 @@ public class Valadoc.Api.SourceFile : Object {
return Path.get_basename (relative_path);
}
public void* data {
public Vala.SourceFile? data {
private set;
get;
}
public SourceFile (Package package, string relative_path, string? relative_c_path, void* data) {
public SourceFile (Package package, string relative_path, string? relative_c_path, Vala.SourceFile? data) {
this.relative_c_path = relative_c_path;
this.relative_path = relative_path;
this.package = package;
......
......@@ -38,7 +38,7 @@ public class Valadoc.Api.Struct : TypeSymbol {
SourceComment? comment, string? cname, string? type_macro_name,
string? type_function_name, string? type_id, string? dup_function_cname,
string? copy_function_cname, string? destroy_function_cname,
string? free_function_cname, bool is_basic_type, void* data)
string? free_function_cname, bool is_basic_type, Vala.Struct data)
{
base (parent, file, name, accessibility, comment, type_macro_name, null, null,
type_function_name, is_basic_type, data);
......
......@@ -35,7 +35,7 @@ public abstract class Valadoc.Api.Symbol : Node {
}
public Symbol (Node parent, SourceFile file, string? name, SymbolAccessibility accessibility,
void* data)
Vala.Symbol data)
{
base (parent, file, name, data);
......
......@@ -53,7 +53,7 @@ public class Valadoc.Api.Tree {
this.packages.add (package);
}
public void* data {
public Vala.CodeContext context {
set;
get;
}
......@@ -216,10 +216,10 @@ public class Valadoc.Api.Tree {
return params;
}
public Tree (ErrorReporter reporter, Settings settings, void* data = null) {
public Tree (ErrorReporter reporter, Settings settings, Vala.CodeContext context) {
this.settings = settings;
this.reporter = reporter;
this.data = data;
this.context = context;
}
// copied from valacodecontext.vala
......
......@@ -28,7 +28,7 @@ using Valadoc.Content;
*/
public class Valadoc.Api.TypeParameter : Symbol {
public TypeParameter (Node parent, SourceFile file, string name, void* data) {
public TypeParameter (Node parent, SourceFile file, string name, Vala.TypeParameter data) {
base (parent, file, name, SymbolAccessibility.PUBLIC, data);
}
......
......@@ -32,7 +32,7 @@ public class Valadoc.Api.TypeReference : Item {
private Ownership ownership;
public TypeReference (Item parent, Ownership ownership, bool pass_ownership, bool is_dynamic,
bool is_nullable, string? dbus_type_signature, void* data)
bool is_nullable, string? dbus_type_signature, Vala.DataType? data)
{
base (data);
......
......@@ -35,7 +35,7 @@ public abstract class Valadoc.Api.TypeSymbol : Symbol {
public TypeSymbol (Node parent, SourceFile file, string name, SymbolAccessibility accessibility,
SourceComment? comment, string? type_macro_name, string? is_type_macro_name,
string? type_cast_macro_name, string? type_function_name, bool is_basic_type,
void* data)
Vala.TypeSymbol data)
{
base (parent, file, name, accessibility, data);
......
......@@ -39,7 +39,7 @@ public class Valadoc.Drivers.Driver : Object, Valadoc.Driver {
gir_directory = settings.gir_directory;
}
gir_writer.write_file ((Vala.CodeContext) tree.data,
gir_writer.write_file (tree.context,
gir_directory,
"%s-%s.gir".printf (settings.gir_namespace, settings.gir_version),
settings.gir_namespace,
......
......@@ -862,12 +862,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
}
}
private Vala.CodeContext create_valac_tree (Settings settings) {
// init context:
var context = new Vala.CodeContext ();
Vala.CodeContext.push (context);
private void create_valac_tree (Vala.CodeContext context, Settings settings) {
// settings:
context.experimental = settings.experimental;
context.experimental_non_null = settings.experimental || settings.experimental_non_null;
......@@ -943,21 +938,20 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
// add user defined files:
add_depencies (context, settings.packages);
if (reporter.errors > 0) {
return context;
return;
}
add_documented_files (context, settings.source_files);
if (reporter.errors > 0) {
return context;
return;
}
// parse vala-code:
Vala.Parser parser = new Vala.Parser ();
parser.parse (context);
if (context.report.get_errors () > 0) {
return context;
return;
}
// parse gir:
......@@ -965,18 +959,14 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
gir_parser.parse (context);
if (context.report.get_errors () > 0) {
return context;
return;
}
// check context:
context.check ();
if (context.report.get_errors () > 0) {
return context;
return;
}
return context;
}
......@@ -1503,17 +1493,15 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
this.settings = settings;
this.reporter = reporter;
this.tree = new Api.Tree (reporter, settings);
var context = create_valac_tree (settings);
this.tree.data = context;
var context = new Vala.CodeContext ();
Vala.CodeContext.push (context);
this.tree = new Api.Tree (reporter, settings, context);
create_valac_tree (context, settings);
reporter.warnings_offset = context.report.get_warnings ();
reporter.errors_offset = context.report.get_errors ();
if (context == null) {
return null;
}
// TODO: Register all packages here
// register packages included by gir-files
foreach (Vala.SourceFile vfile in context.get_source_files ()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment