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

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

Issue 11304021: Add NativeEnqueuer to work with the Enqueuer. (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 1743 matching lines...) Expand 10 before | Expand all | Expand 10 after
1754 // with the same arguments. 1754 // with the same arguments.
1755 Selector call = new Selector.callClosureFrom(selector); 1755 Selector call = new Selector.callClosureFrom(selector);
1756 world.registerDynamicInvocation(call.name, call); 1756 world.registerDynamicInvocation(call.name, call);
1757 } else if (target.impliesType()) { 1757 } else if (target.impliesType()) {
1758 // We call 'call()' on a Type instance returned from the reference to a 1758 // We call 'call()' on a Type instance returned from the reference to a
1759 // class or typedef literal. We do not need to register this call as a 1759 // class or typedef literal. We do not need to register this call as a
1760 // dynamic invocation, because we statically know what the target is. 1760 // dynamic invocation, because we statically know what the target is.
1761 } else if (!selector.applies(target, compiler)) { 1761 } else if (!selector.applies(target, compiler)) {
1762 warnArgumentMismatch(node, target); 1762 warnArgumentMismatch(node, target);
1763 } 1763 }
1764
1765 if (target != null &&
1766 target.kind == ElementKind.FOREIGN &&
1767 selector.name == const SourceString('JS')) {
1768 world.nativeEnqueuer.registerJsCall(node, this);
1769 }
1764 } 1770 }
1765 1771
1766 // TODO(ngeoffray): Warn if target is null and the send is 1772 // TODO(ngeoffray): Warn if target is null and the send is
1767 // unqualified. 1773 // unqualified.
1768 useElement(node, target); 1774 useElement(node, target);
1769 registerSend(selector, target); 1775 registerSend(selector, target);
1770 return node.isPropertyAccess ? target : null; 1776 return node.isPropertyAccess ? target : null;
1771 } 1777 }
1772 1778
1773 void warnArgumentMismatch(Send node, Element target) { 1779 void warnArgumentMismatch(Send node, Element target) {
1774 // TODO(karlklose): we can be more precise about the reason of the 1780 // TODO(karlklose): we can be more precise about the reason of the
1775 // mismatch. 1781 // mismatch.
1776 warning(node.argumentsNode, MessageKind.INVALID_ARGUMENTS, 1782 warning(node.argumentsNode, MessageKind.INVALID_ARGUMENTS,
1777 [target.name]); 1783 [target.name]);
1778 } 1784 }
1779 1785
1786 /// Callback for native enqueuer to parse a type. Returns [:null:] on error.
1787 DartType resolveTypeFromString(String typeName) {
1788 Element element = scope.lookup(new SourceString(typeName));
1789 if (element == null) return null;
1790 if (element is! ClassElement) return null;
1791 element.ensureResolved(compiler);
1792 return element.computeType(compiler);
1793 }
1794
1780 visitSendSet(SendSet node) { 1795 visitSendSet(SendSet node) {
1781 Element target = resolveSend(node); 1796 Element target = resolveSend(node);
1782 Element setter = target; 1797 Element setter = target;
1783 Element getter = target; 1798 Element getter = target;
1784 SourceString operatorName = node.assignmentOperator.source; 1799 SourceString operatorName = node.assignmentOperator.source;
1785 String source = operatorName.stringValue; 1800 String source = operatorName.stringValue;
1786 bool isComplex = !identical(source, '='); 1801 bool isComplex = !identical(source, '=');
1787 if (!Elements.isUnresolved(target) 1802 if (!Elements.isUnresolved(target)
1788 && target.kind == ElementKind.ABSTRACT_FIELD) { 1803 && target.kind == ElementKind.ABSTRACT_FIELD) {
1789 AbstractFieldElement field = target; 1804 AbstractFieldElement field = target;
(...skipping 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after
3099 return e; 3114 return e;
3100 } 3115 }
3101 3116
3102 /// Assumed to be called by [resolveRedirectingFactory]. 3117 /// Assumed to be called by [resolveRedirectingFactory].
3103 Element visitReturn(Return node) { 3118 Element visitReturn(Return node) {
3104 Node expression = node.expression; 3119 Node expression = node.expression;
3105 return finishConstructorReference(visit(expression), 3120 return finishConstructorReference(visit(expression),
3106 expression, expression); 3121 expression, expression);
3107 } 3122 }
3108 } 3123 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698