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

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

Issue 2349593003: Support generic method syntax (fixes #25869). (Closed)
Patch Set: address comments Created 4 years, 3 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
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 2271 matching lines...) Expand 10 before | Expand all | Expand 10 after
2282 RawArray* parameter_types() const { return raw_ptr()->parameter_types_; } 2282 RawArray* parameter_types() const { return raw_ptr()->parameter_types_; }
2283 void set_parameter_types(const Array& value) const; 2283 void set_parameter_types(const Array& value) const;
2284 2284
2285 // Parameter names are valid for all valid parameter indices, and are not 2285 // Parameter names are valid for all valid parameter indices, and are not
2286 // limited to named optional parameters. 2286 // limited to named optional parameters.
2287 RawString* ParameterNameAt(intptr_t index) const; 2287 RawString* ParameterNameAt(intptr_t index) const;
2288 void SetParameterNameAt(intptr_t index, const String& value) const; 2288 void SetParameterNameAt(intptr_t index, const String& value) const;
2289 RawArray* parameter_names() const { return raw_ptr()->parameter_names_; } 2289 RawArray* parameter_names() const { return raw_ptr()->parameter_names_; }
2290 void set_parameter_names(const Array& value) const; 2290 void set_parameter_names(const Array& value) const;
2291 2291
2292 // The type parameters (and their bounds) are specified as an array of
2293 // TypeParameter.
2294 RawTypeArguments* type_parameters() const {
2295 return raw_ptr()->type_parameters_;
2296 }
2297 void set_type_parameters(const TypeArguments& value) const;
2298 intptr_t NumTypeParameters(Thread* thread) const;
2299 intptr_t NumTypeParameters() const {
2300 return NumTypeParameters(Thread::Current());
2301 }
siva 2016/09/19 23:23:46 Do we really want this version of NumTypeParmeters
regis 2016/09/23 00:35:23 Done.
2302
2303 // Return a TypeParameter if the type_name is a type parameter of this
2304 // function or of one of its parent functions.
2305 // Unless NULL, adjust function_level accordingly (in and out parameter).
2306 // Return null otherwise.
2307 RawTypeParameter* LookupTypeParameter(const String& type_name,
2308 intptr_t* function_level) const;
2309
2310 // Return true if this function declares type parameters.
2311 bool IsGeneric() const { return NumTypeParameters() > 0; }
2312
2292 // Not thread-safe; must be called in the main thread. 2313 // Not thread-safe; must be called in the main thread.
2293 // Sets function's code and code's function. 2314 // Sets function's code and code's function.
2294 void InstallOptimizedCode(const Code& code, bool is_osr) const; 2315 void InstallOptimizedCode(const Code& code, bool is_osr) const;
2295 void AttachCode(const Code& value) const; 2316 void AttachCode(const Code& value) const;
2296 void SetInstructions(const Code& value) const; 2317 void SetInstructions(const Code& value) const;
2297 void ClearCode() const; 2318 void ClearCode() const;
2298 2319
2299 // Disables optimized code and switches to unoptimized code. 2320 // Disables optimized code and switches to unoptimized code.
2300 void SwitchToUnoptimizedCode() const; 2321 void SwitchToUnoptimizedCode() const;
2301 2322
(...skipping 3797 matching lines...) Expand 10 before | Expand all | Expand 10 after
6099 } 6120 }
6100 virtual void SetIsFinalized() const; 6121 virtual void SetIsFinalized() const;
6101 virtual bool IsBeingFinalized() const { return false; } 6122 virtual bool IsBeingFinalized() const { return false; }
6102 virtual bool IsMalformed() const { return false; } 6123 virtual bool IsMalformed() const { return false; }
6103 virtual bool IsMalbounded() const { return false; } 6124 virtual bool IsMalbounded() const { return false; }
6104 virtual bool IsMalformedOrMalbounded() const { return false; } 6125 virtual bool IsMalformedOrMalbounded() const { return false; }
6105 virtual bool IsResolved() const { return true; } 6126 virtual bool IsResolved() const { return true; }
6106 virtual bool HasResolvedTypeClass() const { return false; } 6127 virtual bool HasResolvedTypeClass() const { return false; }
6107 classid_t parameterized_class_id() const; 6128 classid_t parameterized_class_id() const;
6108 RawClass* parameterized_class() const; 6129 RawClass* parameterized_class() const;
6130 RawFunction* parameterized_function() const {
6131 return raw_ptr()->parameterized_function_;
6132 }
6133 bool IsClassTypeParameter() const {
6134 return parameterized_class_id() != kIllegalCid;
6135 }
6136 bool IsFunctionTypeParameter() const {
6137 return parameterized_function() != Function::null();
6138 }
6109 RawString* name() const { return raw_ptr()->name_; } 6139 RawString* name() const { return raw_ptr()->name_; }
6110 intptr_t index() const { return raw_ptr()->index_; } 6140 intptr_t index() const { return raw_ptr()->index_; }
6111 void set_index(intptr_t value) const; 6141 void set_index(intptr_t value) const;
6112 RawAbstractType* bound() const { return raw_ptr()->bound_; } 6142 RawAbstractType* bound() const { return raw_ptr()->bound_; }
6113 void set_bound(const AbstractType& value) const; 6143 void set_bound(const AbstractType& value) const;
6114 // Returns true if bounded_type is below upper_bound, otherwise return false 6144 // Returns true if bounded_type is below upper_bound, otherwise return false
6115 // and set bound_error if both bounded_type and upper_bound are instantiated. 6145 // and set bound_error if both bounded_type and upper_bound are instantiated.
6116 // If one or both are not instantiated, returning false only means that the 6146 // If one or both are not instantiated, returning false only means that the
6117 // bound cannot be checked yet and this is not an error. 6147 // bound cannot be checked yet and this is not an error.
6118 bool CheckBound(const AbstractType& bounded_type, 6148 bool CheckBound(const AbstractType& bounded_type,
(...skipping 26 matching lines...) Expand all
6145 } 6175 }
6146 #endif // DEBUG 6176 #endif // DEBUG
6147 virtual RawString* EnumerateURIs() const; 6177 virtual RawString* EnumerateURIs() const;
6148 6178
6149 virtual intptr_t Hash() const; 6179 virtual intptr_t Hash() const;
6150 6180
6151 static intptr_t InstanceSize() { 6181 static intptr_t InstanceSize() {
6152 return RoundedAllocationSize(sizeof(RawTypeParameter)); 6182 return RoundedAllocationSize(sizeof(RawTypeParameter));
6153 } 6183 }
6154 6184
6185 // Only one of parameterized_class and parameterized_function is non-null.
6155 static RawTypeParameter* New(const Class& parameterized_class, 6186 static RawTypeParameter* New(const Class& parameterized_class,
6187 const Function& parameterized_function,
6156 intptr_t index, 6188 intptr_t index,
6157 const String& name, 6189 const String& name,
6158 const AbstractType& bound, 6190 const AbstractType& bound,
6159 TokenPosition token_pos); 6191 TokenPosition token_pos);
6160 6192
6161 private: 6193 private:
6162 intptr_t ComputeHash() const; 6194 intptr_t ComputeHash() const;
6163 void SetHash(intptr_t value) const; 6195 void SetHash(intptr_t value) const;
6164 6196
6165 void set_parameterized_class(const Class& value) const; 6197 void set_parameterized_class(const Class& value) const;
6198 void set_parameterized_function(const Function& value) const;
6166 void set_name(const String& value) const; 6199 void set_name(const String& value) const;
6167 void set_token_pos(TokenPosition token_pos) const; 6200 void set_token_pos(TokenPosition token_pos) const;
6168 void set_type_state(int8_t state) const; 6201 void set_type_state(int8_t state) const;
6169 6202
6170 static RawTypeParameter* New(); 6203 static RawTypeParameter* New();
6171 6204
6172 FINAL_HEAP_OBJECT_IMPLEMENTATION(TypeParameter, AbstractType); 6205 FINAL_HEAP_OBJECT_IMPLEMENTATION(TypeParameter, AbstractType);
6173 friend class Class; 6206 friend class Class;
6174 }; 6207 };
6175 6208
(...skipping 2773 matching lines...) Expand 10 before | Expand all | Expand 10 after
8949 8982
8950 inline void TypeArguments::SetHash(intptr_t value) const { 8983 inline void TypeArguments::SetHash(intptr_t value) const {
8951 // This is only safe because we create a new Smi, which does not cause 8984 // This is only safe because we create a new Smi, which does not cause
8952 // heap allocation. 8985 // heap allocation.
8953 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); 8986 StoreSmi(&raw_ptr()->hash_, Smi::New(value));
8954 } 8987 }
8955 8988
8956 } // namespace dart 8989 } // namespace dart
8957 8990
8958 #endif // VM_OBJECT_H_ 8991 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | runtime/vm/object.cc » ('j') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698