OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/compiler.h" | 7 #include "src/compiler.h" |
8 | 8 |
9 #include "src/ast-numbering.h" | 9 #include "src/ast-numbering.h" |
10 #include "src/ast-this-access-visitor.h" | 10 #include "src/ast-this-access-visitor.h" |
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 | 797 |
798 MessageLocation location(info->script(), stmt->position(), stmt->position()); | 798 MessageLocation location(info->script(), stmt->position(), stmt->position()); |
799 USE(info->isolate()->Throw(*exception, &location)); | 799 USE(info->isolate()->Throw(*exception, &location)); |
800 } | 800 } |
801 | 801 |
802 | 802 |
803 static bool CheckSuperConstructorCall(CompilationInfo* info) { | 803 static bool CheckSuperConstructorCall(CompilationInfo* info) { |
804 FunctionLiteral* function = info->function(); | 804 FunctionLiteral* function = info->function(); |
805 if (FLAG_experimental_classes) return true; | 805 if (FLAG_experimental_classes) return true; |
806 if (!function->uses_super_constructor_call()) return true; | 806 if (!function->uses_super_constructor_call()) return true; |
807 if (function->is_default_constructor()) return true; | 807 if (IsDefaultConstructor(function->kind())) return true; |
808 | 808 |
809 ZoneList<Statement*>* body = function->body(); | 809 ZoneList<Statement*>* body = function->body(); |
810 CHECK(body->length() > 0); | 810 CHECK(body->length() > 0); |
811 | 811 |
812 int super_call_index = 0; | 812 int super_call_index = 0; |
813 // Allow 'use strict' and similiar and empty statements. | 813 // Allow 'use strict' and similiar and empty statements. |
814 while (true) { | 814 while (true) { |
815 CHECK(super_call_index < body->length()); // We know there is a super call. | 815 CHECK(super_call_index < body->length()); // We know there is a super call. |
816 Statement* stmt = body->at(super_call_index); | 816 Statement* stmt = body->at(super_call_index); |
817 if (stmt->IsExpressionStatement() && | 817 if (stmt->IsExpressionStatement() && |
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1609 } | 1609 } |
1610 | 1610 |
1611 | 1611 |
1612 #if DEBUG | 1612 #if DEBUG |
1613 void CompilationInfo::PrintAstForTesting() { | 1613 void CompilationInfo::PrintAstForTesting() { |
1614 PrintF("--- Source from AST ---\n%s\n", | 1614 PrintF("--- Source from AST ---\n%s\n", |
1615 PrettyPrinter(isolate(), zone()).PrintProgram(function())); | 1615 PrettyPrinter(isolate(), zone()).PrintProgram(function())); |
1616 } | 1616 } |
1617 #endif | 1617 #endif |
1618 } } // namespace v8::internal | 1618 } } // namespace v8::internal |
OLD | NEW |