| 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 part of resolution; | 5 part of resolution; |
| 6 | 6 |
| 7 abstract class TreeElements { | 7 abstract class TreeElements { |
| 8 Element get currentElement; | 8 Element get currentElement; |
| 9 Setlet<Node> get superUses; | 9 Setlet<Node> get superUses; |
| 10 | 10 |
| (...skipping 3169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3180 compiler.backend.registerRequiredType(type, enclosingElement); | 3180 compiler.backend.registerRequiredType(type, enclosingElement); |
| 3181 } | 3181 } |
| 3182 return type; | 3182 return type; |
| 3183 } | 3183 } |
| 3184 | 3184 |
| 3185 visitModifiers(Modifiers node) { | 3185 visitModifiers(Modifiers node) { |
| 3186 internalError(node, 'modifiers'); | 3186 internalError(node, 'modifiers'); |
| 3187 } | 3187 } |
| 3188 | 3188 |
| 3189 visitLiteralList(LiteralList node) { | 3189 visitLiteralList(LiteralList node) { |
| 3190 bool oldSendIsMemberAccess = sendIsMemberAccess; |
| 3191 sendIsMemberAccess = false; |
| 3192 |
| 3190 NodeList arguments = node.typeArguments; | 3193 NodeList arguments = node.typeArguments; |
| 3191 DartType typeArgument; | 3194 DartType typeArgument; |
| 3192 if (arguments != null) { | 3195 if (arguments != null) { |
| 3193 Link<Node> nodes = arguments.nodes; | 3196 Link<Node> nodes = arguments.nodes; |
| 3194 if (nodes.isEmpty) { | 3197 if (nodes.isEmpty) { |
| 3195 // The syntax [: <>[] :] is not allowed. | 3198 // The syntax [: <>[] :] is not allowed. |
| 3196 error(arguments, MessageKind.MISSING_TYPE_ARGUMENT); | 3199 error(arguments, MessageKind.MISSING_TYPE_ARGUMENT); |
| 3197 } else { | 3200 } else { |
| 3198 typeArgument = resolveTypeAnnotation(nodes.head); | 3201 typeArgument = resolveTypeAnnotation(nodes.head); |
| 3199 for (nodes = nodes.tail; !nodes.isEmpty; nodes = nodes.tail) { | 3202 for (nodes = nodes.tail; !nodes.isEmpty; nodes = nodes.tail) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 3214 compiler.listClass.computeType(compiler); | 3217 compiler.listClass.computeType(compiler); |
| 3215 listType = compiler.listClass.rawType; | 3218 listType = compiler.listClass.rawType; |
| 3216 } | 3219 } |
| 3217 mapping.setType(node, listType); | 3220 mapping.setType(node, listType); |
| 3218 world.registerInstantiatedType(listType, mapping); | 3221 world.registerInstantiatedType(listType, mapping); |
| 3219 compiler.backend.registerRequiredType(listType, enclosingElement); | 3222 compiler.backend.registerRequiredType(listType, enclosingElement); |
| 3220 visit(node.elements); | 3223 visit(node.elements); |
| 3221 if (node.isConst()) { | 3224 if (node.isConst()) { |
| 3222 analyzeConstant(node); | 3225 analyzeConstant(node); |
| 3223 } | 3226 } |
| 3227 |
| 3228 sendIsMemberAccess = false; |
| 3224 } | 3229 } |
| 3225 | 3230 |
| 3226 visitConditional(Conditional node) { | 3231 visitConditional(Conditional node) { |
| 3227 doInPromotionScope(node.condition, () => visit(node.condition)); | 3232 doInPromotionScope(node.condition, () => visit(node.condition)); |
| 3228 doInPromotionScope(node.thenExpression, () => visit(node.thenExpression)); | 3233 doInPromotionScope(node.thenExpression, () => visit(node.thenExpression)); |
| 3229 visit(node.elseExpression); | 3234 visit(node.elseExpression); |
| 3230 } | 3235 } |
| 3231 | 3236 |
| 3232 visitStringInterpolation(StringInterpolation node) { | 3237 visitStringInterpolation(StringInterpolation node) { |
| 3233 world.registerInstantiatedClass(compiler.stringClass, mapping); | 3238 world.registerInstantiatedClass(compiler.stringClass, mapping); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3394 } | 3399 } |
| 3395 }); | 3400 }); |
| 3396 if (!targetElement.isTarget && identical(mapping[body], targetElement)) { | 3401 if (!targetElement.isTarget && identical(mapping[body], targetElement)) { |
| 3397 // If the body is itself a break or continue for another target, it | 3402 // If the body is itself a break or continue for another target, it |
| 3398 // might have updated its mapping to the target it actually does target. | 3403 // might have updated its mapping to the target it actually does target. |
| 3399 mapping.remove(body); | 3404 mapping.remove(body); |
| 3400 } | 3405 } |
| 3401 } | 3406 } |
| 3402 | 3407 |
| 3403 visitLiteralMap(LiteralMap node) { | 3408 visitLiteralMap(LiteralMap node) { |
| 3409 bool oldSendIsMemberAccess = sendIsMemberAccess; |
| 3410 sendIsMemberAccess = false; |
| 3411 |
| 3404 NodeList arguments = node.typeArguments; | 3412 NodeList arguments = node.typeArguments; |
| 3405 DartType keyTypeArgument; | 3413 DartType keyTypeArgument; |
| 3406 DartType valueTypeArgument; | 3414 DartType valueTypeArgument; |
| 3407 if (arguments != null) { | 3415 if (arguments != null) { |
| 3408 Link<Node> nodes = arguments.nodes; | 3416 Link<Node> nodes = arguments.nodes; |
| 3409 if (nodes.isEmpty) { | 3417 if (nodes.isEmpty) { |
| 3410 // The syntax [: <>{} :] is not allowed. | 3418 // The syntax [: <>{} :] is not allowed. |
| 3411 error(arguments, MessageKind.MISSING_TYPE_ARGUMENT); | 3419 error(arguments, MessageKind.MISSING_TYPE_ARGUMENT); |
| 3412 } else { | 3420 } else { |
| 3413 keyTypeArgument = resolveTypeAnnotation(nodes.head); | 3421 keyTypeArgument = resolveTypeAnnotation(nodes.head); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 3438 mapping.setType(node, mapType); | 3446 mapping.setType(node, mapType); |
| 3439 world.registerInstantiatedType(mapType, mapping); | 3447 world.registerInstantiatedType(mapType, mapping); |
| 3440 if (node.isConst()) { | 3448 if (node.isConst()) { |
| 3441 compiler.backend.registerConstantMap(mapping); | 3449 compiler.backend.registerConstantMap(mapping); |
| 3442 } | 3450 } |
| 3443 compiler.backend.registerRequiredType(mapType, enclosingElement); | 3451 compiler.backend.registerRequiredType(mapType, enclosingElement); |
| 3444 node.visitChildren(this); | 3452 node.visitChildren(this); |
| 3445 if (node.isConst()) { | 3453 if (node.isConst()) { |
| 3446 analyzeConstant(node); | 3454 analyzeConstant(node); |
| 3447 } | 3455 } |
| 3456 |
| 3457 sendIsMemberAccess = false; |
| 3448 } | 3458 } |
| 3449 | 3459 |
| 3450 visitLiteralMapEntry(LiteralMapEntry node) { | 3460 visitLiteralMapEntry(LiteralMapEntry node) { |
| 3451 node.visitChildren(this); | 3461 node.visitChildren(this); |
| 3452 } | 3462 } |
| 3453 | 3463 |
| 3454 visitNamedArgument(NamedArgument node) { | 3464 visitNamedArgument(NamedArgument node) { |
| 3455 visit(node.expression); | 3465 visit(node.expression); |
| 3456 } | 3466 } |
| 3457 | 3467 |
| (...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4648 TreeElements _treeElements; | 4658 TreeElements _treeElements; |
| 4649 | 4659 |
| 4650 bool get hasTreeElements => _treeElements != null; | 4660 bool get hasTreeElements => _treeElements != null; |
| 4651 | 4661 |
| 4652 TreeElements get treeElements { | 4662 TreeElements get treeElements { |
| 4653 assert(invariant(this, _treeElements !=null, | 4663 assert(invariant(this, _treeElements !=null, |
| 4654 message: "TreeElements have not been computed for $this.")); | 4664 message: "TreeElements have not been computed for $this.")); |
| 4655 return _treeElements; | 4665 return _treeElements; |
| 4656 } | 4666 } |
| 4657 } | 4667 } |
| OLD | NEW |