| Index: test/cctest/test-parsing.cc
|
| diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
|
| index d33d0377c939b1de6bd4271f382b91cde5d9b257..c1bb363a03a867938678fe04a436ae1b6e2c4043 100644
|
| --- a/test/cctest/test-parsing.cc
|
| +++ b/test/cctest/test-parsing.cc
|
| @@ -31,6 +31,8 @@
|
|
|
| #include "src/v8.h"
|
|
|
| +#include "src/ast.h"
|
| +#include "src/ast-numbering.h"
|
| #include "src/ast-value-factory.h"
|
| #include "src/compiler.h"
|
| #include "src/execution.h"
|
| @@ -3271,8 +3273,7 @@ TEST(InnerAssignment) {
|
| i::Parser parser(&info, &parse_info);
|
| parser.set_allow_harmony_scoping(true);
|
| CHECK(parser.Parse());
|
| - CHECK(i::Rewriter::Rewrite(&info));
|
| - CHECK(i::Scope::Analyze(&info));
|
| + CHECK(i::Compiler::Analyze(&info));
|
| CHECK(info.function() != NULL);
|
|
|
| i::Scope* scope = info.function()->scope();
|
| @@ -3970,6 +3971,13 @@ TEST(ClassStaticPrototypeErrors) {
|
| "static get prototype() {}",
|
| "static set prototype(_) {}",
|
| "static *prototype() {}",
|
| + "static 'prototype'() {}",
|
| + "static *'prototype'() {}",
|
| + "static prot\\u006ftype() {}",
|
| + "static 'prot\\u006ftype'() {}",
|
| + "static get 'prot\\u006ftype'() {}",
|
| + "static set 'prot\\u006ftype'(_) {}",
|
| + "static *'prot\\u006ftype'() {}",
|
| NULL};
|
|
|
| static const ParserFlag always_flags[] = {
|
| @@ -3990,6 +3998,13 @@ TEST(ClassSpecialConstructorErrors) {
|
| "get constructor() {}",
|
| "get constructor(_) {}",
|
| "*constructor() {}",
|
| + "get 'constructor'() {}",
|
| + "*'constructor'() {}",
|
| + "get c\\u006fnstructor() {}",
|
| + "*c\\u006fnstructor() {}",
|
| + "get 'c\\u006fnstructor'() {}",
|
| + "get 'c\\u006fnstructor'(_) {}",
|
| + "*'c\\u006fnstructor'() {}",
|
| NULL};
|
|
|
| static const ParserFlag always_flags[] = {
|
| @@ -4202,3 +4217,42 @@ TEST(ObjectLiteralPropertyShorthandYieldInGeneratorError) {
|
| RunParserSyncTest(context_data, name_data, kError, NULL, 0,
|
| always_flags, arraysize(always_flags));
|
| }
|
| +
|
| +
|
| +TEST(ConstParsingInForIn) {
|
| + const char* context_data[][2] = {{"'use strict';", ""},
|
| + {"function foo(){ 'use strict';", "}"},
|
| + {NULL, NULL}};
|
| +
|
| + const char* data[] = {
|
| + "for(const x = 1; ; ) {}",
|
| + "for(const x = 1, y = 2;;){}",
|
| + "for(const x in [1,2,3]) {}",
|
| + "for(const x of [1,2,3]) {}",
|
| + NULL};
|
| + static const ParserFlag always_flags[] = {kAllowHarmonyScoping};
|
| + RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags,
|
| + arraysize(always_flags));
|
| +}
|
| +
|
| +
|
| +TEST(ConstParsingInForInError) {
|
| + const char* context_data[][2] = {{"'use strict';", ""},
|
| + {"function foo(){ 'use strict';", "}"},
|
| + {NULL, NULL}};
|
| +
|
| + const char* data[] = {
|
| + "for(const x,y = 1; ; ) {}",
|
| + "for(const x = 4 in [1,2,3]) {}",
|
| + "for(const x = 4, y in [1,2,3]) {}",
|
| + "for(const x = 4 of [1,2,3]) {}",
|
| + "for(const x = 4, y of [1,2,3]) {}",
|
| + "for(const x = 1, y = 2 in []) {}",
|
| + "for(const x,y in []) {}",
|
| + "for(const x = 1, y = 2 of []) {}",
|
| + "for(const x,y of []) {}",
|
| + NULL};
|
| + static const ParserFlag always_flags[] = {kAllowHarmonyScoping};
|
| + RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags,
|
| + arraysize(always_flags));
|
| +}
|
|
|