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

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

Issue 2696783002: Properly resolve upper bounds of generic function's type parameters. (Closed)
Patch Set: Created 3 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 | « runtime/vm/kernel_reader.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 RUNTIME_VM_OBJECT_H_ 5 #ifndef RUNTIME_VM_OBJECT_H_
6 #define RUNTIME_VM_OBJECT_H_ 6 #define RUNTIME_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 2234 matching lines...) Expand 10 before | Expand all | Expand 10 after
2245 RawArray* parameter_names() const { return raw_ptr()->parameter_names_; } 2245 RawArray* parameter_names() const { return raw_ptr()->parameter_names_; }
2246 void set_parameter_names(const Array& value) const; 2246 void set_parameter_names(const Array& value) const;
2247 2247
2248 // The type parameters (and their bounds) are specified as an array of 2248 // The type parameters (and their bounds) are specified as an array of
2249 // TypeParameter. 2249 // TypeParameter.
2250 RawTypeArguments* type_parameters() const { 2250 RawTypeArguments* type_parameters() const {
2251 return raw_ptr()->type_parameters_; 2251 return raw_ptr()->type_parameters_;
2252 } 2252 }
2253 void set_type_parameters(const TypeArguments& value) const; 2253 void set_type_parameters(const TypeArguments& value) const;
2254 intptr_t NumTypeParameters(Thread* thread) const; 2254 intptr_t NumTypeParameters(Thread* thread) const;
2255 intptr_t NumTypeParameters() const {
2256 return NumTypeParameters(Thread::Current());
2257 }
2255 2258
2256 // Return a TypeParameter if the type_name is a type parameter of this 2259 // Return a TypeParameter if the type_name is a type parameter of this
2257 // function or of one of its parent functions. 2260 // function or of one of its parent functions.
2258 // Unless NULL, adjust function_level accordingly (in and out parameter). 2261 // Unless NULL, adjust function_level accordingly (in and out parameter).
2259 // Return null otherwise. 2262 // Return null otherwise.
2260 RawTypeParameter* LookupTypeParameter(const String& type_name, 2263 RawTypeParameter* LookupTypeParameter(const String& type_name,
2261 intptr_t* function_level) const; 2264 intptr_t* function_level) const;
2262 2265
2263 // Return true if this function declares type parameters. 2266 // Return true if this function declares type parameters.
2264 bool IsGeneric() const { return NumTypeParameters(Thread::Current()) > 0; } 2267 bool IsGeneric() const { return NumTypeParameters(Thread::Current()) > 0; }
(...skipping 3849 matching lines...) Expand 10 before | Expand all | Expand 10 after
6114 virtual intptr_t Hash() const; 6117 virtual intptr_t Hash() const;
6115 6118
6116 static intptr_t InstanceSize() { 6119 static intptr_t InstanceSize() {
6117 return RoundedAllocationSize(sizeof(RawTypeParameter)); 6120 return RoundedAllocationSize(sizeof(RawTypeParameter));
6118 } 6121 }
6119 6122
6120 // Only one of parameterized_class and parameterized_function is non-null. 6123 // Only one of parameterized_class and parameterized_function is non-null.
6121 static RawTypeParameter* New(const Class& parameterized_class, 6124 static RawTypeParameter* New(const Class& parameterized_class,
6122 const Function& parameterized_function, 6125 const Function& parameterized_function,
6123 intptr_t index, 6126 intptr_t index,
6127 intptr_t parent_level,
6124 const String& name, 6128 const String& name,
6125 const AbstractType& bound, 6129 const AbstractType& bound,
6126 TokenPosition token_pos); 6130 TokenPosition token_pos);
6127 6131
6128 private: 6132 private:
6129 intptr_t ComputeHash() const; 6133 intptr_t ComputeHash() const;
6130 void SetHash(intptr_t value) const; 6134 void SetHash(intptr_t value) const;
6131 6135
6132 void set_parameterized_class(const Class& value) const; 6136 void set_parameterized_class(const Class& value) const;
6133 void set_parameterized_function(const Function& value) const; 6137 void set_parameterized_function(const Function& value) const;
6134 void set_name(const String& value) const; 6138 void set_name(const String& value) const;
6135 void set_token_pos(TokenPosition token_pos) const; 6139 void set_token_pos(TokenPosition token_pos) const;
6136 void set_parent_level(uint8_t value) const; 6140 void set_parent_level(intptr_t value) const;
6137 void set_type_state(int8_t state) const; 6141 void set_type_state(int8_t state) const;
6138 6142
6139 static RawTypeParameter* New(); 6143 static RawTypeParameter* New();
6140 6144
6141 FINAL_HEAP_OBJECT_IMPLEMENTATION(TypeParameter, AbstractType); 6145 FINAL_HEAP_OBJECT_IMPLEMENTATION(TypeParameter, AbstractType);
6142 friend class Class; 6146 friend class Class;
6143 friend class ClearTypeHashVisitor; 6147 friend class ClearTypeHashVisitor;
6144 }; 6148 };
6145 6149
6146 6150
(...skipping 2764 matching lines...) Expand 10 before | Expand all | Expand 10 after
8911 8915
8912 inline void TypeArguments::SetHash(intptr_t value) const { 8916 inline void TypeArguments::SetHash(intptr_t value) const {
8913 // This is only safe because we create a new Smi, which does not cause 8917 // This is only safe because we create a new Smi, which does not cause
8914 // heap allocation. 8918 // heap allocation.
8915 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); 8919 StoreSmi(&raw_ptr()->hash_, Smi::New(value));
8916 } 8920 }
8917 8921
8918 } // namespace dart 8922 } // namespace dart
8919 8923
8920 #endif // RUNTIME_VM_OBJECT_H_ 8924 #endif // RUNTIME_VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/kernel_reader.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698