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

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

Issue 2349593003: Support generic method syntax (fixes #25869). (Closed)
Patch Set: 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 }
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 3796 matching lines...) Expand 10 before | Expand all | Expand 10 after
6098 } 6119 }
6099 virtual void SetIsFinalized() const; 6120 virtual void SetIsFinalized() const;
6100 virtual bool IsBeingFinalized() const { return false; } 6121 virtual bool IsBeingFinalized() const { return false; }
6101 virtual bool IsMalformed() const { return false; } 6122 virtual bool IsMalformed() const { return false; }
6102 virtual bool IsMalbounded() const { return false; } 6123 virtual bool IsMalbounded() const { return false; }
6103 virtual bool IsMalformedOrMalbounded() const { return false; } 6124 virtual bool IsMalformedOrMalbounded() const { return false; }
6104 virtual bool IsResolved() const { return true; } 6125 virtual bool IsResolved() const { return true; }
6105 virtual bool HasResolvedTypeClass() const { return false; } 6126 virtual bool HasResolvedTypeClass() const { return false; }
6106 classid_t parameterized_class_id() const; 6127 classid_t parameterized_class_id() const;
6107 RawClass* parameterized_class() const; 6128 RawClass* parameterized_class() const;
6129 RawFunction* parameterized_function() const {
6130 return raw_ptr()->parameterized_function_;
6131 }
6132 bool IsClassTypeParameter() const {
6133 return parameterized_class_id() != kIllegalCid;
6134 }
6135 bool IsFunctionTypeParameter() const {
6136 return parameterized_function() != Function::null();
6137 }
6108 RawString* name() const { return raw_ptr()->name_; } 6138 RawString* name() const { return raw_ptr()->name_; }
6109 intptr_t index() const { return raw_ptr()->index_; } 6139 intptr_t index() const { return raw_ptr()->index_; }
6110 void set_index(intptr_t value) const; 6140 void set_index(intptr_t value) const;
6111 RawAbstractType* bound() const { return raw_ptr()->bound_; } 6141 RawAbstractType* bound() const { return raw_ptr()->bound_; }
6112 void set_bound(const AbstractType& value) const; 6142 void set_bound(const AbstractType& value) const;
6113 // Returns true if bounded_type is below upper_bound, otherwise return false 6143 // Returns true if bounded_type is below upper_bound, otherwise return false
6114 // and set bound_error if both bounded_type and upper_bound are instantiated. 6144 // and set bound_error if both bounded_type and upper_bound are instantiated.
6115 // If one or both are not instantiated, returning false only means that the 6145 // If one or both are not instantiated, returning false only means that the
6116 // bound cannot be checked yet and this is not an error. 6146 // bound cannot be checked yet and this is not an error.
6117 bool CheckBound(const AbstractType& bounded_type, 6147 bool CheckBound(const AbstractType& bounded_type,
(...skipping 26 matching lines...) Expand all
6144 } 6174 }
6145 #endif // DEBUG 6175 #endif // DEBUG
6146 virtual RawString* EnumerateURIs() const; 6176 virtual RawString* EnumerateURIs() const;
6147 6177
6148 virtual intptr_t Hash() const; 6178 virtual intptr_t Hash() const;
6149 6179
6150 static intptr_t InstanceSize() { 6180 static intptr_t InstanceSize() {
6151 return RoundedAllocationSize(sizeof(RawTypeParameter)); 6181 return RoundedAllocationSize(sizeof(RawTypeParameter));
6152 } 6182 }
6153 6183
6184 // Only one of parameterized_class and parameterized_function is non-null.
6154 static RawTypeParameter* New(const Class& parameterized_class, 6185 static RawTypeParameter* New(const Class& parameterized_class,
6186 const Function& parameterized_function,
6155 intptr_t index, 6187 intptr_t index,
6156 const String& name, 6188 const String& name,
6157 const AbstractType& bound, 6189 const AbstractType& bound,
6158 TokenPosition token_pos); 6190 TokenPosition token_pos);
6159 6191
6160 private: 6192 private:
6161 intptr_t ComputeHash() const; 6193 intptr_t ComputeHash() const;
6162 void SetHash(intptr_t value) const; 6194 void SetHash(intptr_t value) const;
6163 6195
6164 void set_parameterized_class(const Class& value) const; 6196 void set_parameterized_class(const Class& value) const;
6197 void set_parameterized_function(const Function& value) const;
6165 void set_name(const String& value) const; 6198 void set_name(const String& value) const;
6166 void set_token_pos(TokenPosition token_pos) const; 6199 void set_token_pos(TokenPosition token_pos) const;
6167 void set_type_state(int8_t state) const; 6200 void set_type_state(int8_t state) const;
6168 6201
6169 static RawTypeParameter* New(); 6202 static RawTypeParameter* New();
6170 6203
6171 FINAL_HEAP_OBJECT_IMPLEMENTATION(TypeParameter, AbstractType); 6204 FINAL_HEAP_OBJECT_IMPLEMENTATION(TypeParameter, AbstractType);
6172 friend class Class; 6205 friend class Class;
6173 }; 6206 };
6174 6207
(...skipping 2773 matching lines...) Expand 10 before | Expand all | Expand 10 after
8948 8981
8949 inline void TypeArguments::SetHash(intptr_t value) const { 8982 inline void TypeArguments::SetHash(intptr_t value) const {
8950 // This is only safe because we create a new Smi, which does not cause 8983 // This is only safe because we create a new Smi, which does not cause
8951 // heap allocation. 8984 // heap allocation.
8952 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); 8985 StoreSmi(&raw_ptr()->hash_, Smi::New(value));
8953 } 8986 }
8954 8987
8955 } // namespace dart 8988 } // namespace dart
8956 8989
8957 #endif // VM_OBJECT_H_ 8990 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | runtime/vm/object.cc » ('j') | runtime/vm/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698