Fixes bug 591819.
var analyzer = new SemanticAnalyzer ();
analyzer.analyze (context);
+ if (!ccode_only && !compile_only) {
+ // building program, require entry point
+ if (context.entry_point == null) {
+ Report.error (null, "program does not contain a static `main' method");
+ }
+ }
+
if (dump_tree != null) {
var code_writer = new CodeWriter (true);
code_writer.write_file (context, dump_tree);
public Report report { get; set; default = new Report ();}
+ public Method? entry_point { get; set; }
+
private Gee.List<SourceFile> source_files = new ArrayList<SourceFile> ();
private Gee.List<string> c_source_files = new ArrayList<string> ();
private Namespace _root = new Namespace (null);
}
if (is_possible_entry_point (analyzer)) {
+ if (analyzer.context.entry_point != null) {
+ error = true;
+ Report.error (source_reference, "program already has an entry point `%s'".printf (analyzer.context.entry_point.get_full_name ()));
+ return false;
+ }
entry_point = true;
+ analyzer.context.entry_point = this;
}
return !error;