OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // A container to associate type bounds with AST Expression nodes. |
| 6 |
| 7 #ifndef V8_AST_AST_TYPE_BOUNDS_H_ |
| 8 #define V8_AST_AST_TYPE_BOUNDS_H_ |
| 9 |
| 10 #include "src/types.h" |
| 11 #include "src/zone-containers.h" |
| 12 |
| 13 namespace v8 { |
| 14 namespace internal { |
| 15 |
| 16 class Expression; |
| 17 |
| 18 class AstTypeBounds { |
| 19 public: |
| 20 explicit AstTypeBounds(Zone* zone) : bounds_map_(zone) {} |
| 21 ~AstTypeBounds() {} |
| 22 |
| 23 Bounds get(Expression* expression) const { |
| 24 ZoneMap<Expression*, Bounds>::const_iterator i = |
| 25 bounds_map_.find(expression); |
| 26 return (i != bounds_map_.end()) ? i->second : Bounds::Unbounded(); |
| 27 } |
| 28 |
| 29 void set(Expression* expression, Bounds bounds) { |
| 30 bounds_map_[expression] = bounds; |
| 31 } |
| 32 |
| 33 private: |
| 34 ZoneMap<Expression*, Bounds> bounds_map_; |
| 35 }; |
| 36 |
| 37 } // namespace internal |
| 38 } // namespace v8 |
| 39 |
| 40 #endif // V8_AST_AST_TYPE_BOUNDS_H_ |
OLD | NEW |