Skip to content

Commit b01750f

Browse files
author
John Messerly
committed
1 parent 3eca59c commit b01750f

File tree

8 files changed

+19
-26
lines changed

8 files changed

+19
-26
lines changed

pkg/dev_compiler/lib/runtime/dart/_interceptors.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,6 @@ var _interceptors;
856856
class _CodeUnits extends _internal.UnmodifiableListBase$(core.int) {
857857
_CodeUnits(string) {
858858
this[_string] = string;
859-
super.UnmodifiableListBase();
860859
}
861860
get [core.$length]() {
862861
return this[_string].length;

pkg/dev_compiler/lib/runtime/dart/_internal.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,6 @@ var _internal;
409409
this[_iterator] = iterator;
410410
this[_f] = f;
411411
this[_current] = null;
412-
super.Iterator();
413412
}
414413
moveNext() {
415414
if (this[_iterator].moveNext()) {
@@ -469,7 +468,6 @@ var _internal;
469468
WhereIterator(iterator, f) {
470469
this[_iterator] = iterator;
471470
this[_f] = f;
472-
super.Iterator();
473471
}
474472
moveNext() {
475473
while (this[_iterator].moveNext()) {
@@ -586,7 +584,6 @@ var _internal;
586584
TakeIterator(iterator, remaining) {
587585
this[_iterator] = iterator;
588586
this[_remaining] = remaining;
589-
super.Iterator();
590587
dart.assert(typeof this[_remaining] == 'number' && dart.notNull(this[_remaining]) >= 0);
591588
}
592589
moveNext() {
@@ -627,7 +624,6 @@ var _internal;
627624
this[_iterator] = iterator;
628625
this[_f] = f;
629626
this[_isFinished] = false;
630-
super.Iterator();
631627
}
632628
moveNext() {
633629
if (this[_isFinished])
@@ -701,7 +697,6 @@ var _internal;
701697
SkipIterator(iterator, skipCount) {
702698
this[_iterator] = iterator;
703699
this[_skipCount] = skipCount;
704-
super.Iterator();
705700
dart.assert(typeof this[_skipCount] == 'number' && dart.notNull(this[_skipCount]) >= 0);
706701
}
707702
moveNext() {
@@ -738,7 +733,6 @@ var _internal;
738733
this[_iterator] = iterator;
739734
this[_f] = f;
740735
this[_hasSkipped] = false;
741-
super.Iterator();
742736
}
743737
moveNext() {
744738
if (!dart.notNull(this[_hasSkipped])) {

pkg/dev_compiler/lib/runtime/dart/_js_helper.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2866,7 +2866,6 @@ var _js_helper;
28662866
this[_target] = target;
28672867
this[_receiver] = receiver;
28682868
this[_name] = name;
2869-
super.TearOffClosure();
28702869
}
28712870
['=='](other) {
28722871
if (core.identical(this, other))

pkg/dev_compiler/lib/runtime/dart/async.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,6 @@ var async;
796796
class _ControllerStream extends _StreamImpl$(T) {
797797
_ControllerStream(controller) {
798798
this[_controller] = controller;
799-
super._StreamImpl();
800799
}
801800
[_createSubscription](onData, onError, onDone, cancelOnError) {
802801
return this[_controller][_subscribe](onData, onError, onDone, cancelOnError);
@@ -3185,7 +3184,6 @@ var async;
31853184
_GeneratedStreamImpl(pending) {
31863185
this[_pending] = pending;
31873186
this[_isUsed] = false;
3188-
super._StreamImpl();
31893187
}
31903188
[_createSubscription](onData, onError, onDone, cancelOnError) {
31913189
if (this[_isUsed])

pkg/dev_compiler/lib/runtime/dart/collection.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ var collection;
66
class UnmodifiableListView extends _internal.UnmodifiableListBase$(E) {
77
UnmodifiableListView(source) {
88
this[_source] = source;
9-
super.UnmodifiableListBase();
109
}
1110
get [core.$length]() {
1211
return this[_source][core.$length];
@@ -4236,7 +4235,6 @@ var collection;
42364235
this[_nums] = null;
42374236
this[_rest] = null;
42384237
this[_elements] = null;
4239-
super._HashSetBase();
42404238
}
42414239
[_newSet]() {
42424240
return new (_HashSet$(E))();
@@ -4570,7 +4568,6 @@ var collection;
45704568
this[_first] = null;
45714569
this[_last] = null;
45724570
this[_modifications] = 0;
4573-
super._HashSetBase();
45744571
}
45754572
[_newSet]() {
45764573
return new (_LinkedHashSet$(E))();

pkg/dev_compiler/lib/runtime/dart/convert.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ var convert;
151151
_UnicodeSubsetEncoderSink(subsetMask, sink) {
152152
this[_subsetMask] = subsetMask;
153153
this[_sink] = sink;
154-
super.StringConversionSinkBase();
155154
}
156155
close() {
157156
this[_sink].close();
@@ -268,7 +267,6 @@ var convert;
268267
class _ErrorHandlingAsciiDecoderSink extends ByteConversionSinkBase {
269268
_ErrorHandlingAsciiDecoderSink(utf8Sink) {
270269
this[_utf8Sink] = utf8Sink;
271-
super.ByteConversionSinkBase();
272270
}
273271
close() {
274272
this[_utf8Sink].close();
@@ -296,7 +294,6 @@ var convert;
296294
class _SimpleAsciiDecoderSink extends ByteConversionSinkBase {
297295
_SimpleAsciiDecoderSink(sink) {
298296
this[_sink] = sink;
299-
super.ByteConversionSinkBase();
300297
}
301298
close() {
302299
this[_sink].close();
@@ -325,7 +322,6 @@ var convert;
325322
class _ByteAdapterSink extends ByteConversionSinkBase {
326323
_ByteAdapterSink(sink) {
327324
this[_sink] = sink;
328-
super.ByteConversionSinkBase();
329325
}
330326
add(chunk) {
331327
return this[_sink].add(chunk);
@@ -344,7 +340,6 @@ var convert;
344340
this[_buffer] = new typed_data.Uint8List(_ByteCallbackSink[_INITIAL_BUFFER_SIZE]);
345341
this[_callback] = callback;
346342
this[_bufferIndex] = 0;
347-
super.ByteConversionSinkBase();
348343
}
349344
add(chunk) {
350345
let freeCount = dart.notNull(this[_buffer][core.$length]) - dart.notNull(this[_bufferIndex]);
@@ -593,7 +588,6 @@ var convert;
593588
_HtmlEscapeSink(escape, sink) {
594589
this[_escape] = escape;
595590
this[_sink] = sink;
596-
super.StringConversionSinkBase();
597591
}
598592
addSlice(chunk, start, end, isLast) {
599593
let val = this[_escape][_convert](chunk, start, end);
@@ -1323,7 +1317,6 @@ var convert;
13231317
class _Latin1DecoderSink extends ByteConversionSinkBase {
13241318
_Latin1DecoderSink(sink) {
13251319
this[_sink] = sink;
1326-
super.ByteConversionSinkBase();
13271320
}
13281321
close() {
13291322
this[_sink].close();
@@ -1399,7 +1392,6 @@ var convert;
13991392
_LineSplitterSink(sink) {
14001393
this[_sink] = sink;
14011394
this[_carry] = null;
1402-
super.StringConversionSinkBase();
14031395
}
14041396
addSlice(chunk, start, end, isLast) {
14051397
if (this[_carry] != null) {
@@ -1564,7 +1556,6 @@ var convert;
15641556
class _StringSinkConversionSink extends StringConversionSinkBase {
15651557
_StringSinkConversionSink(stringSink) {
15661558
this[_stringSink] = stringSink;
1567-
super.StringConversionSinkBase();
15681559
}
15691560
close() {}
15701561
addSlice(str, start, end, isLast) {
@@ -1606,7 +1597,6 @@ var convert;
16061597
class _StringAdapterSink extends StringConversionSinkBase {
16071598
_StringAdapterSink(sink) {
16081599
this[_sink] = sink;
1609-
super.StringConversionSinkBase();
16101600
}
16111601
add(str) {
16121602
return this[_sink].add(str);

pkg/dev_compiler/lib/src/codegen/js_codegen.dart

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,8 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor {
651651
/// `C() : super() {}`.
652652
JS.Method _emitImplicitConstructor(
653653
ClassDeclaration node, String name, List<FieldDeclaration> fields) {
654+
assert(_hasUnnamedConstructor(node.element) == fields.isNotEmpty);
655+
654656
// If we don't have a method body, skip this.
655657
if (fields.isEmpty) return null;
656658

@@ -775,8 +777,7 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor {
775777
var superCtorName = node != null ? node.constructorName : null;
776778

777779
var element = clazz.element;
778-
if (superCtorName == null &&
779-
(element.type.isObject || element.supertype.isObject)) {
780+
if (superCtorName == null && !_shouldCallUnnamedSuperCtor(element)) {
780781
return null;
781782
}
782783

@@ -787,6 +788,22 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor {
787788
return js.statement('super.#(#);', [name, args])..sourceInformation = node;
788789
}
789790

791+
bool _shouldCallUnnamedSuperCtor(ClassElement e) {
792+
var supertype = e.supertype;
793+
if (supertype == null) return false;
794+
if (_hasUnnamedConstructor(supertype.element)) return true;
795+
for (var mixin in e.mixins) {
796+
if (_hasUnnamedConstructor(mixin.element)) return true;
797+
}
798+
return false;
799+
}
800+
801+
bool _hasUnnamedConstructor(ClassElement e) {
802+
if (e.type.isObject) return false;
803+
if (!e.unnamedConstructor.isSynthetic) return true;
804+
return e.fields.any((f) => !f.isStatic && !f.isSynthetic);
805+
}
806+
790807
/// Initialize fields. They follow the sequence:
791808
///
792809
/// 1. field declaration initializer if non-const,

pkg/dev_compiler/test/codegen/expect/fieldtest.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ var fieldtest;
6161
Derived() {
6262
this.foo = 2;
6363
this.bar = 3;
64-
super.BaseWithGetter();
6564
}
6665
}
6766
dart.virtualField(Derived, 'foo');

0 commit comments

Comments
 (0)