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 "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/ast.h" | 7 #include "src/ast.h" |
8 #include "src/ast-expression-visitor.h" | 8 #include "src/ast-expression-visitor.h" |
9 #include "src/parser.h" | 9 #include "src/parser.h" |
10 #include "src/rewriter.h" | 10 #include "src/rewriter.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 i::Isolate* isolate = CcTest::i_isolate(); | 48 i::Isolate* isolate = CcTest::i_isolate(); |
49 i::Factory* factory = isolate->factory(); | 49 i::Factory* factory = isolate->factory(); |
50 | 50 |
51 i::Handle<i::String> source_code = | 51 i::Handle<i::String> source_code = |
52 factory->NewStringFromUtf8(i::CStrVector(source)).ToHandleChecked(); | 52 factory->NewStringFromUtf8(i::CStrVector(source)).ToHandleChecked(); |
53 | 53 |
54 i::Handle<i::Script> script = factory->NewScript(source_code); | 54 i::Handle<i::Script> script = factory->NewScript(source_code); |
55 | 55 |
56 i::ParseInfo info(zone, script); | 56 i::ParseInfo info(zone, script); |
57 i::Parser parser(&info); | 57 i::Parser parser(&info); |
58 parser.set_allow_harmony_arrow_functions(true); | |
59 parser.set_allow_harmony_sloppy(true); | 58 parser.set_allow_harmony_sloppy(true); |
60 info.set_global(); | 59 info.set_global(); |
61 info.set_lazy(false); | 60 info.set_lazy(false); |
62 info.set_allow_lazy_parsing(false); | 61 info.set_allow_lazy_parsing(false); |
63 info.set_toplevel(true); | 62 info.set_toplevel(true); |
64 | 63 |
65 CHECK(i::Compiler::ParseAndAnalyze(&info)); | 64 CHECK(i::Compiler::ParseAndAnalyze(&info)); |
66 | 65 |
67 FunctionLiteral* root = | 66 FunctionLiteral* root = |
68 info.scope()->declarations()->at(0)->AsFunctionDeclaration()->fun(); | 67 info.scope()->declarations()->at(0)->AsFunctionDeclaration()->fun(); |
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
908 "return {foo: foo, bar: 1};" | 907 "return {foo: foo, bar: 1};" |
909 "}\n"; | 908 "}\n"; |
910 | 909 |
911 v8::V8::Initialize(); | 910 v8::V8::Initialize(); |
912 HandleAndZoneScope handles; | 911 HandleAndZoneScope handles; |
913 Zone* zone = handles.main_zone(); | 912 Zone* zone = handles.main_zone(); |
914 ZoneVector<ExpressionTypeEntry> types(zone); | 913 ZoneVector<ExpressionTypeEntry> types(zone); |
915 CHECK_EQ("asm: line 40: non-function in function table\n", | 914 CHECK_EQ("asm: line 40: non-function in function table\n", |
916 Validate(zone, test_function, &types)); | 915 Validate(zone, test_function, &types)); |
917 } | 916 } |
OLD | NEW |