OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2005 Frerich Raabe <raabe@kde.org> | 2 * Copyright 2005 Frerich Raabe <raabe@kde.org> |
3 * Copyright (C) 2006 Apple Computer, Inc. | 3 * Copyright (C) 2006 Apple Computer, Inc. |
4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * | 9 * |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 } | 250 } |
251 | 251 |
252 Value Union::evaluate(EvaluationContext& context) const | 252 Value Union::evaluate(EvaluationContext& context) const |
253 { | 253 { |
254 Value lhsResult = subExpr(0)->evaluate(context); | 254 Value lhsResult = subExpr(0)->evaluate(context); |
255 Value rhs = subExpr(1)->evaluate(context); | 255 Value rhs = subExpr(1)->evaluate(context); |
256 | 256 |
257 NodeSet& resultSet = lhsResult.modifiableNodeSet(context); | 257 NodeSet& resultSet = lhsResult.modifiableNodeSet(context); |
258 const NodeSet& rhsNodes = rhs.toNodeSet(&context); | 258 const NodeSet& rhsNodes = rhs.toNodeSet(&context); |
259 | 259 |
260 WillBeHeapHashSet<RawPtrWillBeMember<Node> > nodes; | 260 WillBeHeapHashSet<RawPtrWillBeMember<Node>> nodes; |
261 for (size_t i = 0; i < resultSet.size(); ++i) | 261 for (size_t i = 0; i < resultSet.size(); ++i) |
262 nodes.add(resultSet[i]); | 262 nodes.add(resultSet[i]); |
263 | 263 |
264 for (size_t i = 0; i < rhsNodes.size(); ++i) { | 264 for (size_t i = 0; i < rhsNodes.size(); ++i) { |
265 Node* node = rhsNodes[i]; | 265 Node* node = rhsNodes[i]; |
266 if (nodes.add(node).isNewEntry) | 266 if (nodes.add(node).isNewEntry) |
267 resultSet.append(node); | 267 resultSet.append(node); |
268 } | 268 } |
269 | 269 |
270 // It is also possible to use merge sort to avoid making the result | 270 // It is also possible to use merge sort to avoid making the result |
(...skipping 23 matching lines...) Expand all Loading... |
294 | 294 |
295 // foo[3] means foo[position()=3] | 295 // foo[3] means foo[position()=3] |
296 if (result.isNumber()) | 296 if (result.isNumber()) |
297 return EqTestOp(EqTestOp::OpcodeEqual, adoptPtrWillBeNoop(createFunction
("position")), adoptPtrWillBeNoop(new Number(result.toNumber()))).evaluate(conte
xt).toBoolean(); | 297 return EqTestOp(EqTestOp::OpcodeEqual, adoptPtrWillBeNoop(createFunction
("position")), adoptPtrWillBeNoop(new Number(result.toNumber()))).evaluate(conte
xt).toBoolean(); |
298 | 298 |
299 return result.toBoolean(); | 299 return result.toBoolean(); |
300 } | 300 } |
301 | 301 |
302 } | 302 } |
303 } | 303 } |
OLD | NEW |