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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/resolution/members.dart

Issue 11299009: Support type literals as compile-time constants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 part of resolution; 5 part of resolution;
6 6
7 abstract class TreeElements { 7 abstract class TreeElements {
8 Element operator[](Node node); 8 Element operator[](Node node);
9 Selector getSelector(Send send); 9 Selector getSelector(Send send);
10 DartType getType(Node node); 10 DartType getType(Node node);
(...skipping 1519 matching lines...) Expand 10 before | Expand all | Expand 10 after
1530 MessageKind.WRONG_NUMBER_OF_ARGUMENTS_FOR_ASSERT, 1530 MessageKind.WRONG_NUMBER_OF_ARGUMENTS_FOR_ASSERT,
1531 [selector.argumentCount]); 1531 [selector.argumentCount]);
1532 } else if (selector.namedArgumentCount != 0) { 1532 } else if (selector.namedArgumentCount != 0) {
1533 error(node.selector, 1533 error(node.selector,
1534 MessageKind.ASSERT_IS_GIVEN_NAMED_ARGUMENTS, 1534 MessageKind.ASSERT_IS_GIVEN_NAMED_ARGUMENTS,
1535 [selector.namedArgumentCount]); 1535 [selector.namedArgumentCount]);
1536 } 1536 }
1537 return compiler.assertMethod; 1537 return compiler.assertMethod;
1538 } 1538 }
1539 1539
1540 return node.selector.accept(this); 1540 Element result = node.selector.accept(this);
1541 if (Elements.isClass(result)) {
1542 // If we use a class literal in a constant, the compile time constant
ngeoffray 2012/11/15 16:07:24 I think you should move that to the compile time c
karlklose 2012/11/19 15:08:58 Done.
1543 // emitter will generate a call to the runtime type cache helper, so we
1544 // resolve it and put it into the codegen work list.
1545 SourceString helperName = const SourceString('createRuntimeType');
1546 Element helper = compiler.findHelper(helperName);
1547 compiler.enqueuer.resolution.addToWorkList(helper);
1548 compiler.enqueuer.codegen.addToWorkList(helper);
1549 }
1550 return result;
1541 } 1551 }
1542 1552
1543 var oldCategory = allowedCategory; 1553 var oldCategory = allowedCategory;
1544 allowedCategory |= ElementCategory.PREFIX | ElementCategory.SUPER; 1554 allowedCategory |= ElementCategory.PREFIX | ElementCategory.SUPER;
1545 Element resolvedReceiver = visit(node.receiver); 1555 Element resolvedReceiver = visit(node.receiver);
1546 allowedCategory = oldCategory; 1556 allowedCategory = oldCategory;
1547 1557
1548 Element target; 1558 Element target;
1549 SourceString name = node.selector.asIdentifier().source; 1559 SourceString name = node.selector.asIdentifier().source;
1550 if (identical(name.stringValue, 'this')) { 1560 if (identical(name.stringValue, 'this')) {
(...skipping 1548 matching lines...) Expand 10 before | Expand all | Expand 10 after
3099 return e; 3109 return e;
3100 } 3110 }
3101 3111
3102 /// Assumed to be called by [resolveRedirectingFactory]. 3112 /// Assumed to be called by [resolveRedirectingFactory].
3103 Element visitReturn(Return node) { 3113 Element visitReturn(Return node) {
3104 Node expression = node.expression; 3114 Node expression = node.expression;
3105 return finishConstructorReference(visit(expression), 3115 return finishConstructorReference(visit(expression),
3106 expression, expression); 3116 expression, expression);
3107 } 3117 }
3108 } 3118 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698