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 library closureToClassMapper; | 5 library closureToClassMapper; |
6 | 6 |
7 import 'common.dart'; | 7 import 'common.dart'; |
8 import 'common/names.dart' show Identifiers; | 8 import 'common/names.dart' show Identifiers; |
9 import 'common/resolution.dart' show Parsing, Resolution; | 9 import 'common/resolution.dart' show ParsingContext, Resolution; |
10 import 'common/tasks.dart' show CompilerTask; | 10 import 'common/tasks.dart' show CompilerTask; |
11 import 'compiler.dart' show Compiler; | 11 import 'compiler.dart' show Compiler; |
12 import 'constants/expressions.dart'; | 12 import 'constants/expressions.dart'; |
13 import 'dart_types.dart'; | 13 import 'dart_types.dart'; |
14 import 'elements/elements.dart'; | 14 import 'elements/elements.dart'; |
15 import 'elements/modelx.dart' | 15 import 'elements/modelx.dart' |
16 show BaseFunctionElementX, ClassElementX, ElementX, LocalFunctionElementX; | 16 show BaseFunctionElementX, ClassElementX, ElementX, LocalFunctionElementX; |
17 import 'elements/visitor.dart' show ElementVisitor; | 17 import 'elements/visitor.dart' show ElementVisitor; |
18 import 'js_backend/js_backend.dart' show JavaScriptBackend; | 18 import 'js_backend/js_backend.dart' show JavaScriptBackend; |
19 import 'resolution/tree_elements.dart' show TreeElements; | 19 import 'resolution/tree_elements.dart' show TreeElements; |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 _closureFields.add(field); | 214 _closureFields.add(field); |
215 addMember(field, listener); | 215 addMember(field, listener); |
216 } | 216 } |
217 | 217 |
218 bool get hasNode => true; | 218 bool get hasNode => true; |
219 | 219 |
220 bool get isClosure => true; | 220 bool get isClosure => true; |
221 | 221 |
222 Token get position => node.getBeginToken(); | 222 Token get position => node.getBeginToken(); |
223 | 223 |
224 Node parseNode(Parsing parsing) => node; | 224 Node parseNode(ParsingContext parsing) => node; |
225 | 225 |
226 // A [ClosureClassElement] is nested inside a function or initializer in terms | 226 // A [ClosureClassElement] is nested inside a function or initializer in terms |
227 // of [enclosingElement], but still has to be treated as a top-level | 227 // of [enclosingElement], but still has to be treated as a top-level |
228 // element. | 228 // element. |
229 bool get isTopLevel => true; | 229 bool get isTopLevel => true; |
230 | 230 |
231 get enclosingElement => methodElement; | 231 get enclosingElement => methodElement; |
232 | 232 |
233 accept(ElementVisitor visitor, arg) { | 233 accept(ElementVisitor visitor, arg) { |
234 return visitor.visitClosureClassElement(this, arg); | 234 return visitor.visitClosureClassElement(this, arg); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 ClosureClassElement get closureClass => super.enclosingElement; | 336 ClosureClassElement get closureClass => super.enclosingElement; |
337 | 337 |
338 MemberElement get memberContext { | 338 MemberElement get memberContext { |
339 return closureClass.methodElement.memberContext; | 339 return closureClass.methodElement.memberContext; |
340 } | 340 } |
341 | 341 |
342 bool get hasNode => expression.hasNode; | 342 bool get hasNode => expression.hasNode; |
343 | 343 |
344 FunctionExpression get node => expression.node; | 344 FunctionExpression get node => expression.node; |
345 | 345 |
346 FunctionExpression parseNode(Parsing parsing) => node; | 346 FunctionExpression parseNode(ParsingContext parsing) => node; |
347 | 347 |
348 ResolvedAst get resolvedAst { | 348 ResolvedAst get resolvedAst { |
349 return new ParsedResolvedAst(this, node, treeElements); | 349 return new ParsedResolvedAst(this, node, treeElements); |
350 } | 350 } |
351 | 351 |
352 Element get analyzableElement => closureClass.methodElement.analyzableElement; | 352 Element get analyzableElement => closureClass.methodElement.analyzableElement; |
353 | 353 |
354 accept(ElementVisitor visitor, arg) { | 354 accept(ElementVisitor visitor, arg) { |
355 return visitor.visitMethodElement(this, arg); | 355 return visitor.visitMethodElement(this, arg); |
356 } | 356 } |
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1146 /// | 1146 /// |
1147 /// Move the below classes to a JS model eventually. | 1147 /// Move the below classes to a JS model eventually. |
1148 /// | 1148 /// |
1149 abstract class JSEntity implements Entity { | 1149 abstract class JSEntity implements Entity { |
1150 Entity get declaredEntity; | 1150 Entity get declaredEntity; |
1151 } | 1151 } |
1152 | 1152 |
1153 abstract class PrivatelyNamedJSEntity implements JSEntity { | 1153 abstract class PrivatelyNamedJSEntity implements JSEntity { |
1154 Entity get rootOfScope; | 1154 Entity get rootOfScope; |
1155 } | 1155 } |
OLD | NEW |