OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * Datatypes holding information extracted by the analyzer and used by later | 6 * Datatypes holding information extracted by the analyzer and used by later |
7 * phases of the compiler. | 7 * phases of the compiler. |
8 */ | 8 */ |
9 library info; | 9 library info; |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 /** Base path where all output is generated. */ | 33 /** Base path where all output is generated. */ |
34 final Path _outputDir; | 34 final Path _outputDir; |
35 | 35 |
36 /** Whether to add prefixes and to output file names. */ | 36 /** Whether to add prefixes and to output file names. */ |
37 final bool _mangleFilenames; | 37 final bool _mangleFilenames; |
38 | 38 |
39 /** Default prefix added to all filenames. */ | 39 /** Default prefix added to all filenames. */ |
40 static const String _DEFAULT_PREFIX = '_'; | 40 static const String _DEFAULT_PREFIX = '_'; |
41 | 41 |
42 PathInfo(this._baseDir, this._outputDir, [this._mangleFilenames = true]); | 42 PathInfo(Path baseDir, Path outputDir, [bool forceMangle = false]) |
| 43 : _baseDir = baseDir, |
| 44 _outputDir = outputDir, |
| 45 _mangleFilenames = forceMangle || (baseDir == outputDir); |
43 | 46 |
44 /** Add a prefix and [suffix] if [_mangleFilenames] is true */ | 47 /** Add a prefix and [suffix] if [_mangleFilenames] is true */ |
45 String mangle(String name, String suffix, [bool forceSuffix = false]) => | 48 String mangle(String name, String suffix, [bool forceSuffix = false]) => |
46 _mangleFilenames ? "$_DEFAULT_PREFIX$name$suffix" | 49 _mangleFilenames ? "$_DEFAULT_PREFIX$name$suffix" |
47 : (forceSuffix ? "$name$suffix" : name); | 50 : (forceSuffix ? "$name$suffix" : name); |
48 | 51 |
49 /** | 52 /** |
50 * Checks if [input] is valid. It must be in [_baseDir] and must not be in | 53 * Checks if [input] is valid. It must be in [_baseDir] and must not be in |
51 * the [_outputDir]. | 54 * the [_outputDir]. |
52 */ | 55 */ |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 } | 639 } |
637 | 640 |
638 visitChildren(ElementInfo info) { | 641 visitChildren(ElementInfo info) { |
639 for (var child in info.children) { | 642 for (var child in info.children) { |
640 var result = visit(child); | 643 var result = visit(child); |
641 if (result != null) return result; | 644 if (result != null) return result; |
642 } | 645 } |
643 return null; | 646 return null; |
644 } | 647 } |
645 } | 648 } |
OLD | NEW |