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

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

Issue 12334070: Support runtime check of function types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Handle function types in checked mode. Created 7 years, 6 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
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 get currentElement; 8 Element get currentElement;
9 Set<Node> get superUses; 9 Set<Node> get superUses;
10 10
(...skipping 1880 matching lines...) Expand 10 before | Expand all | Expand 10 after
1891 initializerDo(parameterNode, (n) => n.accept(this)); 1891 initializerDo(parameterNode, (n) => n.accept(this));
1892 // Field parameters (this.x) are not visible inside the constructor. The 1892 // Field parameters (this.x) are not visible inside the constructor. The
1893 // fields they reference are visible, but must be resolved independently. 1893 // fields they reference are visible, but must be resolved independently.
1894 if (element.kind == ElementKind.FIELD_PARAMETER) { 1894 if (element.kind == ElementKind.FIELD_PARAMETER) {
1895 useElement(parameterNode, element); 1895 useElement(parameterNode, element);
1896 } else { 1896 } else {
1897 defineElement(variableDefinitions.definitions.nodes.head, element); 1897 defineElement(variableDefinitions.definitions.nodes.head, element);
1898 } 1898 }
1899 parameterNodes = parameterNodes.tail; 1899 parameterNodes = parameterNodes.tail;
1900 }); 1900 });
1901 if (inCheckContext) {
1902 functionParameters.forEachParameter((Element element) {
1903 compiler.enqueuer.resolution.registerIsCheck(
1904 element.computeType(compiler), mapping);
1905 });
1906 }
1901 } 1907 }
1902 1908
1903 visitCascade(Cascade node) { 1909 visitCascade(Cascade node) {
1904 visit(node.expression); 1910 visit(node.expression);
1905 } 1911 }
1906 1912
1907 visitCascadeReceiver(CascadeReceiver node) { 1913 visitCascadeReceiver(CascadeReceiver node) {
1908 visit(node.expression); 1914 visit(node.expression);
1909 } 1915 }
1910 1916
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1988 enclosingElement = function; 1994 enclosingElement = function;
1989 // Run the body in a fresh statement scope. 1995 // Run the body in a fresh statement scope.
1990 StatementScope oldStatementScope = statementScope; 1996 StatementScope oldStatementScope = statementScope;
1991 statementScope = new StatementScope(); 1997 statementScope = new StatementScope();
1992 visit(node.body); 1998 visit(node.body);
1993 statementScope = oldStatementScope; 1999 statementScope = oldStatementScope;
1994 2000
1995 scope = oldScope; 2001 scope = oldScope;
1996 enclosingElement = previousEnclosingElement; 2002 enclosingElement = previousEnclosingElement;
1997 2003
2004 if (function.computeType(compiler).containsTypeVariables) {
2005 world.registerGenericClosure(function, mapping);
2006 }
1998 world.registerInstantiatedClass(compiler.functionClass, mapping); 2007 world.registerInstantiatedClass(compiler.functionClass, mapping);
1999 } 2008 }
2000 2009
2001 visitIf(If node) { 2010 visitIf(If node) {
2002 visit(node.condition); 2011 visit(node.condition);
2003 visitIn(node.thenPart, new BlockScope(scope)); 2012 visitIn(node.thenPart, new BlockScope(scope));
2004 visitIn(node.elsePart, new BlockScope(scope)); 2013 visitIn(node.elsePart, new BlockScope(scope));
2005 } 2014 }
2006 2015
2007 static bool isLogicalOperator(Identifier op) { 2016 static bool isLogicalOperator(Identifier op) {
(...skipping 2012 matching lines...) Expand 10 before | Expand all | Expand 10 after
4020 return e; 4029 return e;
4021 } 4030 }
4022 4031
4023 /// Assumed to be called by [resolveRedirectingFactory]. 4032 /// Assumed to be called by [resolveRedirectingFactory].
4024 Element visitReturn(Return node) { 4033 Element visitReturn(Return node) {
4025 Node expression = node.expression; 4034 Node expression = node.expression;
4026 return finishConstructorReference(visit(expression), 4035 return finishConstructorReference(visit(expression),
4027 expression, expression); 4036 expression, expression);
4028 } 4037 }
4029 } 4038 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698