PTAL
This now gathers a list of expression type entries and uses macros to
express
the expected tree structure. Failures will pinpoint the line and reason for
the
failure.
This should allow tests confirming that typing is correct.
The macros could be made less verbose I suppose, at the cost of imprecision
of
which line has the issue.
WDYT?
https://codereview.chromium.org/1288773007/diff/40001/src/ast-expression-visitor.cc
File src/ast-expression-visitor.cc (right):
https://codereview.chromium.org/1288773007/diff/40001/src/ast-expression-visitor.cc#newcode167
src/ast-expression-visitor.cc:167: ++depth_;
On 2015/08/19 12:06:37, titzer wrote:
IIUC, you are using the depth counter as the expression depth, since
you don't
increment the depth when you recurse on statements. Could you make
Recurse(Statement) and a Recurse(Expression) methods that do the stack
check,
with the latter incrementing the depth?
Done.
https://codereview.chromium.org/1288773007/diff/40001/src/ast-expression-visitor.h
File src/ast-expression-visitor.h (right):
https://codereview.chromium.org/1288773007/diff/40001/src/ast-expression-visitor.h#newcode26
src/ast-expression-visitor.h:26: void* operator new(size_t size, Zone*
zone) { return zone->New(size); }
On 2015/08/19 12:06:37, titzer wrote:
I don't think you want to define your own new here. I think you want
to extend
ZoneObject and use "new (zone)". It's not safer, but it's the V8 way.
Not groking. But maybe I'm missing something basic :-)
I can't inherit from ZoneObject without doing multiple inheritance here,
as I need to inherit from AstVisitor. Also, AstVisitor inherits from
Embedded, which in debug mode has a clashing operator new.
Currently this inlines ZoneObject in this class, so for instance in
TypingReseter::Run() I can do new (zone).
Or are you suggesting I do placement new there, ie:
new (zone->New(sizeof(TypingReseter))) TypingReseter ?
FWIW, this is the pattern used in typing.h and a few other places.
https://codereview.chromium.org/1288773007/diff/40001/test/cctest/expression-type-collector.cc
File test/cctest/expression-type-collector.cc (right):
https://codereview.chromium.org/1288773007/diff/40001/test/cctest/expression-type-collector.cc#newcode38
test/cctest/expression-type-collector.cc:38: void
ExpressionTypeCollector::VisitExpression(Expression* expression) {
On 2015/08/19 12:06:37, titzer wrote:
Collecting the types as a string is nice for debugging, but for
testing purposes
maybe it'd be better to collect a tree or something that's easier to
programmatically check? E.g. if these tests fail, we'll want to debug
why.
Restructured to gather a list of expression type info entries, and
macros to assert their structure.
https://codereview.chromium.org/1288773007/
--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.