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; |
(...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1336 * system. | 1336 * system. |
1337 * | 1337 * |
1338 * The [functionSignature] is not available until the typedef element has been | 1338 * The [functionSignature] is not available until the typedef element has been |
1339 * resolved. | 1339 * resolved. |
1340 */ | 1340 */ |
1341 FunctionSignature functionSignature; | 1341 FunctionSignature functionSignature; |
1342 | 1342 |
1343 TypedefType computeType(Resolution resolution) { | 1343 TypedefType computeType(Resolution resolution) { |
1344 if (thisTypeCache != null) return thisTypeCache; | 1344 if (thisTypeCache != null) return thisTypeCache; |
1345 Typedef node = parseNode(resolution.parsingContext); | 1345 Typedef node = parseNode(resolution.parsingContext); |
1346 setThisAndRawTypes(createTypeVariables(node.typeParameters)); | 1346 setThisAndRawTypes(createTypeVariables(node.templateParameters)); |
1347 ensureResolved(resolution); | 1347 ensureResolved(resolution); |
1348 return thisTypeCache; | 1348 return thisTypeCache; |
1349 } | 1349 } |
1350 | 1350 |
1351 void ensureResolved(Resolution resolution) { | 1351 void ensureResolved(Resolution resolution) { |
1352 if (resolutionState == STATE_NOT_STARTED) { | 1352 if (resolutionState == STATE_NOT_STARTED) { |
1353 resolution.resolveTypedef(this); | 1353 resolution.resolveTypedef(this); |
1354 } | 1354 } |
1355 } | 1355 } |
1356 | 1356 |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1733 * kept to provide full information about parameter names through the mirror | 1733 * kept to provide full information about parameter names through the mirror |
1734 * system. | 1734 * system. |
1735 */ | 1735 */ |
1736 FunctionSignature _functionSignatureCache; | 1736 FunctionSignature _functionSignatureCache; |
1737 | 1737 |
1738 FormalElementX(ElementKind elementKind, FunctionTypedElement enclosingElement, | 1738 FormalElementX(ElementKind elementKind, FunctionTypedElement enclosingElement, |
1739 this.definitions, Identifier identifier) | 1739 this.definitions, Identifier identifier) |
1740 : this.identifier = identifier, | 1740 : this.identifier = identifier, |
1741 super(identifier.source, elementKind, enclosingElement); | 1741 super(identifier.source, elementKind, enclosingElement); |
1742 | 1742 |
| 1743 FormalElementX.unnamed(ElementKind elementKind, |
| 1744 FunctionTypedElement enclosingElement, |
| 1745 this.definitions) |
| 1746 : this.identifier = null, |
| 1747 super("<unnamed>", elementKind, enclosingElement); |
| 1748 |
| 1749 /// Whether this is an unnamed parameter in a Function type. |
| 1750 bool get isUnnamed => identifier == null; |
| 1751 |
1743 FunctionTypedElement get functionDeclaration => enclosingElement; | 1752 FunctionTypedElement get functionDeclaration => enclosingElement; |
1744 | 1753 |
1745 Modifiers get modifiers => definitions.modifiers; | 1754 Modifiers get modifiers => definitions.modifiers; |
1746 | 1755 |
1747 Token get position => identifier.getBeginToken(); | 1756 Token get position => identifier.getBeginToken(); |
1748 | 1757 |
1749 Node parseNode(ParsingContext parsing) => definitions; | 1758 Node parseNode(ParsingContext parsing) => definitions; |
1750 | 1759 |
1751 DartType computeType(Resolution resolution) { | 1760 DartType computeType(Resolution resolution) { |
1752 assert(invariant(this, type != null, | 1761 assert(invariant(this, type != null, |
(...skipping 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3414 body = node.asFunctionExpression().body; | 3423 body = node.asFunctionExpression().body; |
3415 } | 3424 } |
3416 return new ParsedResolvedAst( | 3425 return new ParsedResolvedAst( |
3417 declaration, | 3426 declaration, |
3418 node, | 3427 node, |
3419 body, | 3428 body, |
3420 definingElement.treeElements, | 3429 definingElement.treeElements, |
3421 definingElement.compilationUnit.script.resourceUri); | 3430 definingElement.compilationUnit.script.resourceUri); |
3422 } | 3431 } |
3423 } | 3432 } |
OLD | NEW |