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

Side by Side Diff: runtime/vm/object.h

Issue 66033006: Check type bounds of redirecting factories (issue 14699). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « runtime/vm/exceptions.cc ('k') | runtime/vm/object.cc » ('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 (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 #ifndef VM_OBJECT_H_ 5 #ifndef VM_OBJECT_H_
6 #define VM_OBJECT_H_ 6 #define VM_OBJECT_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/utils.h" 10 #include "platform/utils.h"
(...skipping 4212 matching lines...) Expand 10 before | Expand all | Expand 10 after
4223 virtual bool HasResolvedTypeClass() const { return false; } 4223 virtual bool HasResolvedTypeClass() const { return false; }
4224 RawClass* parameterized_class() const { 4224 RawClass* parameterized_class() const {
4225 return raw_ptr()->parameterized_class_; 4225 return raw_ptr()->parameterized_class_;
4226 } 4226 }
4227 RawString* name() const { return raw_ptr()->name_; } 4227 RawString* name() const { return raw_ptr()->name_; }
4228 intptr_t index() const { return raw_ptr()->index_; } 4228 intptr_t index() const { return raw_ptr()->index_; }
4229 void set_index(intptr_t value) const; 4229 void set_index(intptr_t value) const;
4230 RawAbstractType* bound() const { return raw_ptr()->bound_; } 4230 RawAbstractType* bound() const { return raw_ptr()->bound_; }
4231 void set_bound(const AbstractType& value) const; 4231 void set_bound(const AbstractType& value) const;
4232 // Returns true if bounded_type is below upper_bound, otherwise return false 4232 // Returns true if bounded_type is below upper_bound, otherwise return false
4233 // and set bound_error if not NULL. 4233 // and set bound_error if both bounded_type and upper_bound are instantiated.
4234 // If one or both are not instantiated, returning false only means that the
4235 // bound cannot be checked yet and this is not an error.
4234 bool CheckBound(const AbstractType& bounded_type, 4236 bool CheckBound(const AbstractType& bounded_type,
4235 const AbstractType& upper_bound, 4237 const AbstractType& upper_bound,
4236 Error* bound_error) const; 4238 Error* bound_error) const;
4237 virtual intptr_t token_pos() const { return raw_ptr()->token_pos_; } 4239 virtual intptr_t token_pos() const { return raw_ptr()->token_pos_; }
4238 virtual bool IsInstantiated() const { return false; } 4240 virtual bool IsInstantiated() const { return false; }
4239 virtual bool Equals(const Instance& other) const; 4241 virtual bool Equals(const Instance& other) const;
4240 virtual RawAbstractType* InstantiateFrom( 4242 virtual RawAbstractType* InstantiateFrom(
4241 const AbstractTypeArguments& instantiator_type_arguments, 4243 const AbstractTypeArguments& instantiator_type_arguments,
4242 Error* bound_error) const; 4244 Error* bound_error) const;
4243 virtual RawAbstractType* CloneUnfinalized() const; 4245 virtual RawAbstractType* CloneUnfinalized() const;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
4301 } 4303 }
4302 RawAbstractType* type() const { return raw_ptr()->type_; } 4304 RawAbstractType* type() const { return raw_ptr()->type_; }
4303 RawAbstractType* bound() const { return raw_ptr()->bound_; } 4305 RawAbstractType* bound() const { return raw_ptr()->bound_; }
4304 RawTypeParameter* type_parameter() const { 4306 RawTypeParameter* type_parameter() const {
4305 return raw_ptr()->type_parameter_; 4307 return raw_ptr()->type_parameter_;
4306 } 4308 }
4307 virtual intptr_t token_pos() const { 4309 virtual intptr_t token_pos() const {
4308 return AbstractType::Handle(type()).token_pos(); 4310 return AbstractType::Handle(type()).token_pos();
4309 } 4311 }
4310 virtual bool IsInstantiated() const { 4312 virtual bool IsInstantiated() const {
4313 // It is not possible to encounter an instantiated bounded type with an
4314 // uninstantiated upper bound. Therefore, we do not need to check if the
4315 // bound is instantiated. Moreover, doing so could lead into cycles, as in
4316 // class C<T extends C<C>> { }.
4311 return AbstractType::Handle(type()).IsInstantiated(); 4317 return AbstractType::Handle(type()).IsInstantiated();
4312 } 4318 }
4313 virtual bool Equals(const Instance& other) const; 4319 virtual bool Equals(const Instance& other) const;
4314 virtual RawAbstractType* InstantiateFrom( 4320 virtual RawAbstractType* InstantiateFrom(
4315 const AbstractTypeArguments& instantiator_type_arguments, 4321 const AbstractTypeArguments& instantiator_type_arguments,
4316 Error* bound_error) const; 4322 Error* bound_error) const;
4317 virtual RawAbstractType* CloneUnfinalized() const; 4323 virtual RawAbstractType* CloneUnfinalized() const;
4318 virtual RawAbstractType* Canonicalize() const { return raw(); } 4324 virtual RawAbstractType* Canonicalize() const { return raw(); }
4319 4325
4320 virtual intptr_t Hash() const; 4326 virtual intptr_t Hash() const;
(...skipping 2060 matching lines...) Expand 10 before | Expand all | Expand 10 after
6381 6387
6382 6388
6383 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 6389 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
6384 intptr_t index) { 6390 intptr_t index) {
6385 return array.At((index * kEntryLength) + kTargetFunctionIndex); 6391 return array.At((index * kEntryLength) + kTargetFunctionIndex);
6386 } 6392 }
6387 6393
6388 } // namespace dart 6394 } // namespace dart
6389 6395
6390 #endif // VM_OBJECT_H_ 6396 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/exceptions.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698