Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1287)

Side by Side Diff: pkg/compiler/lib/src/elements/modelx.dart

Issue 2567133002: Add support for the new function-type syntax. (Closed)
Patch Set: Add new test and remove generated tests for this CL. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1326 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 * system. 1337 * system.
1338 * 1338 *
1339 * The [functionSignature] is not available until the typedef element has been 1339 * The [functionSignature] is not available until the typedef element has been
1340 * resolved. 1340 * resolved.
1341 */ 1341 */
1342 FunctionSignature functionSignature; 1342 FunctionSignature functionSignature;
1343 1343
1344 ResolutionTypedefType computeType(Resolution resolution) { 1344 ResolutionTypedefType computeType(Resolution resolution) {
1345 if (thisTypeCache != null) return thisTypeCache; 1345 if (thisTypeCache != null) return thisTypeCache;
1346 Typedef node = parseNode(resolution.parsingContext); 1346 Typedef node = parseNode(resolution.parsingContext);
1347 setThisAndRawTypes(createTypeVariables(node.typeParameters)); 1347 setThisAndRawTypes(createTypeVariables(node.templateParameters));
1348 ensureResolved(resolution); 1348 ensureResolved(resolution);
1349 return thisTypeCache; 1349 return thisTypeCache;
1350 } 1350 }
1351 1351
1352 void ensureResolved(Resolution resolution) { 1352 void ensureResolved(Resolution resolution) {
1353 if (resolutionState == STATE_NOT_STARTED) { 1353 if (resolutionState == STATE_NOT_STARTED) {
1354 resolution.resolveTypedef(this); 1354 resolution.resolveTypedef(this);
1355 } 1355 }
1356 } 1356 }
1357 1357
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
1735 * kept to provide full information about parameter names through the mirror 1735 * kept to provide full information about parameter names through the mirror
1736 * system. 1736 * system.
1737 */ 1737 */
1738 FunctionSignature _functionSignatureCache; 1738 FunctionSignature _functionSignatureCache;
1739 1739
1740 FormalElementX(ElementKind elementKind, FunctionTypedElement enclosingElement, 1740 FormalElementX(ElementKind elementKind, FunctionTypedElement enclosingElement,
1741 this.definitions, Identifier identifier) 1741 this.definitions, Identifier identifier)
1742 : this.identifier = identifier, 1742 : this.identifier = identifier,
1743 super(identifier.source, elementKind, enclosingElement); 1743 super(identifier.source, elementKind, enclosingElement);
1744 1744
1745 FormalElementX.unnamed(ElementKind elementKind,
1746 FunctionTypedElement enclosingElement,
1747 this.definitions)
1748 : this.identifier = null,
1749 super("<unnamed>", elementKind, enclosingElement);
1750
1751 /// Whether this is an unnamed parameter in a Function type.
1752 bool get isUnnamed => identifier == null;
1753
1745 FunctionTypedElement get functionDeclaration => enclosingElement; 1754 FunctionTypedElement get functionDeclaration => enclosingElement;
1746 1755
1747 Modifiers get modifiers => definitions.modifiers; 1756 Modifiers get modifiers => definitions.modifiers;
1748 1757
1749 Token get position => identifier.getBeginToken(); 1758 Token get position => identifier.getBeginToken();
1750 1759
1751 Node parseNode(ParsingContext parsing) => definitions; 1760 Node parseNode(ParsingContext parsing) => definitions;
1752 1761
1753 ResolutionDartType computeType(Resolution resolution) { 1762 ResolutionDartType computeType(Resolution resolution) {
1754 assert(invariant(this, type != null, 1763 assert(invariant(this, type != null,
(...skipping 1713 matching lines...) Expand 10 before | Expand all | Expand 10 after
3468 body = node.asFunctionExpression().body; 3477 body = node.asFunctionExpression().body;
3469 } 3478 }
3470 return new ParsedResolvedAst( 3479 return new ParsedResolvedAst(
3471 declaration, 3480 declaration,
3472 node, 3481 node,
3473 body, 3482 body,
3474 definingElement.treeElements, 3483 definingElement.treeElements,
3475 definingElement.compilationUnit.script.resourceUri); 3484 definingElement.compilationUnit.script.resourceUri);
3476 } 3485 }
3477 } 3486 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698