| 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 Type getType(TypeAnnotation annotation); | 8 Type getType(TypeAnnotation annotation); |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 target = prefix.lookupLocalMember(name); | 840 target = prefix.lookupLocalMember(name); |
| 841 if (target == null) { | 841 if (target == null) { |
| 842 error(node, MessageKind.NO_SUCH_LIBRARY_MEMBER, [prefix.name, name]); | 842 error(node, MessageKind.NO_SUCH_LIBRARY_MEMBER, [prefix.name, name]); |
| 843 } | 843 } |
| 844 } | 844 } |
| 845 return target; | 845 return target; |
| 846 } | 846 } |
| 847 | 847 |
| 848 Type resolveTypeTest(Node argument) { | 848 Type resolveTypeTest(Node argument) { |
| 849 TypeAnnotation node = argument.asTypeAnnotation(); | 849 TypeAnnotation node = argument.asTypeAnnotation(); |
| 850 if (node == null) { | 850 if (node === null) { |
| 851 // node is of the form !Type. | 851 // node is of the form !Type. |
| 852 node = argument.asSend().receiver.asTypeAnnotation(); | 852 node = argument.asSend().receiver.asTypeAnnotation(); |
| 853 if (node === null) compiler.cancel("malformed send"); | 853 if (node === null) compiler.cancel("malformed send"); |
| 854 } | 854 } |
| 855 return resolveTypeRequired(node); | 855 return resolveTypeRequired(node); |
| 856 } | 856 } |
| 857 | 857 |
| 858 void handleArguments(Send node) { | 858 void handleArguments(Send node) { |
| 859 int count = 0; | 859 int count = 0; |
| 860 List<SourceString> namedArguments = <SourceString>[]; | 860 List<SourceString> namedArguments = <SourceString>[]; |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1054 return result; | 1054 return result; |
| 1055 } | 1055 } |
| 1056 | 1056 |
| 1057 Element resolveTypeName(node) { | 1057 Element resolveTypeName(node) { |
| 1058 Identifier typeName = node.typeName.asIdentifier(); | 1058 Identifier typeName = node.typeName.asIdentifier(); |
| 1059 Send send = node.typeName.asSend(); | 1059 Send send = node.typeName.asSend(); |
| 1060 if (send !== null) { | 1060 if (send !== null) { |
| 1061 typeName = send.selector; | 1061 typeName = send.selector; |
| 1062 } | 1062 } |
| 1063 if (typeName.source == Types.VOID) return compiler.types.voidType.element; | 1063 if (typeName.source == Types.VOID) return compiler.types.voidType.element; |
| 1064 if (typeName.source == Types.DYNAMIC || | |
| 1065 typeName.source.stringValue == "var") { | |
| 1066 return compiler.types.dynamicType.element; | |
| 1067 } | |
| 1068 if (send !== null) { | 1064 if (send !== null) { |
| 1069 Element e = context.lookup(send.receiver.asIdentifier().source); | 1065 Element e = context.lookup(send.receiver.asIdentifier().source); |
| 1070 if (e !== null && e.kind === ElementKind.PREFIX) { | 1066 if (e !== null && e.kind === ElementKind.PREFIX) { |
| 1071 // The receiver is a prefix. Lookup in the imported members. | 1067 // The receiver is a prefix. Lookup in the imported members. |
| 1072 PrefixElement prefix = e; | 1068 PrefixElement prefix = e; |
| 1073 return prefix.lookupLocalMember(typeName.source); | 1069 return prefix.lookupLocalMember(typeName.source); |
| 1074 } else if (e !== null && e.kind === ElementKind.CLASS) { | 1070 } else if (e !== null && e.kind === ElementKind.CLASS) { |
| 1075 // The receiver is the class part of a named constructor. | 1071 // The receiver is the class part of a named constructor. |
| 1076 return e; | 1072 return e; |
| 1077 } else { | 1073 } else { |
| (...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1919 | 1915 |
| 1920 TopScope(LibraryElement library) : super(null, library); | 1916 TopScope(LibraryElement library) : super(null, library); |
| 1921 Element lookup(SourceString name) { | 1917 Element lookup(SourceString name) { |
| 1922 return library.find(name); | 1918 return library.find(name); |
| 1923 } | 1919 } |
| 1924 | 1920 |
| 1925 Element add(Element element) { | 1921 Element add(Element element) { |
| 1926 throw "Cannot add an element in the top scope"; | 1922 throw "Cannot add an element in the top scope"; |
| 1927 } | 1923 } |
| 1928 } | 1924 } |
| OLD | NEW |