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

Side by Side Diff: runtime/vm/class_finalizer.cc

Issue 1644793002: Replace intptr_t with TokenDescriptor (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 #include "vm/class_finalizer.h" 5 #include "vm/class_finalizer.h"
6 6
7 #include "vm/code_generator.h" 7 #include "vm/code_generator.h"
8 #include "vm/flags.h" 8 #include "vm/flags.h"
9 #include "vm/heap.h" 9 #include "vm/heap.h"
10 #include "vm/isolate.h" 10 #include "vm/isolate.h"
(...skipping 2045 matching lines...) Expand 10 before | Expand all | Expand 10 after
2056 } 2056 }
2057 Type& mixin_type = Type::Handle(mixin_app_class.mixin()); 2057 Type& mixin_type = Type::Handle(mixin_app_class.mixin());
2058 ASSERT(!mixin_type.IsNull()); 2058 ASSERT(!mixin_type.IsNull());
2059 ASSERT(mixin_type.HasResolvedTypeClass()); 2059 ASSERT(mixin_type.HasResolvedTypeClass());
2060 const Class& mixin_class = Class::Handle(mixin_type.type_class()); 2060 const Class& mixin_class = Class::Handle(mixin_type.type_class());
2061 2061
2062 if (FLAG_trace_class_finalization) { 2062 if (FLAG_trace_class_finalization) {
2063 THR_Print("Applying mixin type '%s' to %s at pos %" Pd "\n", 2063 THR_Print("Applying mixin type '%s' to %s at pos %" Pd "\n",
2064 String::Handle(mixin_type.Name()).ToCString(), 2064 String::Handle(mixin_type.Name()).ToCString(),
2065 mixin_app_class.ToCString(), 2065 mixin_app_class.ToCString(),
2066 mixin_app_class.token_pos()); 2066 mixin_app_class.token_pos().value());
2067 } 2067 }
2068 2068
2069 // Check for illegal self references. 2069 // Check for illegal self references.
2070 GrowableArray<intptr_t> visited_mixins; 2070 GrowableArray<intptr_t> visited_mixins;
2071 if (!IsMixinCycleFree(mixin_class, &visited_mixins)) { 2071 if (!IsMixinCycleFree(mixin_class, &visited_mixins)) {
2072 const String& class_name = String::Handle(mixin_class.Name()); 2072 const String& class_name = String::Handle(mixin_class.Name());
2073 ReportError(mixin_class, mixin_class.token_pos(), 2073 ReportError(mixin_class, mixin_class.token_pos(),
2074 "mixin class '%s' illegally refers to itself", 2074 "mixin class '%s' illegally refers to itself",
2075 class_name.ToCString()); 2075 class_name.ToCString());
2076 } 2076 }
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
2186 // class. Members of the actual mixin class will be applied when visiting 2186 // class. Members of the actual mixin class will be applied when visiting
2187 // the mixin application class referring to the actual mixin. 2187 // the mixin application class referring to the actual mixin.
2188 ASSERT(!mixin_cls.is_mixin_app_alias() || 2188 ASSERT(!mixin_cls.is_mixin_app_alias() ||
2189 Class::Handle(zone, cls.SuperClass()).IsMixinApplication()); 2189 Class::Handle(zone, cls.SuperClass()).IsMixinApplication());
2190 // A default constructor will be created for the mixin app alias class. 2190 // A default constructor will be created for the mixin app alias class.
2191 2191
2192 if (FLAG_trace_class_finalization) { 2192 if (FLAG_trace_class_finalization) {
2193 THR_Print("Applying mixin members of %s to %s at pos %" Pd "\n", 2193 THR_Print("Applying mixin members of %s to %s at pos %" Pd "\n",
2194 mixin_cls.ToCString(), 2194 mixin_cls.ToCString(),
2195 cls.ToCString(), 2195 cls.ToCString(),
2196 cls.token_pos()); 2196 cls.token_pos().value());
2197 } 2197 }
2198 2198
2199 const GrowableObjectArray& cloned_funcs = 2199 const GrowableObjectArray& cloned_funcs =
2200 GrowableObjectArray::Handle(zone, GrowableObjectArray::New()); 2200 GrowableObjectArray::Handle(zone, GrowableObjectArray::New());
2201 2201
2202 CreateForwardingConstructors(cls, mixin_cls, cloned_funcs); 2202 CreateForwardingConstructors(cls, mixin_cls, cloned_funcs);
2203 2203
2204 Array& functions = Array::Handle(zone); 2204 Array& functions = Array::Handle(zone);
2205 Function& func = Function::Handle(zone); 2205 Function& func = Function::Handle(zone);
2206 // The parser creates the mixin application class with no functions. 2206 // The parser creates the mixin application class with no functions.
(...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after
3112 } else { 3112 } else {
3113 // The only case where the malformed type was already finalized is when its 3113 // The only case where the malformed type was already finalized is when its
3114 // type arguments are not within bounds. In that case, we have a prev_error. 3114 // type arguments are not within bounds. In that case, we have a prev_error.
3115 ASSERT(!prev_error.IsNull()); 3115 ASSERT(!prev_error.IsNull());
3116 } 3116 }
3117 } 3117 }
3118 3118
3119 3119
3120 RawType* ClassFinalizer::NewFinalizedMalformedType(const Error& prev_error, 3120 RawType* ClassFinalizer::NewFinalizedMalformedType(const Error& prev_error,
3121 const Script& script, 3121 const Script& script,
3122 intptr_t type_pos, 3122 TokenDescriptor type_pos,
3123 const char* format, ...) { 3123 const char* format, ...) {
3124 va_list args; 3124 va_list args;
3125 va_start(args, format); 3125 va_start(args, format);
3126 const UnresolvedClass& unresolved_class = UnresolvedClass::Handle( 3126 const UnresolvedClass& unresolved_class = UnresolvedClass::Handle(
3127 UnresolvedClass::New(LibraryPrefix::Handle(), 3127 UnresolvedClass::New(LibraryPrefix::Handle(),
3128 Symbols::Empty(), 3128 Symbols::Empty(),
3129 type_pos)); 3129 type_pos));
3130 const Type& type = Type::Handle( 3130 const Type& type = Type::Handle(
3131 Type::New(unresolved_class, TypeArguments::Handle(), type_pos)); 3131 Type::New(unresolved_class, TypeArguments::Handle(), type_pos));
3132 MarkTypeMalformed(prev_error, script, type, format, args); 3132 MarkTypeMalformed(prev_error, script, type, format, args);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
3172 3172
3173 3173
3174 void ClassFinalizer::ReportError(const Error& error) { 3174 void ClassFinalizer::ReportError(const Error& error) {
3175 Report::LongJump(error); 3175 Report::LongJump(error);
3176 UNREACHABLE(); 3176 UNREACHABLE();
3177 } 3177 }
3178 3178
3179 3179
3180 void ClassFinalizer::ReportErrors(const Error& prev_error, 3180 void ClassFinalizer::ReportErrors(const Error& prev_error,
3181 const Class& cls, 3181 const Class& cls,
3182 intptr_t token_pos, 3182 TokenDescriptor token_pos,
3183 const char* format, ...) { 3183 const char* format, ...) {
3184 va_list args; 3184 va_list args;
3185 va_start(args, format); 3185 va_start(args, format);
3186 const Script& script = Script::Handle(cls.script()); 3186 const Script& script = Script::Handle(cls.script());
3187 Report::LongJumpV(prev_error, script, token_pos, format, args); 3187 Report::LongJumpV(prev_error, script, token_pos, format, args);
3188 va_end(args); 3188 va_end(args);
3189 UNREACHABLE(); 3189 UNREACHABLE();
3190 } 3190 }
3191 3191
3192 3192
3193 void ClassFinalizer::ReportError(const Class& cls, 3193 void ClassFinalizer::ReportError(const Class& cls,
3194 intptr_t token_pos, 3194 TokenDescriptor token_pos,
3195 const char* format, ...) { 3195 const char* format, ...) {
3196 va_list args; 3196 va_list args;
3197 va_start(args, format); 3197 va_start(args, format);
3198 const Script& script = Script::Handle(cls.script()); 3198 const Script& script = Script::Handle(cls.script());
3199 Report::MessageV(Report::kError, 3199 Report::MessageV(Report::kError,
3200 script, token_pos, Report::AtLocation, format, args); 3200 script, token_pos, Report::AtLocation, format, args);
3201 va_end(args); 3201 va_end(args);
3202 UNREACHABLE(); 3202 UNREACHABLE();
3203 } 3203 }
3204 3204
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
3271 ASSERT(fields_array.Length() == ByteBuffer::NumberOfFields()); 3271 ASSERT(fields_array.Length() == ByteBuffer::NumberOfFields());
3272 field ^= fields_array.At(0); 3272 field ^= fields_array.At(0);
3273 ASSERT(field.Offset() == ByteBuffer::data_offset()); 3273 ASSERT(field.Offset() == ByteBuffer::data_offset());
3274 name ^= field.name(); 3274 name ^= field.name();
3275 expected_name ^= String::New("_data"); 3275 expected_name ^= String::New("_data");
3276 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); 3276 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name));
3277 #endif 3277 #endif
3278 } 3278 }
3279 3279
3280 } // namespace dart 3280 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698