| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef TOOLS_GN_SCOPE_H_ | 5 #ifndef TOOLS_GN_SCOPE_H_ |
| 6 #define TOOLS_GN_SCOPE_H_ | 6 #define TOOLS_GN_SCOPE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 // generated, or NULL if there is none. | 58 // generated, or NULL if there is none. |
| 59 virtual const Value* GetProgrammaticValue( | 59 virtual const Value* GetProgrammaticValue( |
| 60 const base::StringPiece& ident) = 0; | 60 const base::StringPiece& ident) = 0; |
| 61 | 61 |
| 62 protected: | 62 protected: |
| 63 Scope* scope_; | 63 Scope* scope_; |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 // Options for configuring scope merges. | 66 // Options for configuring scope merges. |
| 67 struct MergeOptions { | 67 struct MergeOptions { |
| 68 // Defaults to all false, which are the things least likely to cause errors. | 68 MergeOptions(); |
| 69 MergeOptions() | 69 ~MergeOptions(); |
| 70 : clobber_existing(false), | |
| 71 skip_private_vars(false), | |
| 72 mark_dest_used(false) { | |
| 73 } | |
| 74 | 70 |
| 75 // When set, all existing avlues in the destination scope will be | 71 // When set, all existing avlues in the destination scope will be |
| 76 // overwritten. | 72 // overwritten. |
| 77 // | 73 // |
| 78 // When false, it will be an error to merge a variable into another scope | 74 // When false, it will be an error to merge a variable into another scope |
| 79 // where a variable with the same name is already set. The exception is | 75 // where a variable with the same name is already set. The exception is |
| 80 // if both of the variables have the same value (which happens if you | 76 // if both of the variables have the same value (which happens if you |
| 81 // somehow multiply import the same file, for example). This case will be | 77 // somehow multiply import the same file, for example). This case will be |
| 82 // ignored since there is nothing getting lost. | 78 // ignored since there is nothing getting lost. |
| 83 bool clobber_existing; | 79 bool clobber_existing; |
| 84 | 80 |
| 85 // When true, private variables (names beginning with an underscore) will | 81 // When true, private variables (names beginning with an underscore) will |
| 86 // be copied to the destination scope. When false, private values will be | 82 // be copied to the destination scope. When false, private values will be |
| 87 // skipped. | 83 // skipped. |
| 88 bool skip_private_vars; | 84 bool skip_private_vars; |
| 89 | 85 |
| 90 // When set, values copied to the destination scope will be marked as used | 86 // When set, values copied to the destination scope will be marked as used |
| 91 // so won't trigger an unused variable warning. You want this when doing an | 87 // so won't trigger an unused variable warning. You want this when doing an |
| 92 // import, for example, or files that don't need a variable from the .gni | 88 // import, for example, or files that don't need a variable from the .gni |
| 93 // file will throw an error. | 89 // file will throw an error. |
| 94 bool mark_dest_used; | 90 bool mark_dest_used; |
| 91 |
| 92 // When set, those variables are not merged. |
| 93 std::set<std::string> excluded_values; |
| 95 }; | 94 }; |
| 96 | 95 |
| 97 // Creates an empty toplevel scope. | 96 // Creates an empty toplevel scope. |
| 98 explicit Scope(const Settings* settings); | 97 explicit Scope(const Settings* settings); |
| 99 | 98 |
| 100 // Creates a dependent scope. | 99 // Creates a dependent scope. |
| 101 explicit Scope(Scope* parent); | 100 explicit Scope(Scope* parent); |
| 102 explicit Scope(const Scope* parent); | 101 explicit Scope(const Scope* parent); |
| 103 | 102 |
| 104 ~Scope(); | 103 ~Scope(); |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 | 354 |
| 356 typedef std::set<ProgrammaticProvider*> ProviderSet; | 355 typedef std::set<ProgrammaticProvider*> ProviderSet; |
| 357 ProviderSet programmatic_providers_; | 356 ProviderSet programmatic_providers_; |
| 358 | 357 |
| 359 SourceDir source_dir_; | 358 SourceDir source_dir_; |
| 360 | 359 |
| 361 DISALLOW_COPY_AND_ASSIGN(Scope); | 360 DISALLOW_COPY_AND_ASSIGN(Scope); |
| 362 }; | 361 }; |
| 363 | 362 |
| 364 #endif // TOOLS_GN_SCOPE_H_ | 363 #endif // TOOLS_GN_SCOPE_H_ |
| OLD | NEW |