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

Side by Side Diff: src/preparser.h

Issue 982153003: [parser] better error message for generator constructors (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Added message tests Created 5 years, 9 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/messages.js ('k') | test/message/class-constructor-accessor.js » ('j') | 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 // 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 #ifndef V8_PREPARSER_H 5 #ifndef V8_PREPARSER_H
6 #define V8_PREPARSER_H 6 #define V8_PREPARSER_H
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/bailout-reason.h" 10 #include "src/bailout-reason.h"
(...skipping 3088 matching lines...) Expand 10 before | Expand all | Expand 10 after
3099 if (property == Token::SMI || property == Token::NUMBER) return; 3099 if (property == Token::SMI || property == Token::NUMBER) return;
3100 3100
3101 if (is_static) { 3101 if (is_static) {
3102 if (IsPrototype()) { 3102 if (IsPrototype()) {
3103 this->parser()->ReportMessage("static_prototype"); 3103 this->parser()->ReportMessage("static_prototype");
3104 *ok = false; 3104 *ok = false;
3105 return; 3105 return;
3106 } 3106 }
3107 } else if (IsConstructor()) { 3107 } else if (IsConstructor()) {
3108 if (is_generator || type == kAccessorProperty) { 3108 if (is_generator || type == kAccessorProperty) {
3109 this->parser()->ReportMessage("constructor_special_method"); 3109 const char* msg =
3110 is_generator ? "constructor_is_generator" : "constructor_is_accessor";
3111 this->parser()->ReportMessage(msg);
3110 *ok = false; 3112 *ok = false;
3111 return; 3113 return;
3112 } 3114 }
3113 if (has_seen_constructor_) { 3115 if (has_seen_constructor_) {
3114 this->parser()->ReportMessage("duplicate_constructor"); 3116 this->parser()->ReportMessage("duplicate_constructor");
3115 *ok = false; 3117 *ok = false;
3116 return; 3118 return;
3117 } 3119 }
3118 has_seen_constructor_ = true; 3120 has_seen_constructor_ = true;
3119 return; 3121 return;
3120 } 3122 }
3121 } 3123 }
3122 } } // v8::internal 3124 } } // v8::internal
3123 3125
3124 #endif // V8_PREPARSER_H 3126 #endif // V8_PREPARSER_H
OLDNEW
« no previous file with comments | « src/messages.js ('k') | test/message/class-constructor-accessor.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698