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

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

Issue 2567133002: Add support for the new function-type syntax. (Closed)
Patch Set: Fixes after rebase. Created 3 years, 9 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 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after
1327 * system. 1327 * system.
1328 * 1328 *
1329 * The [functionSignature] is not available until the typedef element has been 1329 * The [functionSignature] is not available until the typedef element has been
1330 * resolved. 1330 * resolved.
1331 */ 1331 */
1332 FunctionSignature functionSignature; 1332 FunctionSignature functionSignature;
1333 1333
1334 ResolutionTypedefType computeType(Resolution resolution) { 1334 ResolutionTypedefType computeType(Resolution resolution) {
1335 if (thisTypeCache != null) return thisTypeCache; 1335 if (thisTypeCache != null) return thisTypeCache;
1336 Typedef node = parseNode(resolution.parsingContext); 1336 Typedef node = parseNode(resolution.parsingContext);
1337 setThisAndRawTypes(createTypeVariables(node.typeParameters)); 1337 setThisAndRawTypes(createTypeVariables(node.templateParameters));
1338 ensureResolved(resolution); 1338 ensureResolved(resolution);
1339 return thisTypeCache; 1339 return thisTypeCache;
1340 } 1340 }
1341 1341
1342 void ensureResolved(Resolution resolution) { 1342 void ensureResolved(Resolution resolution) {
1343 if (resolutionState == STATE_NOT_STARTED) { 1343 if (resolutionState == STATE_NOT_STARTED) {
1344 resolution.resolveTypedef(this); 1344 resolution.resolveTypedef(this);
1345 } 1345 }
1346 } 1346 }
1347 1347
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
1725 * kept to provide full information about parameter names through the mirror 1725 * kept to provide full information about parameter names through the mirror
1726 * system. 1726 * system.
1727 */ 1727 */
1728 FunctionSignature _functionSignatureCache; 1728 FunctionSignature _functionSignatureCache;
1729 1729
1730 FormalElementX(ElementKind elementKind, FunctionTypedElement enclosingElement, 1730 FormalElementX(ElementKind elementKind, FunctionTypedElement enclosingElement,
1731 this.definitions, Identifier identifier) 1731 this.definitions, Identifier identifier)
1732 : this.identifier = identifier, 1732 : this.identifier = identifier,
1733 super(identifier.source, elementKind, enclosingElement); 1733 super(identifier.source, elementKind, enclosingElement);
1734 1734
1735 FormalElementX.unnamed(ElementKind elementKind,
1736 FunctionTypedElement enclosingElement,
1737 this.definitions)
1738 : this.identifier = null,
1739 super("<unnamed>", elementKind, enclosingElement);
1740
1741 /// Whether this is an unnamed parameter in a Function type.
1742 bool get isUnnamed => identifier == null;
1743
1735 FunctionTypedElement get functionDeclaration => enclosingElement; 1744 FunctionTypedElement get functionDeclaration => enclosingElement;
1736 1745
1737 Modifiers get modifiers => definitions.modifiers; 1746 Modifiers get modifiers => definitions.modifiers;
1738 1747
1739 Token get position => identifier.getBeginToken(); 1748 Token get position => identifier.getBeginToken();
1740 1749
1741 Node parseNode(ParsingContext parsing) => definitions; 1750 Node parseNode(ParsingContext parsing) => definitions;
1742 1751
1743 ResolutionDartType computeType(Resolution resolution) { 1752 ResolutionDartType computeType(Resolution resolution) {
1744 assert(invariant(this, type != null, 1753 assert(invariant(this, type != null,
(...skipping 1713 matching lines...) Expand 10 before | Expand all | Expand 10 after
3458 body = node.asFunctionExpression().body; 3467 body = node.asFunctionExpression().body;
3459 } 3468 }
3460 return new ParsedResolvedAst( 3469 return new ParsedResolvedAst(
3461 declaration, 3470 declaration,
3462 node, 3471 node,
3463 body, 3472 body,
3464 definingElement.treeElements, 3473 definingElement.treeElements,
3465 definingElement.compilationUnit.script.resourceUri); 3474 definingElement.compilationUnit.script.resourceUri);
3466 } 3475 }
3467 } 3476 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698