Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(429)

Unified Diff: src/flag-definitions.h

Issue 10252: * Added d8 flag "--" (alias "--js-arguments"). (Closed)
Patch Set: Addressed reviews, added tests Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/d8.cc ('k') | src/flags.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/flag-definitions.h
diff --git a/src/flag-definitions.h b/src/flag-definitions.h
index 6e2462b12b997695af80aae0a8383629937d6f3d..5c96429f3153e44e66c0d399201842bf9fb1cab4 100644
--- a/src/flag-definitions.h
+++ b/src/flag-definitions.h
@@ -69,10 +69,27 @@
#error No mode supplied when including flags.defs
#endif
+#ifdef FLAG_MODE_DECLARE
+// Structure used to hold a collection of arguments to the JavaScript code.
+struct JSArguments {
+public:
+ JSArguments();
+ JSArguments(int argc, const char** argv);
+ int argc() const;
+ const char** argv();
+ const char*& operator[](int idx);
+ JSArguments& operator=(JSArguments args);
+private:
+ int argc_;
+ const char** argv_;
+};
+#endif
+
#define DEFINE_bool(nam, def, cmt) FLAG(BOOL, bool, nam, def, cmt)
#define DEFINE_int(nam, def, cmt) FLAG(INT, int, nam, def, cmt)
#define DEFINE_float(nam, def, cmt) FLAG(FLOAT, double, nam, def, cmt)
#define DEFINE_string(nam, def, cmt) FLAG(STRING, const char*, nam, def, cmt)
+#define DEFINE_args(nam, def, cmt) FLAG(ARGS, JSArguments, nam, def, cmt)
//
// Flags in all modes.
@@ -202,6 +219,8 @@ DEFINE_string(testing_serialization_file, "/tmp/serdes",
DEFINE_bool(help, false, "Print usage message, including flags, on console")
DEFINE_bool(dump_counters, false, "Dump counters on exit")
+DEFINE_args(js_arguments, JSArguments(),
+ "Pass all remaining arguments to the script. Alias for \"--\".")
//
// Debug only flags
« no previous file with comments | « src/d8.cc ('k') | src/flags.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698