Commit 67efca8b authored by yangguo's avatar yangguo Committed by Commit bot

Add test for referring function name for classes.

R=mvstanton@chromium.org
BUG=v8:4333
LOG=N

Review URL: https://codereview.chromium.org/1264603002

Cr-Commit-Position: refs/heads/master@{#29922}
parent 496bd53b
...@@ -100,6 +100,10 @@ ...@@ -100,6 +100,10 @@
# BUG(2340). Preprocessing stack traces is disabled at the moment. # BUG(2340). Preprocessing stack traces is disabled at the moment.
'test-heap/PreprocessStackTrace': [FAIL], 'test-heap/PreprocessStackTrace': [FAIL],
# BUG(4333). Function name inferrer does not work for ES6 clases.
'test-func-name-inference/UpperCaseClass': [FAIL],
'test-func-name-inference/LowerCaseClass': [FAIL],
############################################################################## ##############################################################################
# TurboFan compiler failures. # TurboFan compiler failures.
......
...@@ -87,6 +87,8 @@ static void CheckFunctionName(v8::Handle<v8::Script> script, ...@@ -87,6 +87,8 @@ static void CheckFunctionName(v8::Handle<v8::Script> script,
// Verify inferred function name. // Verify inferred function name.
SmartArrayPointer<char> inferred_name = SmartArrayPointer<char> inferred_name =
shared_func_info->inferred_name()->ToCString(); shared_func_info->inferred_name()->ToCString();
i::PrintF("expected: %s, found: %s\n", ref_inferred_name,
inferred_name.get());
CHECK_EQ(0, strcmp(ref_inferred_name, inferred_name.get())); CHECK_EQ(0, strcmp(ref_inferred_name, inferred_name.get()));
} }
...@@ -222,6 +224,44 @@ TEST(ObjectLiteral) { ...@@ -222,6 +224,44 @@ TEST(ObjectLiteral) {
} }
TEST(UpperCaseClass) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(CcTest::isolate(),
"'use strict';\n"
"class MyClass {\n"
" constructor() {\n"
" this.value = 1;\n"
" }\n"
" method() {\n"
" this.value = 2;\n"
" }\n"
"}");
CheckFunctionName(script, "this.value = 1", "MyClass");
CheckFunctionName(script, "this.value = 2", "MyClass.method");
}
TEST(LowerCaseClass) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(CcTest::isolate(),
"'use strict';\n"
"class myclass {\n"
" constructor() {\n"
" this.value = 1;\n"
" }\n"
" method() {\n"
" this.value = 2;\n"
" }\n"
"}");
CheckFunctionName(script, "this.value = 1", "myclass");
CheckFunctionName(script, "this.value = 2", "myclass.method");
}
TEST(AsParameter) { TEST(AsParameter) {
CcTest::InitializeVM(); CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate()); v8::HandleScope scope(CcTest::isolate());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment