OLD | NEW |
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 abstract class TreeElements { | 5 abstract class TreeElements { |
6 Element operator[](Node node); | 6 Element operator[](Node node); |
7 Selector getSelector(Send send); | 7 Selector getSelector(Send send); |
8 DartType getType(TypeAnnotation annotation); | 8 DartType getType(TypeAnnotation annotation); |
9 bool isParameterChecked(Element element); | 9 bool isParameterChecked(Element element); |
10 } | 10 } |
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1001 } else { | 1001 } else { |
1002 return scope.lookup(typeName.source); | 1002 return scope.lookup(typeName.source); |
1003 } | 1003 } |
1004 } | 1004 } |
1005 | 1005 |
1006 // TODO(johnniwinther): Change [onFailure] and [whenResolved] to use boolean | 1006 // TODO(johnniwinther): Change [onFailure] and [whenResolved] to use boolean |
1007 // flags instead of closures. | 1007 // flags instead of closures. |
1008 // TODO(johnniwinther): Should never return [null] but instead an erroneous | 1008 // TODO(johnniwinther): Should never return [null] but instead an erroneous |
1009 // type. | 1009 // type. |
1010 DartType resolveTypeAnnotation(TypeAnnotation node, | 1010 DartType resolveTypeAnnotation(TypeAnnotation node, |
1011 [Scope inScope, ClassElement inClass, | 1011 {Scope inScope, ClassElement inClass, |
1012 onFailure(Node, MessageKind, [List arguments]), | 1012 onFailure(Node, MessageKind, [List arguments]), |
1013 whenResolved(Node, Type)]) { | 1013 whenResolved(Node, Type)}) { |
1014 if (onFailure === null) { | 1014 if (onFailure === null) { |
1015 onFailure = (n, k, [arguments]) {}; | 1015 onFailure = (n, k, [arguments]) {}; |
1016 } | 1016 } |
1017 if (whenResolved === null) { | 1017 if (whenResolved === null) { |
1018 whenResolved = (n, t) {}; | 1018 whenResolved = (n, t) {}; |
1019 } | 1019 } |
1020 if (inClass !== null) { | 1020 if (inClass !== null) { |
1021 inScope = inClass.buildScope(); | 1021 inScope = inClass.buildScope(); |
1022 } | 1022 } |
1023 if (inScope === null) { | 1023 if (inScope === null) { |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1235 if (type !== null) { | 1235 if (type !== null) { |
1236 if (inCheckContext) { | 1236 if (inCheckContext) { |
1237 compiler.enqueuer.resolution.registerIsCheck(type); | 1237 compiler.enqueuer.resolution.registerIsCheck(type); |
1238 } | 1238 } |
1239 return type.element; | 1239 return type.element; |
1240 } | 1240 } |
1241 return null; | 1241 return null; |
1242 } | 1242 } |
1243 | 1243 |
1244 Element defineElement(Node node, Element element, | 1244 Element defineElement(Node node, Element element, |
1245 [bool doAddToScope = true]) { | 1245 {bool doAddToScope: true}) { |
1246 compiler.ensure(element !== null); | 1246 compiler.ensure(element !== null); |
1247 mapping[node] = element; | 1247 mapping[node] = element; |
1248 if (doAddToScope) { | 1248 if (doAddToScope) { |
1249 Element existing = scope.add(element); | 1249 Element existing = scope.add(element); |
1250 if (existing != element) { | 1250 if (existing != element) { |
1251 error(node, MessageKind.DUPLICATE_DEFINITION, [node]); | 1251 error(node, MessageKind.DUPLICATE_DEFINITION, [node]); |
1252 } | 1252 } |
1253 } | 1253 } |
1254 return element; | 1254 return element; |
1255 } | 1255 } |
(...skipping 1883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3139 return result; | 3139 return result; |
3140 } | 3140 } |
3141 Element lookup(SourceString name) => localLookup(name); | 3141 Element lookup(SourceString name) => localLookup(name); |
3142 Element lexicalLookup(SourceString name) => localLookup(name); | 3142 Element lexicalLookup(SourceString name) => localLookup(name); |
3143 | 3143 |
3144 Element add(Element newElement) { | 3144 Element add(Element newElement) { |
3145 throw "Cannot add an element in a patch library scope"; | 3145 throw "Cannot add an element in a patch library scope"; |
3146 } | 3146 } |
3147 String toString() => 'PatchLibraryScope($origin,$patch)'; | 3147 String toString() => 'PatchLibraryScope($origin,$patch)'; |
3148 } | 3148 } |
OLD | NEW |