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

Unified Diff: runtime/vm/raw_object.h

Issue 1815733003: Remove recently introduced FunctionType vm class by merging it into class Type. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: address comment Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/precompiler.cc ('k') | runtime/vm/raw_object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/raw_object.h
diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
index 6f33280dd301071387d4ca00ed52527f1ebb5660..65bf47f0abdce031e8bdfba6aa0f9b9457a41381 100644
--- a/runtime/vm/raw_object.h
+++ b/runtime/vm/raw_object.h
@@ -52,7 +52,6 @@ namespace dart {
V(LibraryPrefix) \
V(AbstractType) \
V(Type) \
- V(FunctionType) \
V(TypeRef) \
V(TypeParameter) \
V(BoundedType) \
@@ -868,7 +867,7 @@ class RawClosureData : public RawObject {
}
RawContextScope* context_scope_;
RawFunction* parent_function_; // Enclosing function of this local function.
- RawFunctionType* signature_type_;
+ RawType* signature_type_;
RawInstance* closure_; // Closure object for static implicit closures.
RawObject** to() {
return reinterpret_cast<RawObject**>(&ptr()->closure_);
@@ -1617,28 +1616,18 @@ class RawType : public RawAbstractType {
}
RawObject* type_class_; // Either resolved class or unresolved class.
RawTypeArguments* arguments_;
- RawLanguageError* error_; // Error object if type is malformed or malbounded.
- RawObject** to() {
- return reinterpret_cast<RawObject**>(&ptr()->error_);
- }
- TokenPosition token_pos_;
- int8_t type_state_;
-};
-
-
-class RawFunctionType : public RawAbstractType {
- private:
- RAW_HEAP_OBJECT_IMPLEMENTATION(FunctionType);
-
- RawObject** from() {
- return reinterpret_cast<RawObject**>(&ptr()->scope_class_);
- }
- RawClass* scope_class_;
- RawTypeArguments* arguments_;
- RawFunction* signature_;
- RawLanguageError* error_; // Error object if type is malformed or malbounded.
+ // This type object represents a function type if its signature field is a
+ // non-null function object.
+ // If this type is malformed or malbounded, the signature field gets
+ // overwritten by the error object in order to save space. If the type is a
+ // function type, its signature is lost, but the message in the error object
+ // can describe the issue without needing the signature.
+ union {
+ RawFunction* signature_; // If not null, this type is a function type.
+ RawLanguageError* error_; // If not null, type is malformed or malbounded.
+ } sig_or_err_;
RawObject** to() {
- return reinterpret_cast<RawObject**>(&ptr()->error_);
+ return reinterpret_cast<RawObject**>(&ptr()->sig_or_err_.error_);
}
TokenPosition token_pos_;
int8_t type_state_;
« no previous file with comments | « runtime/vm/precompiler.cc ('k') | runtime/vm/raw_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698