Open Bug 361441 Opened 18 years ago Updated 2 years ago

Use "new" evaluateToX methods rather than evaluate

Categories

(Core :: XSLT, defect)

defect

Tracking

()

People

(Reporter: sicking, Assigned: peterv)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 6 obsolete files)

We should use the evaluateToX methods more, both implement them and call them. We have to watch out for bad call chains though, so calling evaluateToBoolean on an expression should not call evaluateToBoolean->evaluate->evaluateToNumber.
Status: NEW → ASSIGNED
Have a patch, but it'll have to wait for attachment 247792 [details] [diff] [review] to land.
Assignee: xslt → peterv
Status: ASSIGNED → NEW
Attached patch v1 (obsolete) — Splinter Review
This adds quite a bit of code :-/. We could do away with some of it if we stop overriding evaluate() when we have a more specific evaluateToX(). That would replace one virtual function call (evaluate) with three: evaluate, getReturnType and evaluateToX.
Attachment #249452 - Flags: superreview?(bugmail)
Attachment #249452 - Flags: review?(bugmail)
Attached patch v1 (diff -w) (obsolete) — Splinter Review
I'm not too exited about using getReturnType. Why not create a set of base classes, txBaseNumberExpr, txBaseBoolExpr etc. txBaseNumberExpr would lack evaluateToNumber but would let all other functions forward to evaluateToNumber.

You could simplify txCoreFunctionCall/txEXSLTFunctionCall two ways:

Either put a switch(mType) statement in each evaluteToX. In evaluateToBoolean you'd directly handle the functions that return a bool. The functions that return a number forward directly to evaluateToNumber etc. Same thing in the other evaluate functions.

The other solution is to put a switch(descriptTable[mType].mReturnType) in the beginning of evaluateToBoolean and forward directly to other evaluate functions if needed, and then a switch(mType) to handle the functions that do return a boolean.


What do you think?
Attached patch v2 (obsolete) — Splinter Review
As I suspected, that actually adds even more to the codesize.
Attached patch v2.1 (obsolete) — Splinter Review
This gives a much smaller codesize increase.
Attachment #249452 - Attachment is obsolete: true
Attachment #249453 - Attachment is obsolete: true
Attachment #249779 - Attachment is obsolete: true
Attachment #250051 - Flags: superreview?(bugmail)
Attachment #250051 - Flags: review?(bugmail)
Attachment #249452 - Flags: superreview?(bugmail)
Attachment #249452 - Flags: review?(bugmail)
Attached patch v2.1 (diff -w) (obsolete) — Splinter Review
Blocks: 143291
Attached patch v2.1 (obsolete) — Splinter Review
Updated to trunk.
Attachment #250051 - Attachment is obsolete: true
Attachment #250052 - Attachment is obsolete: true
Attachment #324772 - Flags: review?(jonas)
Attachment #250051 - Flags: superreview?(jonas)
Attachment #250051 - Flags: review?(jonas)
QA Contact: keith → xslt
Attached patch v2.1Splinter Review
Attachment #324772 - Attachment is obsolete: true
Attachment #408012 - Flags: review?(jonas)
Attachment #324772 - Flags: review?(jonas)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: