OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013, the Dart project authors. | 2 * Copyright (c) 2013, the Dart project authors. |
3 * | 3 * |
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except | 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except |
5 * in compliance with the License. You may obtain a copy of the License at | 5 * in compliance with the License. You may obtain a copy of the License at |
6 * | 6 * |
7 * http://www.eclipse.org/legal/epl-v10.html | 7 * http://www.eclipse.org/legal/epl-v10.html |
8 * | 8 * |
9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License | 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License |
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express | 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 String dynamicKeyword = Keyword.DYNAMIC.getSyntax(); | 700 String dynamicKeyword = Keyword.DYNAMIC.getSyntax(); |
701 boolean[] detectedRepeatOnIndex = new boolean[typeNames.length]; | 701 boolean[] detectedRepeatOnIndex = new boolean[typeNames.length]; |
702 for (int i = 0; i < detectedRepeatOnIndex.length; i++) { | 702 for (int i = 0; i < detectedRepeatOnIndex.length; i++) { |
703 detectedRepeatOnIndex[i] = false; | 703 detectedRepeatOnIndex[i] = false; |
704 } | 704 } |
705 for (int i = 0; i < typeNames.length; i++) { | 705 for (int i = 0; i < typeNames.length; i++) { |
706 TypeName typeName = typeNames[i]; | 706 TypeName typeName = typeNames[i]; |
707 String name = typeName.getName().getName(); | 707 String name = typeName.getName().getName(); |
708 if (name.equals(dynamicKeyword)) { | 708 if (name.equals(dynamicKeyword)) { |
709 reportError(CompileTimeErrorCode.IMPLEMENTS_DYNAMIC, typeName); | 709 reportError(CompileTimeErrorCode.IMPLEMENTS_DYNAMIC, typeName); |
710 } else if (typeName.getName().getElement().equals(classElement)) { | 710 } else { |
711 reportError(CompileTimeErrorCode.IMPLEMENTS_SELF, typeName, name); | 711 Element element = typeName.getName().getElement(); |
| 712 if (element != null && element.equals(classElement)) { |
| 713 reportError(CompileTimeErrorCode.IMPLEMENTS_SELF, typeName, name); |
| 714 } |
712 } | 715 } |
713 if (!detectedRepeatOnIndex[i]) { | 716 if (!detectedRepeatOnIndex[i]) { |
714 for (int j = i + 1; j < typeNames.length; j++) { | 717 for (int j = i + 1; j < typeNames.length; j++) { |
| 718 Element element = typeName.getName().getElement(); |
715 TypeName typeName2 = typeNames[j]; | 719 TypeName typeName2 = typeNames[j]; |
716 String name2 = typeName2.getName().getName(); | 720 Identifier identifier2 = typeName2.getName(); |
717 if (typeName.getName().getElement().equals(typeName2.getName().getEl
ement())) { | 721 String name2 = identifier2.getName(); |
| 722 Element element2 = identifier2.getElement(); |
| 723 if (element != null && element.equals(element2)) { |
718 detectedRepeatOnIndex[j] = true; | 724 detectedRepeatOnIndex[j] = true; |
719 reportError(CompileTimeErrorCode.IMPLEMENTS_REPEATED, typeName2, n
ame2); | 725 reportError(CompileTimeErrorCode.IMPLEMENTS_REPEATED, typeName2, n
ame2); |
720 } | 726 } |
721 } | 727 } |
722 } | 728 } |
723 } | 729 } |
724 if (classElement != null) { | 730 if (classElement != null) { |
725 classElement.setInterfaces(interfaceTypes); | 731 classElement.setInterfaces(interfaceTypes); |
726 } | 732 } |
727 } | 733 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 if (!namedParameterTypes.isEmpty()) { | 824 if (!namedParameterTypes.isEmpty()) { |
819 functionType.setNamedParameterTypes(namedParameterTypes); | 825 functionType.setNamedParameterTypes(namedParameterTypes); |
820 } | 826 } |
821 if (returnType == null) { | 827 if (returnType == null) { |
822 functionType.setReturnType(dynamicType); | 828 functionType.setReturnType(dynamicType); |
823 } else { | 829 } else { |
824 functionType.setReturnType(returnType.getType()); | 830 functionType.setReturnType(returnType.getType()); |
825 } | 831 } |
826 } | 832 } |
827 } | 833 } |
OLD | NEW |