static bool verbose_mode;
static string profile;
+ static string entry_point;
+
private CodeContext context;
const OptionEntry[] options = {
{ "debug", 'g', 0, OptionArg.NONE, ref debug, "Produce debug information", null },
{ "thread", 0, 0, OptionArg.NONE, ref thread, "Enable multithreading support", null },
{ "define", 'D', 0, OptionArg.STRING_ARRAY, ref defines, "Define SYMBOL", "SYMBOL..." },
+ { "main", 0, 0, OptionArg.STRING, ref entry_point, "Use SYMBOL as entry point", "SYMBOL..." },
{ "disable-assert", 0, 0, OptionArg.NONE, ref disable_assert, "Disable assertions", null },
{ "enable-checking", 0, 0, OptionArg.NONE, ref enable_checking, "Enable additional run-time checks", null },
{ "enable-deprecated", 0, 0, OptionArg.NONE, ref deprecated, "Enable deprecated features", null },
Report.error (null, "Unknown profile %s".printf (profile));
}
+ context.entry_point_name = entry_point;
+
if (defines != null) {
foreach (string define in defines) {
context.add_define (define);
}
}
- if (tree_can_fail && name == "main") {
- Report.error (source_reference, "\"main\" method cannot throw errors");
- }
-
// check that all errors that can be thrown in the method body are declared
if (body != null) {
foreach (DataType body_error_type in body.get_error_types ()) {
}
entry_point = true;
analyzer.context.entry_point = this;
+
+ if (tree_can_fail) {
+ Report.error (source_reference, "\"main\" method cannot throw errors");
+ }
}
return !error;
return false;
}
- if (name == null || name != "main") {
- // method must be called "main"
- return false;
+ if (analyzer.context.entry_point_name == null) {
+ if (name == null || name != "main") {
+ // method must be called "main"
+ return false;
+ }
+ } else {
+ // custom entry point name
+ if (get_full_name () != analyzer.context.entry_point_name) {
+ return false;
+ }
}
if (binding == MemberBinding.INSTANCE) {