OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 3375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3386 i::Zone zone(CcTest::i_isolate()->allocator()); | 3386 i::Zone zone(CcTest::i_isolate()->allocator()); |
3387 v8::Local<v8::Value> v = CompileRun(src); | 3387 v8::Local<v8::Value> v = CompileRun(src); |
3388 i::Handle<i::Object> o = v8::Utils::OpenHandle(*v); | 3388 i::Handle<i::Object> o = v8::Utils::OpenHandle(*v); |
3389 i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o); | 3389 i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o); |
3390 i::Context* context = f->context(); | 3390 i::Context* context = f->context(); |
3391 i::AstValueFactory avf(&zone, isolate->heap()->HashSeed()); | 3391 i::AstValueFactory avf(&zone, isolate->heap()->HashSeed()); |
3392 avf.Internalize(isolate); | 3392 avf.Internalize(isolate); |
3393 const i::AstRawString* name = avf.GetOneByteString("result"); | 3393 const i::AstRawString* name = avf.GetOneByteString("result"); |
3394 i::Handle<i::String> str = name->string(); | 3394 i::Handle<i::String> str = name->string(); |
3395 CHECK(str->IsInternalizedString()); | 3395 CHECK(str->IsInternalizedString()); |
3396 i::DeclarationScope* script_scope = | 3396 i::DeclarationScope* script_scope = new (&zone) i::DeclarationScope(&zone); |
3397 new (&zone) i::DeclarationScope(&zone, nullptr, i::SCRIPT_SCOPE); | |
3398 i::Scope* s = i::Scope::DeserializeScopeChain( | 3397 i::Scope* s = i::Scope::DeserializeScopeChain( |
3399 isolate, &zone, context, script_scope, &avf, | 3398 isolate, &zone, context, script_scope, &avf, |
3400 i::Scope::DeserializationMode::kKeepScopeInfo); | 3399 i::Scope::DeserializationMode::kKeepScopeInfo); |
3401 CHECK(s != script_scope); | 3400 CHECK(s != script_scope); |
3402 CHECK(name != NULL); | 3401 CHECK(name != NULL); |
3403 | 3402 |
3404 // Get result from h's function context (that is f's context) | 3403 // Get result from h's function context (that is f's context) |
3405 i::Variable* var = s->Lookup(name); | 3404 i::Variable* var = s->Lookup(name); |
3406 | 3405 |
3407 CHECK(var != NULL); | 3406 CHECK(var != NULL); |
(...skipping 26 matching lines...) Expand all Loading... |
3434 source->PrintOn(stdout); | 3433 source->PrintOn(stdout); |
3435 printf("\n"); | 3434 printf("\n"); |
3436 i::Zone zone(CcTest::i_isolate()->allocator()); | 3435 i::Zone zone(CcTest::i_isolate()->allocator()); |
3437 v8::Local<v8::Value> v = CompileRun(src); | 3436 v8::Local<v8::Value> v = CompileRun(src); |
3438 i::Handle<i::Object> o = v8::Utils::OpenHandle(*v); | 3437 i::Handle<i::Object> o = v8::Utils::OpenHandle(*v); |
3439 i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o); | 3438 i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o); |
3440 i::Context* context = f->context(); | 3439 i::Context* context = f->context(); |
3441 i::AstValueFactory avf(&zone, isolate->heap()->HashSeed()); | 3440 i::AstValueFactory avf(&zone, isolate->heap()->HashSeed()); |
3442 avf.Internalize(isolate); | 3441 avf.Internalize(isolate); |
3443 | 3442 |
3444 i::DeclarationScope* script_scope = | 3443 i::DeclarationScope* script_scope = new (&zone) i::DeclarationScope(&zone); |
3445 new (&zone) i::DeclarationScope(&zone, nullptr, i::SCRIPT_SCOPE); | |
3446 i::Scope* s = i::Scope::DeserializeScopeChain( | 3444 i::Scope* s = i::Scope::DeserializeScopeChain( |
3447 isolate, &zone, context, script_scope, &avf, | 3445 isolate, &zone, context, script_scope, &avf, |
3448 i::Scope::DeserializationMode::kKeepScopeInfo); | 3446 i::Scope::DeserializationMode::kKeepScopeInfo); |
3449 CHECK(s != script_scope); | 3447 CHECK(s != script_scope); |
3450 const i::AstRawString* name_x = avf.GetOneByteString("x"); | 3448 const i::AstRawString* name_x = avf.GetOneByteString("x"); |
3451 | 3449 |
3452 // Get result from f's function context (that is g's outer context) | 3450 // Get result from f's function context (that is g's outer context) |
3453 i::Variable* var_x = s->Lookup(name_x); | 3451 i::Variable* var_x = s->Lookup(name_x); |
3454 CHECK(var_x != NULL); | 3452 CHECK(var_x != NULL); |
3455 CHECK(var_x->maybe_assigned() == i::kMaybeAssigned); | 3453 CHECK(var_x->maybe_assigned() == i::kMaybeAssigned); |
(...skipping 4736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8192 "(a,);", | 8190 "(a,);", |
8193 "(a,b,c,);", | 8191 "(a,b,c,);", |
8194 NULL | 8192 NULL |
8195 }; | 8193 }; |
8196 // clang-format on | 8194 // clang-format on |
8197 | 8195 |
8198 static const ParserFlag always_flags[] = {kAllowHarmonyTrailingCommas}; | 8196 static const ParserFlag always_flags[] = {kAllowHarmonyTrailingCommas}; |
8199 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, | 8197 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, |
8200 arraysize(always_flags)); | 8198 arraysize(always_flags)); |
8201 } | 8199 } |
OLD | NEW |