Chromium Code Reviews| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 Map<FunctionElement, TreeElements> constructorElements; | 43 Map<FunctionElement, TreeElements> constructorElements; |
| 44 | 44 |
| 45 ResolverTask(Compiler compiler) | 45 ResolverTask(Compiler compiler) |
| 46 : super(compiler), toResolve = new Queue<ClassElement>(), | 46 : super(compiler), toResolve = new Queue<ClassElement>(), |
| 47 constructorElements = new Map<FunctionElement, TreeElements>(); | 47 constructorElements = new Map<FunctionElement, TreeElements>(); |
| 48 | 48 |
| 49 String get name() => 'Resolver'; | 49 String get name() => 'Resolver'; |
| 50 | 50 |
| 51 TreeElements resolve(Element element) { | 51 TreeElements resolve(Element element) { |
| 52 return measure(() { | 52 return measure(() { |
| 53 switch (element.kind) { | 53 ElementKind kind = element.kind; |
| 54 case ElementKind.GENERATIVE_CONSTRUCTOR: | 54 if (kind === ElementKind.GENERATIVE_CONSTRUCTOR || |
|
karlklose
2012/06/15 12:43:46
Break before ||?
| |
| 55 case ElementKind.FUNCTION: | 55 kind === ElementKind.FUNCTION || |
| 56 case ElementKind.GETTER: | 56 kind === ElementKind.GETTER || |
| 57 case ElementKind.SETTER: | 57 kind === ElementKind.SETTER) { |
| 58 return resolveMethodElement(element); | 58 return resolveMethodElement(element); |
| 59 } | |
| 59 | 60 |
| 60 case ElementKind.FIELD: | 61 if (kind === ElementKind.FIELD) return resolveField(element); |
| 61 return resolveField(element); | |
| 62 | 62 |
| 63 case ElementKind.PARAMETER: | 63 if (kind === ElementKind.PARAMETER || |
| 64 case ElementKind.FIELD_PARAMETER: | 64 kind === ElementKind.FIELD_PARAMETER) { |
| 65 return resolveParameter(element); | 65 return resolveParameter(element); |
| 66 } | |
| 66 | 67 |
| 67 default: | 68 compiler.unimplemented("resolve($element)", |
| 68 compiler.unimplemented( | 69 node: element.parseNode(compiler)); |
| 69 "resolve($element)", node: element.parseNode(compiler)); | |
| 70 } | |
| 71 }); | 70 }); |
| 72 } | 71 } |
| 73 | 72 |
| 74 SourceString getConstructorName(Send node) { | 73 SourceString getConstructorName(Send node) { |
| 75 if (node.receiver !== null) { | 74 if (node.receiver !== null) { |
| 76 return node.selector.asIdentifier().source; | 75 return node.selector.asIdentifier().source; |
| 77 } else { | 76 } else { |
| 78 return const SourceString(''); | 77 return const SourceString(''); |
| 79 } | 78 } |
| 80 } | 79 } |
| (...skipping 2013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2094 | 2093 |
| 2095 TopScope(LibraryElement library) : super(null, library); | 2094 TopScope(LibraryElement library) : super(null, library); |
| 2096 Element lookup(SourceString name) { | 2095 Element lookup(SourceString name) { |
| 2097 return library.find(name); | 2096 return library.find(name); |
| 2098 } | 2097 } |
| 2099 | 2098 |
| 2100 Element add(Element newElement) { | 2099 Element add(Element newElement) { |
| 2101 throw "Cannot add an element in the top scope"; | 2100 throw "Cannot add an element in the top scope"; |
| 2102 } | 2101 } |
| 2103 } | 2102 } |
| OLD | NEW |