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

Side by Side Diff: lib/compiler/implementation/resolver.dart

Issue 10795064: dart2dart: Introduce Renamer that is used by renaming unparser (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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 interface TreeElements { 5 interface TreeElements {
6 Element operator[](Node node); 6 Element operator[](Node node);
7 Selector getSelector(Send send); 7 Selector getSelector(Send send);
8 Type getType(TypeAnnotation annotation); 8 Type getType(TypeAnnotation annotation);
9 } 9 }
10 10
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 Type useType(TypeAnnotation annotation, Type type) { 934 Type useType(TypeAnnotation annotation, Type type) {
935 if (type !== null) { 935 if (type !== null) {
936 mapping.setType(annotation, type); 936 mapping.setType(annotation, type);
937 useElement(annotation, type.element); 937 useElement(annotation, type.element);
938 } 938 }
939 return type; 939 return type;
940 } 940 }
941 941
942 void setupFunction(FunctionExpression node, FunctionElement function) { 942 void setupFunction(FunctionExpression node, FunctionElement function) {
943 context = new MethodScope(context, function); 943 context = new MethodScope(context, function);
944 if (node.returnType !== null) resolveTypeAnnotation(node.returnType);
944 // Put the parameters in scope. 945 // Put the parameters in scope.
945 FunctionSignature functionParameters = 946 FunctionSignature functionParameters =
946 function.computeSignature(compiler); 947 function.computeSignature(compiler);
947 Link<Node> parameterNodes = node.parameters.nodes; 948 Link<Node> parameterNodes = node.parameters.nodes;
948 functionParameters.forEachParameter((Element element) { 949 functionParameters.forEachParameter((Element element) {
949 if (element == functionParameters.optionalParameters.head) { 950 if (element == functionParameters.optionalParameters.head) {
950 NodeList nodes = parameterNodes.head; 951 NodeList nodes = parameterNodes.head;
951 parameterNodes = nodes.nodes; 952 parameterNodes = nodes.nodes;
952 } 953 }
953 VariableDefinitions variableDefinitions = parameterNodes.head; 954 VariableDefinitions variableDefinitions = parameterNodes.head;
954 Node parameterNode = variableDefinitions.definitions.nodes.head; 955 Node parameterNode = variableDefinitions.definitions.nodes.head;
956 if (variableDefinitions.type !== null) {
957 resolveTypeAnnotation(variableDefinitions.type);
958 }
955 initializerDo(parameterNode, (n) => n.accept(this)); 959 initializerDo(parameterNode, (n) => n.accept(this));
956 // Field parameters (this.x) are not visible inside the constructor. The 960 // Field parameters (this.x) are not visible inside the constructor. The
957 // fields they reference are visible, but must be resolved independently. 961 // fields they reference are visible, but must be resolved independently.
958 if (element.kind == ElementKind.FIELD_PARAMETER) { 962 if (element.kind == ElementKind.FIELD_PARAMETER) {
959 useElement(parameterNode, element); 963 useElement(parameterNode, element);
960 } else { 964 } else {
961 defineElement(variableDefinitions.definitions.nodes.head, element); 965 defineElement(variableDefinitions.definitions.nodes.head, element);
962 } 966 }
963 parameterNodes = parameterNodes.tail; 967 parameterNodes = parameterNodes.tail;
964 }); 968 });
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after
2211 2215
2212 TopScope(LibraryElement library) : super(null, library); 2216 TopScope(LibraryElement library) : super(null, library);
2213 Element lookup(SourceString name) { 2217 Element lookup(SourceString name) {
2214 return library.find(name); 2218 return library.find(name);
2215 } 2219 }
2216 2220
2217 Element add(Element newElement) { 2221 Element add(Element newElement) {
2218 throw "Cannot add an element in the top scope"; 2222 throw "Cannot add an element in the top scope";
2219 } 2223 }
2220 } 2224 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698