Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(588)

Side by Side Diff: test/cctest/test-parsing.cc

Issue 2298743002: Make the condition for when this is predeclared easier to understand. (Closed)
Patch Set: updates Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/parsing/parser-base.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3303 matching lines...) Expand 10 before | Expand all | Expand 10 after
3314 i::Zone zone(CcTest::i_isolate()->allocator()); 3314 i::Zone zone(CcTest::i_isolate()->allocator());
3315 v8::Local<v8::Value> v = CompileRun(src); 3315 v8::Local<v8::Value> v = CompileRun(src);
3316 i::Handle<i::Object> o = v8::Utils::OpenHandle(*v); 3316 i::Handle<i::Object> o = v8::Utils::OpenHandle(*v);
3317 i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o); 3317 i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o);
3318 i::Context* context = f->context(); 3318 i::Context* context = f->context();
3319 i::AstValueFactory avf(&zone, isolate->heap()->HashSeed()); 3319 i::AstValueFactory avf(&zone, isolate->heap()->HashSeed());
3320 avf.Internalize(isolate); 3320 avf.Internalize(isolate);
3321 const i::AstRawString* name = avf.GetOneByteString("result"); 3321 const i::AstRawString* name = avf.GetOneByteString("result");
3322 i::Handle<i::String> str = name->string(); 3322 i::Handle<i::String> str = name->string();
3323 CHECK(str->IsInternalizedString()); 3323 CHECK(str->IsInternalizedString());
3324 i::DeclarationScope* script_scope = new (&zone) i::DeclarationScope(&zone); 3324 i::DeclarationScope* script_scope =
3325 new (&zone) i::DeclarationScope(&zone, &avf);
3325 i::Scope* s = i::Scope::DeserializeScopeChain( 3326 i::Scope* s = i::Scope::DeserializeScopeChain(
3326 isolate, &zone, context, script_scope, &avf, 3327 isolate, &zone, context, script_scope, &avf,
3327 i::Scope::DeserializationMode::kKeepScopeInfo); 3328 i::Scope::DeserializationMode::kKeepScopeInfo);
3328 CHECK(s != script_scope); 3329 CHECK(s != script_scope);
3329 CHECK(name != NULL); 3330 CHECK(name != NULL);
3330 3331
3331 // Get result from h's function context (that is f's context) 3332 // Get result from h's function context (that is f's context)
3332 i::Variable* var = s->Lookup(name); 3333 i::Variable* var = s->Lookup(name);
3333 3334
3334 CHECK(var != NULL); 3335 CHECK(var != NULL);
(...skipping 26 matching lines...) Expand all
3361 source->PrintOn(stdout); 3362 source->PrintOn(stdout);
3362 printf("\n"); 3363 printf("\n");
3363 i::Zone zone(CcTest::i_isolate()->allocator()); 3364 i::Zone zone(CcTest::i_isolate()->allocator());
3364 v8::Local<v8::Value> v = CompileRun(src); 3365 v8::Local<v8::Value> v = CompileRun(src);
3365 i::Handle<i::Object> o = v8::Utils::OpenHandle(*v); 3366 i::Handle<i::Object> o = v8::Utils::OpenHandle(*v);
3366 i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o); 3367 i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o);
3367 i::Context* context = f->context(); 3368 i::Context* context = f->context();
3368 i::AstValueFactory avf(&zone, isolate->heap()->HashSeed()); 3369 i::AstValueFactory avf(&zone, isolate->heap()->HashSeed());
3369 avf.Internalize(isolate); 3370 avf.Internalize(isolate);
3370 3371
3371 i::DeclarationScope* script_scope = new (&zone) i::DeclarationScope(&zone); 3372 i::DeclarationScope* script_scope =
3373 new (&zone) i::DeclarationScope(&zone, &avf);
3372 i::Scope* s = i::Scope::DeserializeScopeChain( 3374 i::Scope* s = i::Scope::DeserializeScopeChain(
3373 isolate, &zone, context, script_scope, &avf, 3375 isolate, &zone, context, script_scope, &avf,
3374 i::Scope::DeserializationMode::kKeepScopeInfo); 3376 i::Scope::DeserializationMode::kKeepScopeInfo);
3375 CHECK(s != script_scope); 3377 CHECK(s != script_scope);
3376 const i::AstRawString* name_x = avf.GetOneByteString("x"); 3378 const i::AstRawString* name_x = avf.GetOneByteString("x");
3377 3379
3378 // Get result from f's function context (that is g's outer context) 3380 // Get result from f's function context (that is g's outer context)
3379 i::Variable* var_x = s->Lookup(name_x); 3381 i::Variable* var_x = s->Lookup(name_x);
3380 CHECK(var_x != NULL); 3382 CHECK(var_x != NULL);
3381 CHECK(var_x->maybe_assigned() == i::kMaybeAssigned); 3383 CHECK(var_x->maybe_assigned() == i::kMaybeAssigned);
(...skipping 4797 matching lines...) Expand 10 before | Expand all | Expand 10 after
8179 "(a,);", 8181 "(a,);",
8180 "(a,b,c,);", 8182 "(a,b,c,);",
8181 NULL 8183 NULL
8182 }; 8184 };
8183 // clang-format on 8185 // clang-format on
8184 8186
8185 static const ParserFlag always_flags[] = {kAllowHarmonyTrailingCommas}; 8187 static const ParserFlag always_flags[] = {kAllowHarmonyTrailingCommas};
8186 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, 8188 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags,
8187 arraysize(always_flags)); 8189 arraysize(always_flags));
8188 } 8190 }
OLDNEW
« no previous file with comments | « src/parsing/parser-base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698