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

Side by Side Diff: src/ast.cc

Issue 549207: Added validating JSON parser mode to parser. (Closed)
Patch Set: Created 10 years, 10 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/ast.h ('k') | src/compiler.cc » ('j') | src/parser.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 } 139 }
140 140
141 141
142 bool ObjectLiteral::Property::IsCompileTimeValue() { 142 bool ObjectLiteral::Property::IsCompileTimeValue() {
143 return kind_ == CONSTANT || 143 return kind_ == CONSTANT ||
144 (kind_ == MATERIALIZED_LITERAL && 144 (kind_ == MATERIALIZED_LITERAL &&
145 CompileTimeValue::IsCompileTimeValue(value_)); 145 CompileTimeValue::IsCompileTimeValue(value_));
146 } 146 }
147 147
148 148
149 bool ObjectLiteral::IsValidJSON() {
150 int length = properties()->length();
151 for (int i = 0; i < length; i++) {
152 Property* prop = properties()->at(i);
153 if (!prop->value()->IsValidJSON())
154 return false;
155 }
156 return true;
157 }
158
159
160 bool ArrayLiteral::IsValidJSON() {
161 int length = values()->length();
162 for (int i = 0; i < length; i++) {
163 if (!values()->at(i)->IsValidJSON())
164 return false;
165 }
166 return true;
167 }
168
169
170 void TargetCollector::AddTarget(BreakTarget* target) { 149 void TargetCollector::AddTarget(BreakTarget* target) {
171 // Add the label to the collector, but discard duplicates. 150 // Add the label to the collector, but discard duplicates.
172 int length = targets_->length(); 151 int length = targets_->length();
173 for (int i = 0; i < length; i++) { 152 for (int i = 0; i < length; i++) {
174 if (targets_->at(i) == target) return; 153 if (targets_->at(i) == target) return;
175 } 154 }
176 targets_->Add(target); 155 targets_->Add(target);
177 } 156 }
178 157
179 158
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 if (kInfinity - max_match_ < node_max_match) { 482 if (kInfinity - max_match_ < node_max_match) {
504 max_match_ = kInfinity; 483 max_match_ = kInfinity;
505 } else { 484 } else {
506 max_match_ += node->max_match(); 485 max_match_ += node->max_match();
507 } 486 }
508 } 487 }
509 } 488 }
510 489
511 490
512 } } // namespace v8::internal 491 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/compiler.cc » ('j') | src/parser.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698