OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library trydart.poi.scope_information_visitor; | 5 library trydart.poi.scope_information_visitor; |
6 | 6 |
7 import 'package:compiler/src/elements/modelx.dart' as modelx; | 7 import 'package:compiler/src/elements/modelx.dart' as modelx; |
8 | 8 |
9 import 'package:compiler/src/elements/modelx.dart' show | 9 import 'package:compiler/src/elements/modelx.dart' show |
10 CompilationUnitElementX, | 10 CompilationUnitElementX, |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 /// is all the local instance members of the class (the members of the | 113 /// is all the local instance members of the class (the members of the |
114 /// mixin), and the class side is the equivalent for static members and | 114 /// mixin), and the class side is the equivalent for static members and |
115 /// constructors. | 115 /// constructors. |
116 /// The scope chain is ordered so that the "class side" is searched before | 116 /// The scope chain is ordered so that the "class side" is searched before |
117 /// the "instance side". | 117 /// the "instance side". |
118 void serializeClassSide( | 118 void serializeClassSide( |
119 ClassElement e, | 119 ClassElement e, |
120 {bool isStatic: false, | 120 {bool isStatic: false, |
121 bool omitEnclosing: false, | 121 bool omitEnclosing: false, |
122 bool includeSuper: false}) { | 122 bool includeSuper: false}) { |
123 e.ensureResolved(compiler); | 123 e.ensureResolved(compiler.resolution); |
124 bool isFirst = true; | 124 bool isFirst = true; |
125 var serializeEnclosing; | 125 var serializeEnclosing; |
126 String kind; | 126 String kind; |
127 if (isStatic) { | 127 if (isStatic) { |
128 kind = 'class side'; | 128 kind = 'class side'; |
129 serializeEnclosing = () { | 129 serializeEnclosing = () { |
130 serializeClassSide(e, isStatic: false, omitEnclosing: omitEnclosing); | 130 serializeClassSide(e, isStatic: false, omitEnclosing: omitEnclosing); |
131 }; | 131 }; |
132 } else { | 132 } else { |
133 kind = 'instance side'; | 133 kind = 'instance side'; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 kind: kind, | 224 kind: kind, |
225 name: name); | 225 name: name); |
226 } | 226 } |
227 return; | 227 return; |
228 } | 228 } |
229 DartType type; | 229 DartType type; |
230 int category = element.kind.category; | 230 int category = element.kind.category; |
231 if (category == ElementCategory.FUNCTION || | 231 if (category == ElementCategory.FUNCTION || |
232 category == ElementCategory.VARIABLE || | 232 category == ElementCategory.VARIABLE || |
233 element.isConstructor) { | 233 element.isConstructor) { |
234 type = element.computeType(compiler); | 234 type = element.computeType(compiler.resolution); |
235 } | 235 } |
236 if (name == null) { | 236 if (name == null) { |
237 name = element.name; | 237 name = element.name; |
238 } | 238 } |
239 if (kind == null) { | 239 if (kind == null) { |
240 kind = '${element.kind}'; | 240 kind = '${element.kind}'; |
241 } | 241 } |
242 buffer.write('{\n'); | 242 buffer.write('{\n'); |
243 indentationLevel++; | 243 indentationLevel++; |
244 if (name != '') { | 244 if (name != '') { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 } | 296 } |
297 return result; | 297 return result; |
298 } | 298 } |
299 } | 299 } |
300 | 300 |
301 modelx.ScopeX localScope(modelx.LibraryElementX element) => element.localScope; | 301 modelx.ScopeX localScope(modelx.LibraryElementX element) => element.localScope; |
302 | 302 |
303 modelx.ImportScope importScope(modelx.LibraryElementX element) { | 303 modelx.ImportScope importScope(modelx.LibraryElementX element) { |
304 return element.importScope; | 304 return element.importScope; |
305 } | 305 } |
OLD | NEW |