Index: src/ast/ast-value-factory.h |
diff --git a/src/ast/ast-value-factory.h b/src/ast/ast-value-factory.h |
index 7b34a6b5649f0227b6ab354ab15b3dbb62957d7a..ec9a8e389fb18cd6f0b6ea53b13061a6cbdebd4a 100644 |
--- a/src/ast/ast-value-factory.h |
+++ b/src/ast/ast-value-factory.h |
@@ -62,7 +62,7 @@ class AstString : public ZoneObject { |
}; |
-class AstRawString : public AstString { |
+class AstRawString final : public AstString { |
public: |
int length() const override { |
if (is_one_byte_) |
@@ -115,19 +115,17 @@ class AstRawString : public AstString { |
}; |
-class AstConsString : public AstString { |
+class AstConsString final : public AstString { |
public: |
AstConsString(const AstString* left, const AstString* right) |
- : left_(left), |
- right_(right) {} |
+ : length_(left->length() + right->length()), left_(left), right_(right) {} |
- int length() const override { return left_->length() + right_->length(); } |
+ int length() const override { return length_; } |
void Internalize(Isolate* isolate) override; |
private: |
- friend class AstValueFactory; |
- |
+ const int length_; |
const AstString* left_; |
const AstString* right_; |
}; |