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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart

Issue 13513003: Handle call properties in is-checks. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 months 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
« no previous file with comments | « no previous file | tests/language/call_property_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 js_backend; 5 part of js_backend;
6 6
7 /** 7 /**
8 * A function element that represents a closure call. The signature is copied 8 * A function element that represents a closure call. The signature is copied
9 * from the given element. 9 * from the given element.
10 */ 10 */
(...skipping 1676 matching lines...) Expand 10 before | Expand all | Expand 10 after
1687 } 1687 }
1688 void emitNothing(_, {emitNull}) {}; 1688 void emitNothing(_, {emitNull}) {};
1689 emitSubstitution = emitNothing; 1689 emitSubstitution = emitNothing;
1690 } 1690 }
1691 1691
1692 Set<Element> generated = new Set<Element>(); 1692 Set<Element> generated = new Set<Element>();
1693 // A class that defines a [:call:] method implicitly implements 1693 // A class that defines a [:call:] method implicitly implements
1694 // [Function] and needs checks for all typedefs that are used in is-checks. 1694 // [Function] and needs checks for all typedefs that are used in is-checks.
1695 if (checkedClasses.contains(compiler.functionClass) || 1695 if (checkedClasses.contains(compiler.functionClass) ||
1696 !checkedTypedefs.isEmpty) { 1696 !checkedTypedefs.isEmpty) {
1697 FunctionElement call = cls.lookupLocalMember(Compiler.CALL_OPERATOR_NAME); 1697 Element call = cls.lookupLocalMember(Compiler.CALL_OPERATOR_NAME);
1698 if (call == null) { 1698 if (call == null) {
1699 // If [cls] is a closure, it has a synthetic call operator method. 1699 // If [cls] is a closure, it has a synthetic call operator method.
1700 call = cls.lookupBackendMember(Compiler.CALL_OPERATOR_NAME); 1700 call = cls.lookupBackendMember(Compiler.CALL_OPERATOR_NAME);
1701 } 1701 }
1702 if (call != null) { 1702 if (call != null && call.isFunction()) {
1703 generateInterfacesIsTests(compiler.functionClass, 1703 generateInterfacesIsTests(compiler.functionClass,
1704 emitIsTest, 1704 emitIsTest,
1705 emitSubstitution, 1705 emitSubstitution,
1706 generated); 1706 generated);
1707 getTypedefChecksOn(call.computeType(compiler)).forEach(emitIsTest); 1707 getTypedefChecksOn(call.computeType(compiler)).forEach(emitIsTest);
1708 } 1708 }
1709 } 1709 }
1710 1710
1711 for (DartType interfaceType in cls.interfaces) { 1711 for (DartType interfaceType in cls.interfaces) {
1712 generateInterfacesIsTests(interfaceType.element, emitIsTest, 1712 generateInterfacesIsTests(interfaceType.element, emitIsTest,
(...skipping 1345 matching lines...) Expand 10 before | Expand all | Expand 10 after
3058 """; 3058 """;
3059 const String HOOKS_API_USAGE = """ 3059 const String HOOKS_API_USAGE = """
3060 // The code supports the following hooks: 3060 // The code supports the following hooks:
3061 // dartPrint(message) - if this function is defined it is called 3061 // dartPrint(message) - if this function is defined it is called
3062 // instead of the Dart [print] method. 3062 // instead of the Dart [print] method.
3063 // dartMainRunner(main) - if this function is defined, the Dart [main] 3063 // dartMainRunner(main) - if this function is defined, the Dart [main]
3064 // method will not be invoked directly. 3064 // method will not be invoked directly.
3065 // Instead, a closure that will invoke [main] is 3065 // Instead, a closure that will invoke [main] is
3066 // passed to [dartMainRunner]. 3066 // passed to [dartMainRunner].
3067 """; 3067 """;
OLDNEW
« no previous file with comments | « no previous file | tests/language/call_property_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698