bd3255ed6a
Adds support for: - Type literals - By-value reference to top-level or static function - Const constructor invocation inside const literal list or map Nested const expressions are linearized to LetPrims, and we rely on the dart_tree to inline all primitives (since non-const variable references may not occur in a const expression). There are still a bunch of constants that we support but don't actually treat as constants. Reference to top-level constants are still treated as a getter invocations, for instance. We bail out on local constant declarations since they must either be inlined at multiple places or we must generate a constant declaration for them. BUG= R=kmillikin@google.com, sigurdm@google.com Review URL: https://codereview.chromium.org//348053002 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37585 260f80e4-7a28-3924-810f-c04153c831b5
24 lines
748 B
Dart
24 lines
748 B
Dart
// Copyright (c) 2011, 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.
|
|
|
|
import "package:expect/expect.dart";
|
|
|
|
main() {
|
|
var a = {1: 'a', 2: 'b', 3: 'c'};
|
|
var b = {1: 'a', 2: 'b', 3: 'c'};
|
|
Expect.equals(false, a == b);
|
|
|
|
a = const {1: 'a', 2: 'b', 3: 'c'};
|
|
b = const {1: 'a', 2: 'b', 3: 'c'};
|
|
Expect.equals(true, a == b);
|
|
|
|
a = const <num,String>{1: 'a', 2: 'b', 3: 'c'};
|
|
b = const {1: 'a', 2: 'b', 3: 'c'};
|
|
Expect.equals(false, a == b);
|
|
|
|
a = const <dynamic,dynamic>{1: 'a', 2: 'b', 3: 'c'};
|
|
b = const {1: 'a', 2: 'b', 3: 'c'};
|
|
Expect.equals(true, a == b);
|
|
}
|