dart-sdk/tests/language/deferred_static_seperate_lib1.dart
sigurdm@google.com cf906beba3 dart2js: Fix of deferred static functions.
When deferred static functions go to a different output hunk than the
class they are defined in the emitter got problems with outputting them.

We could say that static functions always go to the same output-unit as
their class, and this is needed to support reflection. But we already
handle it that way when reflection is needed. In deferred_load.dart:

      void addLiveInstanceMember(Element element) {
        if (!compiler.enqueuer.resolution.hasBeenResolved(element)) return;
        if (!isMirrorUsage && !element.isInstanceMember) return;
        collectDependencies(element.implementation);
      }

R=floitsch@google.com

Review URL: https://codereview.chromium.org//810473003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42389 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-16 13:14:35 +00:00

51 lines
997 B
Dart

// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
library lib1;
class ConstClass {
final x;
const ConstClass(this.x);
}
var x = const ConstClass(const ConstClass(1));
class C {
static foo() {
() {} (); // Hack to avoid inlining.
return 1;
}
bar() {
() {} (); // Hack to avoid inlining.
return 1;
}
}
class C1 {
static var foo = const {};
var bar = const {};
}
class C2 {
static var foo = new Map.from({1: 2});
var bar = new Map.from({1: 2});
}
class C3 {
static final foo = const ConstClass(const ConstClass(1));
final bar = const ConstClass(const ConstClass(1));
}
class C4 {
static final foo = new Map.from({x: x});
final bar = new Map.from({x: x});
}
class C5 {
static const foo = const [const {1: 3}];
bar() {
() {} (); // Hack to avoid inlining.
return 1;
}
}