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

Side by Side Diff: runtime/vm/parser.cc

Issue 10280007: Check upper bounds of type arguments when allocating objects of a generic type (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/parser.h" 5 #include "vm/parser.h"
6 6
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/compiler_stats.h" 10 #include "vm/compiler_stats.h"
(...skipping 7833 matching lines...) Expand 10 before | Expand all | Expand 10 after
7844 if (!type_arguments.IsNull() && 7844 if (!type_arguments.IsNull() &&
7845 !type_arguments.IsInstantiated() && 7845 !type_arguments.IsInstantiated() &&
7846 (current_block_->scope->function_level() > 0)) { 7846 (current_block_->scope->function_level() > 0)) {
7847 // Make sure that the instantiator is captured. 7847 // Make sure that the instantiator is captured.
7848 CaptureReceiver(); 7848 CaptureReceiver();
7849 } 7849 }
7850 if (type.IsMalformed()) { 7850 if (type.IsMalformed()) {
7851 // Compile the throw of a dynamic type error due to a bound error. 7851 // Compile the throw of a dynamic type error due to a bound error.
7852 return ThrowTypeError(type_pos, type); 7852 return ThrowTypeError(type_pos, type);
7853 } 7853 }
7854 // TODO(regis): If the type argument vector is not instantiated, we need to 7854 // If the type argument vector is not instantiated, we verify in checked
7855 // verify in checked mode at runtime that it is within its declared bounds. 7855 // mode at runtime that it is within its declared bounds.
7856 new_object = new ConstructorCallNode( 7856 new_object = new ConstructorCallNode(
7857 new_pos, type_arguments, constructor, arguments); 7857 new_pos, type_arguments, constructor, arguments);
7858 } 7858 }
7859 return new_object; 7859 return new_object;
7860 } 7860 }
7861 7861
7862 7862
7863 String& Parser::Interpolate(ArrayNode* values) { 7863 String& Parser::Interpolate(ArrayNode* values) {
7864 const String& class_name = 7864 const String& class_name =
7865 String::Handle(String::NewSymbol(kStringClassName)); 7865 String::Handle(String::NewSymbol(kStringClassName));
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
8424 void Parser::SkipQualIdent() { 8424 void Parser::SkipQualIdent() {
8425 ASSERT(IsIdentifier()); 8425 ASSERT(IsIdentifier());
8426 ConsumeToken(); 8426 ConsumeToken();
8427 if (CurrentToken() == Token::kPERIOD) { 8427 if (CurrentToken() == Token::kPERIOD) {
8428 ConsumeToken(); // Consume the kPERIOD token. 8428 ConsumeToken(); // Consume the kPERIOD token.
8429 ExpectIdentifier("identifier expected after '.'"); 8429 ExpectIdentifier("identifier expected after '.'");
8430 } 8430 }
8431 } 8431 }
8432 8432
8433 } // namespace dart 8433 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698