OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 elements.modelx; | 5 library elements.modelx; |
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 Resolution, ParsingContext; | 9 import '../common/resolution.dart' show Resolution, ParsingContext; |
10 import '../compiler.dart' show Compiler; | 10 import '../compiler.dart' show Compiler; |
11 import '../constants/constant_constructors.dart'; | 11 import '../constants/constant_constructors.dart'; |
12 import '../constants/constructors.dart'; | 12 import '../constants/constructors.dart'; |
13 import '../constants/expressions.dart'; | 13 import '../constants/expressions.dart'; |
14 import '../diagnostics/messages.dart' show MessageTemplate; | 14 import '../diagnostics/messages.dart' show MessageTemplate; |
15 import '../ordered_typeset.dart' show OrderedTypeSet; | 15 import '../ordered_typeset.dart' show OrderedTypeSet; |
16 import '../resolution/class_members.dart' show ClassMemberMixin; | 16 import '../resolution/class_members.dart' show ClassMemberMixin; |
17 import '../resolution/resolution.dart' show AnalyzableElementX; | 17 import '../resolution/resolution.dart' show AnalyzableElementX; |
18 import '../resolution/scope.dart' | 18 import '../resolution/scope.dart' |
19 show ClassScope, LibraryScope, Scope, TypeDeclarationScope; | 19 show ClassScope, LibraryScope, Scope, TypeDeclarationScope; |
20 import '../resolution/tree_elements.dart' show TreeElements; | 20 import '../resolution/tree_elements.dart' show TreeElements; |
21 import '../resolution/typedefs.dart' show TypedefCyclicVisitor; | 21 import '../resolution/typedefs.dart' show TypedefCyclicVisitor; |
22 import '../script.dart'; | 22 import '../script.dart'; |
23 import 'package:front_end/src/fasta/scanner.dart' show ErrorToken, Token; | 23 import 'package:front_end/src/fasta/scanner.dart' show ErrorToken, Token; |
24 import 'package:front_end/src/fasta/scanner.dart' as Tokens show EOF_TOKEN; | 24 import 'package:front_end/src/fasta/scanner.dart' as Tokens show EOF_TOKEN; |
25 import '../tree/tree.dart'; | 25 import '../tree/tree.dart'; |
26 import '../util/util.dart'; | 26 import '../util/util.dart'; |
27 import 'common.dart'; | 27 import 'common.dart'; |
28 import 'elements.dart'; | 28 import 'elements.dart'; |
| 29 import 'entities.dart'; |
29 import 'resolution_types.dart'; | 30 import 'resolution_types.dart'; |
30 import 'visitor.dart' show ElementVisitor; | 31 import 'visitor.dart' show ElementVisitor; |
31 | 32 |
32 /// Object that identifies a declaration site. | 33 /// Object that identifies a declaration site. |
33 /// | 34 /// |
34 /// For most elements, this is the element itself, but for variable declarations | 35 /// For most elements, this is the element itself, but for variable declarations |
35 /// where multi-declarations like `var a, b, c` are allowed, the declaration | 36 /// where multi-declarations like `var a, b, c` are allowed, the declaration |
36 /// site is a separate object. | 37 /// site is a separate object. |
37 // TODO(johnniwinther): Add [beginToken] and [endToken] getters. | 38 // TODO(johnniwinther): Add [beginToken] and [endToken] getters. |
38 abstract class DeclarationSite {} | 39 abstract class DeclarationSite {} |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 | 239 |
239 get asyncMarker => AsyncMarker.SYNC; | 240 get asyncMarker => AsyncMarker.SYNC; |
240 Iterable<MetadataAnnotation> get metadata => unsupported(); | 241 Iterable<MetadataAnnotation> get metadata => unsupported(); |
241 bool get hasNode => false; | 242 bool get hasNode => false; |
242 get node => unsupported(); | 243 get node => unsupported(); |
243 get hasResolvedAst => false; | 244 get hasResolvedAst => false; |
244 get resolvedAst => unsupported(); | 245 get resolvedAst => unsupported(); |
245 get type => unsupported(); | 246 get type => unsupported(); |
246 get cachedNode => unsupported(); | 247 get cachedNode => unsupported(); |
247 get functionSignature => unsupported(); | 248 get functionSignature => unsupported(); |
| 249 get parameterStructure => unsupported(); |
248 get parameters => unsupported(); | 250 get parameters => unsupported(); |
249 get patch => null; | 251 get patch => null; |
250 get origin => this; | 252 get origin => this; |
251 get immediateRedirectionTarget => unsupported(); | 253 get immediateRedirectionTarget => unsupported(); |
252 get nestedClosures => unsupported(); | 254 get nestedClosures => unsupported(); |
253 get memberContext => unsupported(); | 255 get memberContext => unsupported(); |
254 get executableContext => unsupported(); | 256 get executableContext => unsupported(); |
255 get isExternal => unsupported(); | 257 get isExternal => unsupported(); |
256 get constantConstructor => null; | 258 get constantConstructor => null; |
257 | 259 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 set _functionSignatureCache(_) { | 429 set _functionSignatureCache(_) { |
428 throw new UnsupportedError("functionSignatureCache="); | 430 throw new UnsupportedError("functionSignatureCache="); |
429 } | 431 } |
430 | 432 |
431 @override | 433 @override |
432 set functionSignature(_) { | 434 set functionSignature(_) { |
433 throw new UnsupportedError("functionSignature="); | 435 throw new UnsupportedError("functionSignature="); |
434 } | 436 } |
435 | 437 |
436 @override | 438 @override |
| 439 get parameterStructure { |
| 440 throw new UnsupportedError("parameterStructure"); |
| 441 } |
| 442 |
| 443 @override |
437 get nestedClosures { | 444 get nestedClosures { |
438 throw new UnsupportedError("nestedClosures"); | 445 throw new UnsupportedError("nestedClosures"); |
439 } | 446 } |
440 | 447 |
441 @override | 448 @override |
442 set nestedClosures(_) { | 449 set nestedClosures(_) { |
443 throw new UnsupportedError("nestedClosures="); | 450 throw new UnsupportedError("nestedClosures="); |
444 } | 451 } |
445 | 452 |
446 @override | 453 @override |
(...skipping 1561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2008 : super(name, kind, enclosing) { | 2015 : super(name, kind, enclosing) { |
2009 assert(modifiers != null); | 2016 assert(modifiers != null); |
2010 } | 2017 } |
2011 | 2018 |
2012 bool get isExternal => modifiers.isExternal; | 2019 bool get isExternal => modifiers.isExternal; |
2013 | 2020 |
2014 bool get isInstanceMember { | 2021 bool get isInstanceMember { |
2015 return isClassMember && !isConstructor && !isStatic; | 2022 return isClassMember && !isConstructor && !isStatic; |
2016 } | 2023 } |
2017 | 2024 |
| 2025 ParameterStructure get parameterStructure => |
| 2026 functionSignature.parameterStructure; |
| 2027 |
2018 bool get hasFunctionSignature => _functionSignatureCache != null; | 2028 bool get hasFunctionSignature => _functionSignatureCache != null; |
2019 | 2029 |
2020 void _computeSignature(Resolution resolution) { | 2030 void _computeSignature(Resolution resolution) { |
2021 if (hasFunctionSignature) return; | 2031 if (hasFunctionSignature) return; |
2022 functionSignature = resolution.resolveSignature(this); | 2032 functionSignature = resolution.resolveSignature(this); |
2023 } | 2033 } |
2024 | 2034 |
2025 FunctionSignature get functionSignature { | 2035 FunctionSignature get functionSignature { |
2026 assert(invariant(this, hasFunctionSignature, | 2036 assert(invariant(this, hasFunctionSignature, |
2027 message: "Function signature has not been computed for $this.")); | 2037 message: "Function signature has not been computed for $this.")); |
(...skipping 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3480 body = node.asFunctionExpression().body; | 3490 body = node.asFunctionExpression().body; |
3481 } | 3491 } |
3482 return new ParsedResolvedAst( | 3492 return new ParsedResolvedAst( |
3483 declaration, | 3493 declaration, |
3484 node, | 3494 node, |
3485 body, | 3495 body, |
3486 definingElement.treeElements, | 3496 definingElement.treeElements, |
3487 definingElement.compilationUnit.script.resourceUri); | 3497 definingElement.compilationUnit.script.resourceUri); |
3488 } | 3498 } |
3489 } | 3499 } |
OLD | NEW |