Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005 Frerich Raabe <raabe@kde.org> | 2 * Copyright (C) 2005 Frerich Raabe <raabe@kde.org> |
| 3 * Copyright (C) 2006, 2009 Apple Inc. | 3 * Copyright (C) 2006, 2009 Apple Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 56 class Expression : public ParseNode { | 56 class Expression : public ParseNode { |
| 57 WTF_MAKE_NONCOPYABLE(Expression); WTF_MAKE_FAST_ALLOCATED; | 57 WTF_MAKE_NONCOPYABLE(Expression); WTF_MAKE_FAST_ALLOCATED; |
| 58 public: | 58 public: |
| 59 static EvaluationContext& evaluationContext(); | 59 static EvaluationContext& evaluationContext(); |
| 60 | 60 |
| 61 Expression(); | 61 Expression(); |
| 62 virtual ~Expression(); | 62 virtual ~Expression(); |
| 63 | 63 |
| 64 virtual Value evaluate() const = 0; | 64 virtual Value evaluate() const = 0; |
| 65 | 65 |
| 66 void addSubExpression(Expression* expr) | 66 void addSubExpression(Expression* expr) |
|
abarth-chromium
2013/10/11 20:28:05
This should be a PassOwnPtr<Expression>
| |
| 67 { | 67 { |
| 68 m_subExpressions.append(expr); | 68 m_subExpressions.append(adoptPtr(expr)); |
|
abarth-chromium
2013/10/11 20:28:05
We should call adoptPtr immediately after calling
dshwang
2013/10/11 20:43:35
I hope so but this method is used by yacc.c
If it
| |
| 69 m_isContextNodeSensitive |= expr->m_isContextNodeSensitive; | 69 m_isContextNodeSensitive |= expr->m_isContextNodeSensitive; |
| 70 m_isContextPositionSensitive |= expr->m_isContextPositionSensiti ve; | 70 m_isContextPositionSensitive |= expr->m_isContextPositionSensiti ve; |
| 71 m_isContextSizeSensitive |= expr->m_isContextSizeSensitive; | 71 m_isContextSizeSensitive |= expr->m_isContextSizeSensitive; |
| 72 } | 72 } |
| 73 | 73 |
| 74 bool isContextNodeSensitive() const { return m_isContextNodeSensitiv e; } | 74 bool isContextNodeSensitive() const { return m_isContextNodeSensitiv e; } |
| 75 bool isContextPositionSensitive() const { return m_isContextPosition Sensitive; } | 75 bool isContextPositionSensitive() const { return m_isContextPosition Sensitive; } |
| 76 bool isContextSizeSensitive() const { return m_isContextSizeSensitiv e; } | 76 bool isContextSizeSensitive() const { return m_isContextSizeSensitiv e; } |
| 77 void setIsContextNodeSensitive(bool value) { m_isContextNodeSensitiv e = value; } | 77 void setIsContextNodeSensitive(bool value) { m_isContextNodeSensitiv e = value; } |
| 78 void setIsContextPositionSensitive(bool value) { m_isContextPosition Sensitive = value; } | 78 void setIsContextPositionSensitive(bool value) { m_isContextPosition Sensitive = value; } |
| 79 void setIsContextSizeSensitive(bool value) { m_isContextSizeSensitiv e = value; } | 79 void setIsContextSizeSensitive(bool value) { m_isContextSizeSensitiv e = value; } |
| 80 | 80 |
| 81 virtual Value::Type resultType() const = 0; | 81 virtual Value::Type resultType() const = 0; |
| 82 | 82 |
| 83 protected: | 83 protected: |
| 84 unsigned subExprCount() const { return m_subExpressions.size(); } | 84 unsigned subExprCount() const { return m_subExpressions.size(); } |
| 85 Expression* subExpr(unsigned i) { return m_subExpressions[i]; } | 85 Expression* subExpr(unsigned i) { return m_subExpressions[i].get(); } |
| 86 const Expression* subExpr(unsigned i) const { return m_subExpression s[i]; } | 86 const Expression* subExpr(unsigned i) const { return m_subExpression s[i].get(); } |
| 87 | 87 |
| 88 private: | 88 private: |
| 89 Vector<Expression*> m_subExpressions; | 89 Vector<OwnPtr<Expression> > m_subExpressions; |
| 90 | 90 |
| 91 // Evaluation details that can be used for optimization. | 91 // Evaluation details that can be used for optimization. |
| 92 bool m_isContextNodeSensitive; | 92 bool m_isContextNodeSensitive; |
| 93 bool m_isContextPositionSensitive; | 93 bool m_isContextPositionSensitive; |
| 94 bool m_isContextSizeSensitive; | 94 bool m_isContextSizeSensitive; |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 } | 97 } |
| 98 | 98 |
| 99 } | 99 } |
| 100 | 100 |
| 101 #endif // EXPRESSION_H | 101 #endif // EXPRESSION_H |
| OLD | NEW |