| 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 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 } | 8 } |
| 9 | 9 |
| 10 class TreeElementMapping implements TreeElements { | 10 class TreeElementMapping implements TreeElements { |
| (...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1027 useElement(node.send, constructor); | 1027 useElement(node.send, constructor); |
| 1028 return null; | 1028 return null; |
| 1029 } | 1029 } |
| 1030 | 1030 |
| 1031 FunctionElement resolveConstructor(NewExpression node) { | 1031 FunctionElement resolveConstructor(NewExpression node) { |
| 1032 FunctionElement constructor = | 1032 FunctionElement constructor = |
| 1033 node.accept(new ConstructorResolver(compiler, this)); | 1033 node.accept(new ConstructorResolver(compiler, this)); |
| 1034 if (constructor === null) { | 1034 if (constructor === null) { |
| 1035 Element resolved = resolveTypeRequired(node.send.selector); | 1035 Element resolved = resolveTypeRequired(node.send.selector); |
| 1036 if (resolved !== null && resolved.kind === ElementKind.TYPE_VARIABLE) { | 1036 if (resolved !== null && resolved.kind === ElementKind.TYPE_VARIABLE) { |
| 1037 error(node, WarningKind.TYPE_VARIABLE_AS_CONSTRUCTOR); | 1037 error(node, MessageKind.TYPE_VARIABLE_AS_CONSTRUCTOR); |
| 1038 return null; | 1038 return null; |
| 1039 } else { | 1039 } else { |
| 1040 error(node.send, MessageKind.CANNOT_FIND_CONSTRUCTOR, [node.send]); | 1040 error(node.send, MessageKind.CANNOT_FIND_CONSTRUCTOR, [node.send]); |
| 1041 } | 1041 } |
| 1042 } | 1042 } |
| 1043 return constructor; | 1043 return constructor; |
| 1044 } | 1044 } |
| 1045 | 1045 |
| 1046 Element resolveTypeRequired(Node node) { | 1046 Element resolveTypeRequired(Node node) { |
| 1047 bool old = typeRequired; | 1047 bool old = typeRequired; |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1203 existingElement = statementScope.lookupLabel(labelName); | 1203 existingElement = statementScope.lookupLabel(labelName); |
| 1204 if (existingElement !== null) { | 1204 if (existingElement !== null) { |
| 1205 warning(labelIdentifier, MessageKind.DUPLICATE_LABEL, [labelName]); | 1205 warning(labelIdentifier, MessageKind.DUPLICATE_LABEL, [labelName]); |
| 1206 warning(existingElement.label, | 1206 warning(existingElement.label, |
| 1207 MessageKind.EXISTING_LABEL, [labelName]); | 1207 MessageKind.EXISTING_LABEL, [labelName]); |
| 1208 } | 1208 } |
| 1209 } | 1209 } |
| 1210 | 1210 |
| 1211 TargetElement targetElement = | 1211 TargetElement targetElement = |
| 1212 new TargetElement(switchCase, | 1212 new TargetElement(switchCase, |
| 1213 statementScope.nestingLevel, | 1213 statementScope.nestingLevel, |
| 1214 enclosingElement); | 1214 enclosingElement); |
| 1215 mapping[switchCase] = targetElement; | 1215 mapping[switchCase] = targetElement; |
| 1216 | 1216 |
| 1217 LabelElement label = | 1217 LabelElement label = |
| 1218 new LabelElement(labelIdentifier, labelName, | 1218 new LabelElement(labelIdentifier, labelName, |
| 1219 targetElement, enclosingElement); | 1219 targetElement, enclosingElement); |
| 1220 mapping[labelIdentifier] = label; | 1220 mapping[labelIdentifier] = label; |
| 1221 continueLabels[labelName] = label; | 1221 continueLabels[labelName] = label; |
| 1222 } | 1222 } |
| 1223 cases = cases.tail; | 1223 cases = cases.tail; |
| 1224 if (switchCase.defaultKeyword !== null && !cases.isEmpty()) { | 1224 if (switchCase.defaultKeyword !== null && !cases.isEmpty()) { |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1834 | 1834 |
| 1835 TopScope(LibraryElement library) : super(null, library); | 1835 TopScope(LibraryElement library) : super(null, library); |
| 1836 Element lookup(SourceString name) { | 1836 Element lookup(SourceString name) { |
| 1837 return library.find(name); | 1837 return library.find(name); |
| 1838 } | 1838 } |
| 1839 | 1839 |
| 1840 Element add(Element element) { | 1840 Element add(Element element) { |
| 1841 throw "Cannot add an element in the top scope"; | 1841 throw "Cannot add an element in the top scope"; |
| 1842 } | 1842 } |
| 1843 } | 1843 } |
| OLD | NEW |