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

Unified Diff: sdk/lib/_internal/compiler/implementation/dart2js.dart

Issue 48323003: Implement fromEnvironment on bool, int, String in dart2js. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 months 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
Index: sdk/lib/_internal/compiler/implementation/dart2js.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/dart2js.dart (revision 29652)
+++ sdk/lib/_internal/compiler/implementation/dart2js.dart (working copy)
@@ -112,6 +112,7 @@
// TODO(johnniwinther): Measure time for reading files.
SourceFileProvider inputProvider = new CompilerSourceFileProvider();
diagnosticHandler = new FormattingDiagnosticHandler(inputProvider);
+ Map<String, dynamic> environment = new Map<String, dynamic>();
passThrough(String argument) => options.add(argument);
@@ -174,6 +175,13 @@
passThrough('--verbose');
}
+ addInEnvironment(String argument) {
+ int eqIndex = argument.indexOf('=');
+ String name = argument.substring(2, eqIndex);
+ String value = argument.substring(eqIndex + 1);
+ environment[name] = value;
+ }
+
setCategories(String argument) {
List<String> categories = extractParameter(argument).split(',');
Set<String> allowedCategories =
@@ -275,6 +283,7 @@
new OptionHandler('--terse', passThrough),
new OptionHandler('--disallow-unsafe-eval',
(_) => hasDisallowUnsafeEval = true),
+ new OptionHandler('-D.+=.*', addInEnvironment),
// The following two options must come last.
new OptionHandler('-.*', (String argument) {
@@ -411,7 +420,7 @@
return api.compile(uri, libraryRoot, packageRoot,
inputProvider, diagnosticHandler,
- options, outputProvider)
+ options, outputProvider, environment)
.then(compilationDone);
}
@@ -494,6 +503,9 @@
-v, --verbose
Display verbose information.
+ -D<name>=<value>
+ Define an environment variable.
+
--version
Display version information.

Powered by Google App Engine
This is Rietveld 408576698