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

Side by Side Diff: lib/compiler/implementation/elements/elements.dart

Issue 10908012: Support checked mode for field setters. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
OLDNEW
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('elements'); 5 #library('elements');
6 6
7 #import('dart:uri'); 7 #import('dart:uri');
8 8
9 #import('../tree/tree.dart'); 9 #import('../tree/tree.dart');
10 #import('../scanner/scannerlib.dart'); 10 #import('../scanner/scannerlib.dart');
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 : super(null, kind, enclosing), 715 : super(null, kind, enclosing),
716 this.cachedNode = node, 716 this.cachedNode = node,
717 this.modifiers = node.modifiers; 717 this.modifiers = node.modifiers;
718 718
719 VariableDefinitions parseNode(DiagnosticListener listener) { 719 VariableDefinitions parseNode(DiagnosticListener listener) {
720 return cachedNode; 720 return cachedNode;
721 } 721 }
722 722
723 Type computeType(Compiler compiler) { 723 Type computeType(Compiler compiler) {
724 if (type != null) return type; 724 if (type != null) return type;
725 VariableDefinitions node = parseNode(compiler); 725 compiler.withCurrentElement(this, () {
726 if (node.type !== null) { 726 VariableDefinitions node = parseNode(compiler);
727 type = compiler.resolveTypeAnnotation(this, node.type); 727 if (node.type !== null) {
728 } else { 728 type = compiler.resolveTypeAnnotation(this, node.type);
729 // Is node.definitions exactly one FunctionExpression?
730 Link<Node> link = node.definitions.nodes;
731 if (!link.isEmpty() &&
732 link.head.asFunctionExpression() !== null &&
733 link.tail.isEmpty()) {
734 FunctionExpression functionExpression = link.head;
735 // We found exactly one FunctionExpression
736 compiler.withCurrentElement(this, () {
737 functionSignature =
738 compiler.resolveFunctionExpression(this, functionExpression);
739 });
740 type = compiler.computeFunctionType(compiler.functionClass,
741 functionSignature);
742 } else { 729 } else {
743 type = compiler.types.dynamicType; 730 // Is node.definitions exactly one FunctionExpression?
731 Link<Node> link = node.definitions.nodes;
732 if (!link.isEmpty() &&
733 link.head.asFunctionExpression() !== null &&
734 link.tail.isEmpty()) {
735 FunctionExpression functionExpression = link.head;
736 // We found exactly one FunctionExpression
737 compiler.withCurrentElement(this, () {
floitsch 2012/08/30 14:35:14 Is this still necessary?
ngeoffray 2012/08/30 17:10:21 Good catch.
738 functionSignature =
739 compiler.resolveFunctionExpression(this, functionExpression);
740 });
741 type = compiler.computeFunctionType(compiler.functionClass,
742 functionSignature);
743 } else {
744 type = compiler.types.dynamicType;
745 }
744 } 746 }
745 } 747 });
746 assert(type != null); 748 assert(type != null);
747 return type; 749 return type;
748 } 750 }
749 751
750 Token position() => cachedNode.getBeginToken(); 752 Token position() => cachedNode.getBeginToken();
751 753
752 VariableListElement cloneTo(Element enclosing, DiagnosticListener listener) { 754 VariableListElement cloneTo(Element enclosing, DiagnosticListener listener) {
753 VariableListElement result; 755 VariableListElement result;
754 if (cachedNode !== null) { 756 if (cachedNode !== null) {
755 result = new VariableListElement.node(cachedNode, kind, enclosing); 757 result = new VariableListElement.node(cachedNode, kind, enclosing);
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
1649 1651
1650 MetadataAnnotation ensureResolved(Compiler compiler) { 1652 MetadataAnnotation ensureResolved(Compiler compiler) {
1651 if (resolutionState == STATE_NOT_STARTED) { 1653 if (resolutionState == STATE_NOT_STARTED) {
1652 compiler.resolver.resolveMetadataAnnotation(this); 1654 compiler.resolver.resolveMetadataAnnotation(this);
1653 } 1655 }
1654 return this; 1656 return this;
1655 } 1657 }
1656 1658
1657 String toString() => 'MetadataAnnotation($value, $resolutionState)'; 1659 String toString() => 'MetadataAnnotation($value, $resolutionState)';
1658 } 1660 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698