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

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

Issue 8562002: Make the parser track the language mode instead of keeping its own harmony flag. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « src/scanner.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 int length = i::OS::SNPrintF(program, "%s%s%s", 853 int length = i::OS::SNPrintF(program, "%s%s%s",
854 source_data[i].outer_prefix, 854 source_data[i].outer_prefix,
855 source_data[i].inner_source, 855 source_data[i].inner_source,
856 source_data[i].outer_suffix); 856 source_data[i].outer_suffix);
857 CHECK(length == kProgramSize); 857 CHECK(length == kProgramSize);
858 858
859 // Parse program source. 859 // Parse program source.
860 i::Handle<i::String> source( 860 i::Handle<i::String> source(
861 FACTORY->NewStringFromAscii(i::CStrVector(program.start()))); 861 FACTORY->NewStringFromAscii(i::CStrVector(program.start())));
862 i::Handle<i::Script> script = FACTORY->NewScript(source); 862 i::Handle<i::Script> script = FACTORY->NewScript(source);
863 bool harmony_scoping = i::FLAG_harmony_scoping;
864 i::FLAG_harmony_scoping = true;
863 i::Parser parser(script, false, NULL, NULL); 865 i::Parser parser(script, false, NULL, NULL);
864 parser.SetHarmonyScoping(true);
865 i::FunctionLiteral* function = 866 i::FunctionLiteral* function =
866 parser.ParseProgram(source, true, source_data[i].language_mode); 867 parser.ParseProgram(source, true, source_data[i].language_mode);
867 ASSERT(function != NULL); 868 i::FLAG_harmony_scoping = harmony_scoping;
869 CHECK(function != NULL);
868 870
869 // Check scope types and positions. 871 // Check scope types and positions.
870 i::Scope* scope = function->scope(); 872 i::Scope* scope = function->scope();
871 CHECK(scope->is_global_scope()); 873 CHECK(scope->is_global_scope());
872 CHECK_EQ(scope->start_position(), 0); 874 CHECK_EQ(scope->start_position(), 0);
873 CHECK_EQ(scope->end_position(), kProgramSize); 875 CHECK_EQ(scope->end_position(), kProgramSize);
874 CHECK_EQ(scope->inner_scopes()->length(), 1); 876 CHECK_EQ(scope->inner_scopes()->length(), 1);
875 877
876 i::Scope* inner_scope = scope->inner_scopes()->at(0); 878 i::Scope* inner_scope = scope->inner_scopes()->at(0);
877 CHECK_EQ(inner_scope->type(), source_data[i].scope_type); 879 CHECK_EQ(inner_scope->type(), source_data[i].scope_type);
878 CHECK_EQ(inner_scope->start_position(), kPrefixLen); 880 CHECK_EQ(inner_scope->start_position(), kPrefixLen);
879 // The end position of a token is one position after the last 881 // The end position of a token is one position after the last
880 // character belonging to that token. 882 // character belonging to that token.
881 CHECK_EQ(inner_scope->end_position(), kPrefixLen + kInnerLen); 883 CHECK_EQ(inner_scope->end_position(), kPrefixLen + kInnerLen);
882 } 884 }
883 } 885 }
OLDNEW
« no previous file with comments | « src/scanner.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698