OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stdlib.h> | 5 #include <stdlib.h> |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #include "src/ast.h" | 9 #include "src/ast.h" |
10 #include "src/ast-expression-visitor.h" | 10 #include "src/ast-expression-visitor.h" |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 } | 249 } |
250 } | 250 } |
251 // return { geometricMean: geometricMean }; | 251 // return { geometricMean: geometricMean }; |
252 CHECK_EXPR(ObjectLiteral, DEFAULT_TYPE) { | 252 CHECK_EXPR(ObjectLiteral, DEFAULT_TYPE) { |
253 CHECK_VAR(geometricMean, DEFAULT_TYPE); | 253 CHECK_VAR(geometricMean, DEFAULT_TYPE); |
254 } | 254 } |
255 } | 255 } |
256 } | 256 } |
257 CHECK_TYPES_END | 257 CHECK_TYPES_END |
258 } | 258 } |
| 259 |
| 260 |
| 261 TEST(VisitEmptyForStatment) { |
| 262 v8::V8::Initialize(); |
| 263 HandleAndZoneScope handles; |
| 264 ZoneVector<ExpressionTypeEntry> types(handles.main_zone()); |
| 265 // Check that traversing an empty for statement works. |
| 266 const char test_function[] = |
| 267 "function foo() {\n" |
| 268 " for (;;) {}\n" |
| 269 "}\n"; |
| 270 CollectTypes(&handles, test_function, &types); |
| 271 CHECK_TYPES_BEGIN { |
| 272 CHECK_EXPR(FunctionLiteral, DEFAULT_TYPE) {} |
| 273 } |
| 274 CHECK_TYPES_END |
| 275 } |
| 276 |
| 277 |
| 278 TEST(VisitSwitchStatment) { |
| 279 v8::V8::Initialize(); |
| 280 HandleAndZoneScope handles; |
| 281 ZoneVector<ExpressionTypeEntry> types(handles.main_zone()); |
| 282 // Check that traversing a switch with a default works. |
| 283 const char test_function[] = |
| 284 "function foo() {\n" |
| 285 " switch (0) { case 1: break; default: break; }\n" |
| 286 "}\n"; |
| 287 CollectTypes(&handles, test_function, &types); |
| 288 CHECK_TYPES_BEGIN { |
| 289 CHECK_EXPR(FunctionLiteral, DEFAULT_TYPE) { |
| 290 CHECK_EXPR(Assignment, DEFAULT_TYPE) { |
| 291 CHECK_VAR(.switch_tag, DEFAULT_TYPE); |
| 292 CHECK_EXPR(Literal, DEFAULT_TYPE); |
| 293 } |
| 294 CHECK_VAR(.switch_tag, DEFAULT_TYPE); |
| 295 CHECK_EXPR(Literal, DEFAULT_TYPE); |
| 296 } |
| 297 } |
| 298 CHECK_TYPES_END |
| 299 } |
OLD | NEW |