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_FUNCTIONS_H_ | 5 #ifndef TOOLS_GN_FUNCTIONS_H_ |
6 #define TOOLS_GN_FUNCTIONS_H_ | 6 #define TOOLS_GN_FUNCTIONS_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
428 // toolchain, and the given name. | 428 // toolchain, and the given name. |
429 Label MakeLabelForScope(const Scope* scope, | 429 Label MakeLabelForScope(const Scope* scope, |
430 const FunctionCallNode* function, | 430 const FunctionCallNode* function, |
431 const std::string& name); | 431 const std::string& name); |
432 | 432 |
433 // Some tyesp of blocks can't be nested inside other ones. For such cases, | 433 // Some tyesp of blocks can't be nested inside other ones. For such cases, |
434 // instantiate this object upon entering the block and Enter() will fail if | 434 // instantiate this object upon entering the block and Enter() will fail if |
435 // there is already another non-nestable block on the stack. | 435 // there is already another non-nestable block on the stack. |
436 class NonNestableBlock { | 436 class NonNestableBlock { |
437 public: | 437 public: |
438 enum Type { | |
Bons
2015/09/26 11:13:34
yay dead code removal!
| |
439 CONFIG, | |
440 DECLARE_ARGS, | |
441 TARGET, | |
442 TEMPLATE, | |
443 TOOLCHAIN, | |
444 }; | |
445 | |
446 // type_description is a string that will be used in error messages | 438 // type_description is a string that will be used in error messages |
447 // describing the type of the block, for example, "template" or "config". | 439 // describing the type of the block, for example, "template" or "config". |
448 NonNestableBlock(Scope* scope, | 440 NonNestableBlock(Scope* scope, |
449 const FunctionCallNode* function, | 441 const FunctionCallNode* function, |
450 const char* type_description); | 442 const char* type_description); |
451 ~NonNestableBlock(); | 443 ~NonNestableBlock(); |
452 | 444 |
453 bool Enter(Err* err); | 445 bool Enter(Err* err); |
454 | 446 |
455 private: | 447 private: |
456 // Used as a void* key for the Scope to track our property. The actual value | 448 // Used as a void* key for the Scope to track our property. The actual value |
457 // is never used. | 449 // is never used. |
458 static const int kKey; | 450 static const int kKey; |
459 | 451 |
460 Scope* scope_; | 452 Scope* scope_; |
461 const FunctionCallNode* function_; | 453 const FunctionCallNode* function_; |
462 const char* type_description_; | 454 const char* type_description_; |
463 | 455 |
464 // Set to true when the key is added to the scope so we don't try to | 456 // Set to true when the key is added to the scope so we don't try to |
465 // delete nonexistant keys which will cause assertions. | 457 // delete nonexistant keys which will cause assertions. |
466 bool key_added_; | 458 bool key_added_; |
467 }; | 459 }; |
468 | 460 |
469 #endif // TOOLS_GN_FUNCTIONS_H_ | 461 #endif // TOOLS_GN_FUNCTIONS_H_ |
OLD | NEW |