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

Unified Diff: pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart

Issue 802653005: dart2js: put all type-test related properties on the prototype and not on the constructor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add workaround for non-existing classes. Created 6 years 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 | « no previous file | pkg/compiler/lib/src/js_emitter/old_emitter/type_test_emitter.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
diff --git a/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart b/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
index ad8fa35a7bbcbbf690141ca3007118df8013784f..877477e60025bd0c83ff1a788b0d561820dfa0e4 100644
--- a/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
@@ -411,6 +411,17 @@ class OldEmitter implements Emitter {
function tmp() {}
var hasOwnProperty = Object.prototype.hasOwnProperty;
return function (constructor, superConstructor) {
+ if (superConstructor == null) {
+ // TODO(21896): this test shouldn't be necessary. Without it
+ // we have a crash in language/mixin_only_for_rti and
+ // pkg/analysis_server/tool/spec/check_all_test.
+ if (constructor == null) return;
+
+ // Fix up the the Dart Object class' prototype.
+ var prototype = constructor.prototype;
+ prototype.constructor = constructor;
+ return prototype;
+ }
tmp.prototype = superConstructor.prototype;
var object = new tmp();
var properties = constructor.prototype;
@@ -608,8 +619,9 @@ class OldEmitter implements Emitter {
var mixinClass = s[1];
finishClass(mixinClass);
var mixin = allClasses[mixinClass];
- // TODO(floitsch): this test shouldn't be necessary. Without it
- // we have a crash in pkg/analysis_server/tool/spec/check_all_test.
+ // TODO(21896): this test shouldn't be necessary. Without it
+ // we have a crash in language/mixin_only_for_rti and
+ // pkg/analysis_server/tool/spec/check_all_test.
if (mixin) {
var mixinPrototype = mixin.prototype;
var clsPrototype = allClasses[cls].prototype;
@@ -626,7 +638,10 @@ class OldEmitter implements Emitter {
// class. The minifier together with noSuchMethod can put methods on
// the Object.prototype object, and they show through here, so we check
// that we have a string.
- if (!superclass || typeof superclass != "string") return;
+ if (!superclass || typeof superclass != "string") {
+ inheritFrom(allClasses[cls], null);
+ return;
+ }
finishClass(superclass);
var superConstructor = allClasses[superclass];
@@ -1703,7 +1718,6 @@ class OldEmitter implements Emitter {
emitFinishClassesInvocationIfNecessary(mainBuffer);
}
- typeTestEmitter.emitRuntimeTypeSupport(mainBuffer, mainOutputUnit);
interceptorEmitter.emitGetInterceptorMethods(mainBuffer);
interceptorEmitter.emitOneShotInterceptors(mainBuffer);
@@ -2174,7 +2188,6 @@ function(originalDescriptor, name, holder, isStatic, globalFunctionsAccess) {
// point to the current Isolate. Otherwise all methods/functions
// accessing isolate variables will access the wrong object.
outputBuffer.write("${namer.currentIsolate}$_=${_}arguments[1]$N");
- typeTestEmitter.emitRuntimeTypeSupport(outputBuffer, outputUnit);
emitCompileTimeConstants(outputBuffer, outputUnit);
emitStaticNonFinalFieldInitializations(outputBuffer, outputUnit);
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_emitter/old_emitter/type_test_emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698