| OLD | NEW |
| 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 dart2js.resolution; | 5 library dart2js.resolution; |
| 6 | 6 |
| 7 import 'dart:collection' show Queue; | 7 import 'dart:collection' show Queue; |
| 8 | 8 |
| 9 import '../common.dart'; | 9 import '../common.dart'; |
| 10 import '../common/names.dart' show Identifiers; | 10 import '../common/names.dart' show Identifiers; |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 } | 216 } |
| 217 if (element.isConstructor) { | 217 if (element.isConstructor) { |
| 218 if (tree.returnType != null) { | 218 if (tree.returnType != null) { |
| 219 reporter.reportErrorMessage( | 219 reporter.reportErrorMessage( |
| 220 tree, MessageKind.CONSTRUCTOR_WITH_RETURN_TYPE); | 220 tree, MessageKind.CONSTRUCTOR_WITH_RETURN_TYPE); |
| 221 } | 221 } |
| 222 if (tree.hasBody && element.isConst) { | 222 if (tree.hasBody && element.isConst) { |
| 223 if (element.isGenerativeConstructor) { | 223 if (element.isGenerativeConstructor) { |
| 224 reporter.reportErrorMessage( | 224 reporter.reportErrorMessage( |
| 225 tree, MessageKind.CONST_CONSTRUCTOR_WITH_BODY); | 225 tree, MessageKind.CONST_CONSTRUCTOR_WITH_BODY); |
| 226 } else if (!tree.isRedirectingFactory) { | 226 } else if (!tree.isRedirectingFactory && !element.isPatch) { |
| 227 reporter.reportErrorMessage(tree, MessageKind.CONST_FACTORY); | 227 reporter.reportErrorMessage(tree, MessageKind.CONST_FACTORY); |
| 228 } | 228 } |
| 229 } | 229 } |
| 230 } | 230 } |
| 231 | 231 |
| 232 ResolverVisitor visitor = visitorFor(element); | 232 ResolverVisitor visitor = visitorFor(element); |
| 233 ResolutionRegistry registry = visitor.registry; | 233 ResolutionRegistry registry = visitor.registry; |
| 234 registry.defineFunction(tree, element); | 234 registry.defineFunction(tree, element); |
| 235 visitor.setupFunction(tree, element); | 235 visitor.setupFunction(tree, element); |
| 236 processAsyncMarker(compiler, element, registry); | 236 processAsyncMarker(compiler, element, registry); |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 if (seen.contains(nextTarget)) { | 446 if (seen.contains(nextTarget)) { |
| 447 reporter.reportErrorMessage( | 447 reporter.reportErrorMessage( |
| 448 node, MessageKind.CYCLIC_REDIRECTING_FACTORY); | 448 node, MessageKind.CYCLIC_REDIRECTING_FACTORY); |
| 449 targetType = target.enclosingClass.thisType; | 449 targetType = target.enclosingClass.thisType; |
| 450 isMalformed = true; | 450 isMalformed = true; |
| 451 break; | 451 break; |
| 452 } | 452 } |
| 453 seen.add(target); | 453 seen.add(target); |
| 454 target = nextTarget; | 454 target = nextTarget; |
| 455 } | 455 } |
| 456 if (!target.isMalformed && !target.hasFunctionSignature) { |
| 457 target.computeType(resolution); |
| 458 } |
| 456 | 459 |
| 457 if (target.isGenerativeConstructor && target.enclosingClass.isAbstract) { | 460 if (target.isGenerativeConstructor && target.enclosingClass.isAbstract) { |
| 458 isMalformed = true; | 461 isMalformed = true; |
| 459 } | 462 } |
| 460 if (target.isMalformed) { | 463 if (target.isMalformed) { |
| 461 isMalformed = true; | 464 isMalformed = true; |
| 462 } | 465 } |
| 463 | 466 |
| 464 if (targetType == null) { | 467 if (targetType == null) { |
| 465 assert(!target.isRedirectingFactory); | 468 assert(!target.isRedirectingFactory); |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1095 TreeElements get treeElements { | 1098 TreeElements get treeElements { |
| 1096 assert(invariant(this, _treeElements != null, | 1099 assert(invariant(this, _treeElements != null, |
| 1097 message: "TreeElements have not been computed for $this.")); | 1100 message: "TreeElements have not been computed for $this.")); |
| 1098 return _treeElements; | 1101 return _treeElements; |
| 1099 } | 1102 } |
| 1100 | 1103 |
| 1101 void reuseElement() { | 1104 void reuseElement() { |
| 1102 _treeElements = null; | 1105 _treeElements = null; |
| 1103 } | 1106 } |
| 1104 } | 1107 } |
| OLD | NEW |