Chromium Code Reviews| 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.members; | 5 library dart2js.resolution.members; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../common/names.dart' show | 8 import '../common/names.dart' show |
| 9 Selectors; | 9 Selectors; |
| 10 import '../compiler.dart' show | 10 import '../compiler.dart' show |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 32 isUserDefinableOperator; | 32 isUserDefinableOperator; |
| 33 import '../tree/tree.dart'; | 33 import '../tree/tree.dart'; |
| 34 import '../util/util.dart' show | 34 import '../util/util.dart' show |
| 35 Link; | 35 Link; |
| 36 import '../universe/call_structure.dart' show | 36 import '../universe/call_structure.dart' show |
| 37 CallStructure; | 37 CallStructure; |
| 38 import '../universe/selector.dart' show | 38 import '../universe/selector.dart' show |
| 39 Selector; | 39 Selector; |
| 40 import '../universe/use.dart' show | 40 import '../universe/use.dart' show |
| 41 DynamicUse, | 41 DynamicUse, |
| 42 StaticUse; | 42 StaticUse, |
| 43 TypeUse; | |
| 43 | 44 |
| 44 import 'access_semantics.dart'; | 45 import 'access_semantics.dart'; |
| 45 import 'class_members.dart' show MembersCreator; | 46 import 'class_members.dart' show MembersCreator; |
| 46 import 'operators.dart'; | 47 import 'operators.dart'; |
| 47 import 'send_structure.dart'; | 48 import 'send_structure.dart'; |
| 48 | 49 |
| 49 import 'constructors.dart' show | 50 import 'constructors.dart' show |
| 50 ConstructorResolver, | 51 ConstructorResolver, |
| 51 ConstructorResult; | 52 ConstructorResult; |
| 52 import 'label_scope.dart' show | 53 import 'label_scope.dart' show |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 394 } | 395 } |
| 395 return new ElementResult(element); | 396 return new ElementResult(element); |
| 396 } | 397 } |
| 397 return const NoneResult(); | 398 return const NoneResult(); |
| 398 } | 399 } |
| 399 } | 400 } |
| 400 | 401 |
| 401 TypeResult visitTypeAnnotation(TypeAnnotation node) { | 402 TypeResult visitTypeAnnotation(TypeAnnotation node) { |
| 402 DartType type = resolveTypeAnnotation(node); | 403 DartType type = resolveTypeAnnotation(node); |
| 403 if (inCheckContext) { | 404 if (inCheckContext) { |
| 404 registry.registerCheckedModeCheck(type); | 405 registry.registerTypeUse(new TypeUse.checkedModeCheck(type)); |
| 405 } | 406 } |
| 406 return new TypeResult(type); | 407 return new TypeResult(type); |
| 407 } | 408 } |
| 408 | 409 |
| 409 bool isNamedConstructor(Send node) => node.receiver != null; | 410 bool isNamedConstructor(Send node) => node.receiver != null; |
| 410 | 411 |
| 411 Selector getRedirectingThisOrSuperConstructorSelector(Send node) { | 412 Selector getRedirectingThisOrSuperConstructorSelector(Send node) { |
| 412 if (isNamedConstructor(node)) { | 413 if (isNamedConstructor(node)) { |
| 413 String constructorName = node.selector.asIdentifier().source; | 414 String constructorName = node.selector.asIdentifier().source; |
| 414 return new Selector.callConstructor( | 415 return new Selector.callConstructor( |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 480 }); | 481 }); |
| 481 addDeferredAction(enclosingElement, () { | 482 addDeferredAction(enclosingElement, () { |
| 482 functionParameters.forEachOptionalParameter( | 483 functionParameters.forEachOptionalParameter( |
| 483 (ParameterElementX parameter) { | 484 (ParameterElementX parameter) { |
| 484 parameter.constant = | 485 parameter.constant = |
| 485 compiler.resolver.constantCompiler.compileConstant(parameter); | 486 compiler.resolver.constantCompiler.compileConstant(parameter); |
| 486 }); | 487 }); |
| 487 }); | 488 }); |
| 488 if (inCheckContext) { | 489 if (inCheckContext) { |
| 489 functionParameters.forEachParameter((ParameterElement element) { | 490 functionParameters.forEachParameter((ParameterElement element) { |
| 490 registry.registerCheckedModeCheck(element.type); | 491 registry.registerTypeUse(new TypeUse.checkedModeCheck(element.type)); |
| 491 }); | 492 }); |
| 492 } | 493 } |
| 493 } | 494 } |
| 494 | 495 |
| 495 ResolutionResult visitAssert(Assert node) { | 496 ResolutionResult visitAssert(Assert node) { |
| 496 if (!compiler.enableAssertMessage) { | 497 if (!compiler.enableAssertMessage) { |
| 497 if (node.hasMessage) { | 498 if (node.hasMessage) { |
| 498 reporter.reportErrorMessage( | 499 reporter.reportErrorMessage( |
| 499 node, MessageKind.EXPERIMENTAL_ASSERT_MESSAGE); | 500 node, MessageKind.EXPERIMENTAL_ASSERT_MESSAGE); |
| 500 } | 501 } |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1155 // `e is! T`. | 1156 // `e is! T`. |
| 1156 Node typeNode = notTypeNode.receiver; | 1157 Node typeNode = notTypeNode.receiver; |
| 1157 type = resolveTypeAnnotation(typeNode); | 1158 type = resolveTypeAnnotation(typeNode); |
| 1158 sendStructure = new IsNotStructure(type); | 1159 sendStructure = new IsNotStructure(type); |
| 1159 } else { | 1160 } else { |
| 1160 // `e is T`. | 1161 // `e is T`. |
| 1161 Node typeNode = node.arguments.head; | 1162 Node typeNode = node.arguments.head; |
| 1162 type = resolveTypeAnnotation(typeNode); | 1163 type = resolveTypeAnnotation(typeNode); |
| 1163 sendStructure = new IsStructure(type); | 1164 sendStructure = new IsStructure(type); |
| 1164 } | 1165 } |
| 1165 registry.registerIsCheck(type); | 1166 registry.registerTypeUse(new TypeUse.isCheck(type)); |
| 1166 registry.registerSendStructure(node, sendStructure); | 1167 registry.registerSendStructure(node, sendStructure); |
| 1167 return const NoneResult(); | 1168 return const NoneResult(); |
| 1168 } | 1169 } |
| 1169 | 1170 |
| 1170 /// Handle a type cast expression, like `a as T`. | 1171 /// Handle a type cast expression, like `a as T`. |
| 1171 ResolutionResult handleAs(Send node) { | 1172 ResolutionResult handleAs(Send node) { |
| 1172 Node expression = node.receiver; | 1173 Node expression = node.receiver; |
| 1173 visitExpression(expression); | 1174 visitExpression(expression); |
| 1174 | 1175 |
| 1175 Node typeNode = node.arguments.head; | 1176 Node typeNode = node.arguments.head; |
| 1176 DartType type = resolveTypeAnnotation(typeNode); | 1177 DartType type = resolveTypeAnnotation(typeNode); |
| 1177 registry.registerAsCast(type); | 1178 registry.registerTypeUse(new TypeUse.asCast(type)); |
| 1178 registry.registerSendStructure(node, new AsStructure(type)); | 1179 registry.registerSendStructure(node, new AsStructure(type)); |
| 1179 return const NoneResult(); | 1180 return const NoneResult(); |
| 1180 } | 1181 } |
| 1181 | 1182 |
| 1182 /// Handle the unary expression of an unresolved unary operator [text], like | 1183 /// Handle the unary expression of an unresolved unary operator [text], like |
| 1183 /// the no longer supported `+a`. | 1184 /// the no longer supported `+a`. |
| 1184 ResolutionResult handleUnresolvedUnary(Send node, String text) { | 1185 ResolutionResult handleUnresolvedUnary(Send node, String text) { |
| 1185 Node expression = node.receiver; | 1186 Node expression = node.receiver; |
| 1186 if (node.isSuperCall) { | 1187 if (node.isSuperCall) { |
| 1187 checkSuperAccess(node); | 1188 checkSuperAccess(node); |
| (...skipping 2363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3551 } else if (node.receiver == null) { | 3552 } else if (node.receiver == null) { |
| 3552 // `a = c` | 3553 // `a = c` |
| 3553 return handleUnqualifiedSendSet(node); | 3554 return handleUnqualifiedSendSet(node); |
| 3554 } else { | 3555 } else { |
| 3555 // `a.b = c` | 3556 // `a.b = c` |
| 3556 return handleQualifiedSendSet(node); | 3557 return handleQualifiedSendSet(node); |
| 3557 } | 3558 } |
| 3558 } | 3559 } |
| 3559 | 3560 |
| 3560 ConstantResult visitLiteralInt(LiteralInt node) { | 3561 ConstantResult visitLiteralInt(LiteralInt node) { |
| 3561 registry.registerInstantiatedType(coreTypes.intType); | 3562 // TODO(johnniwinther): Make this a feature instead. |
| 3563 registry.registerTypeUse(new TypeUse.instantiation(coreTypes.intType)); | |
| 3562 ConstantExpression constant = new IntConstantExpression(node.value); | 3564 ConstantExpression constant = new IntConstantExpression(node.value); |
| 3563 registry.setConstant(node, constant); | 3565 registry.setConstant(node, constant); |
| 3564 return new ConstantResult(node, constant); | 3566 return new ConstantResult(node, constant); |
| 3565 } | 3567 } |
| 3566 | 3568 |
| 3567 ConstantResult visitLiteralDouble(LiteralDouble node) { | 3569 ConstantResult visitLiteralDouble(LiteralDouble node) { |
| 3568 registry.registerInstantiatedType(coreTypes.doubleType); | 3570 // TODO(johnniwinther): Make this a feature instead. |
| 3571 registry.registerTypeUse(new TypeUse.instantiation(coreTypes.doubleType)); | |
| 3569 ConstantExpression constant = new DoubleConstantExpression(node.value); | 3572 ConstantExpression constant = new DoubleConstantExpression(node.value); |
| 3570 registry.setConstant(node, constant); | 3573 registry.setConstant(node, constant); |
| 3571 return new ConstantResult(node, constant); | 3574 return new ConstantResult(node, constant); |
| 3572 } | 3575 } |
| 3573 | 3576 |
| 3574 ConstantResult visitLiteralBool(LiteralBool node) { | 3577 ConstantResult visitLiteralBool(LiteralBool node) { |
| 3575 registry.registerInstantiatedType(coreTypes.boolType); | 3578 // TODO(johnniwinther): Make this a feature instead. |
| 3579 registry.registerTypeUse(new TypeUse.instantiation(coreTypes.boolType)); | |
| 3576 ConstantExpression constant = new BoolConstantExpression(node.value); | 3580 ConstantExpression constant = new BoolConstantExpression(node.value); |
| 3577 registry.setConstant(node, constant); | 3581 registry.setConstant(node, constant); |
| 3578 return new ConstantResult(node, constant); | 3582 return new ConstantResult(node, constant); |
| 3579 } | 3583 } |
| 3580 | 3584 |
| 3581 ResolutionResult visitLiteralString(LiteralString node) { | 3585 ResolutionResult visitLiteralString(LiteralString node) { |
| 3582 registry.registerInstantiatedType(coreTypes.stringType); | 3586 // TODO(johnniwinther): Make this a feature instead. |
| 3587 registry.registerTypeUse(new TypeUse.instantiation(coreTypes.stringType)); | |
| 3583 if (node.dartString != null) { | 3588 if (node.dartString != null) { |
| 3584 // [dartString] might be null on parser errors. | 3589 // [dartString] might be null on parser errors. |
| 3585 ConstantExpression constant = | 3590 ConstantExpression constant = |
| 3586 new StringConstantExpression(node.dartString.slowToString()); | 3591 new StringConstantExpression(node.dartString.slowToString()); |
| 3587 registry.setConstant(node, constant); | 3592 registry.setConstant(node, constant); |
| 3588 return new ConstantResult(node, constant); | 3593 return new ConstantResult(node, constant); |
| 3589 } | 3594 } |
| 3590 return const NoneResult(); | 3595 return const NoneResult(); |
| 3591 } | 3596 } |
| 3592 | 3597 |
| 3593 ConstantResult visitLiteralNull(LiteralNull node) { | 3598 ConstantResult visitLiteralNull(LiteralNull node) { |
| 3594 registry.registerInstantiatedType(coreTypes.nullType); | 3599 registry.registerTypeUse(new TypeUse.instantiation(coreTypes.nullType)); |
| 3595 ConstantExpression constant = new NullConstantExpression(); | 3600 ConstantExpression constant = new NullConstantExpression(); |
| 3596 registry.setConstant(node, constant); | 3601 registry.setConstant(node, constant); |
| 3597 return new ConstantResult(node, constant); | 3602 return new ConstantResult(node, constant); |
| 3598 } | 3603 } |
| 3599 | 3604 |
| 3600 ConstantResult visitLiteralSymbol(LiteralSymbol node) { | 3605 ConstantResult visitLiteralSymbol(LiteralSymbol node) { |
| 3606 // TODO(johnniwinther): Make this a feature instead. | |
| 3601 String name = node.slowNameString; | 3607 String name = node.slowNameString; |
| 3602 registry.registerConstSymbol(name); | 3608 registry.registerConstSymbol(name); |
| 3603 if (!validateSymbol(node, name, reportError: false)) { | 3609 if (!validateSymbol(node, name, reportError: false)) { |
| 3604 reporter.reportErrorMessage( | 3610 reporter.reportErrorMessage( |
| 3605 node, | 3611 node, |
| 3606 MessageKind.UNSUPPORTED_LITERAL_SYMBOL, | 3612 MessageKind.UNSUPPORTED_LITERAL_SYMBOL, |
| 3607 {'value': name}); | 3613 {'value': name}); |
| 3608 } | 3614 } |
| 3609 analyzeConstantDeferred(node); | 3615 analyzeConstantDeferred(node); |
| 3610 ConstantExpression constant = new SymbolConstantExpression(name); | 3616 ConstantExpression constant = new SymbolConstantExpression(name); |
| 3611 registry.setConstant(node, constant); | 3617 registry.setConstant(node, constant); |
| 3612 return new ConstantResult(node, constant); | 3618 return new ConstantResult(node, constant); |
| 3613 } | 3619 } |
| 3614 | 3620 |
| 3615 ResolutionResult visitStringJuxtaposition(StringJuxtaposition node) { | 3621 ResolutionResult visitStringJuxtaposition(StringJuxtaposition node) { |
| 3616 registry.registerInstantiatedType(coreTypes.stringType); | 3622 // TODO(johnniwinther): Make this a feature instead. |
| 3623 registry.registerTypeUse(new TypeUse.instantiation(coreTypes.stringType)); | |
| 3617 ResolutionResult first = visit(node.first); | 3624 ResolutionResult first = visit(node.first); |
| 3618 ResolutionResult second = visit(node.second); | 3625 ResolutionResult second = visit(node.second); |
| 3619 if (first.isConstant && second.isConstant) { | 3626 if (first.isConstant && second.isConstant) { |
| 3620 ConstantExpression constant = new ConcatenateConstantExpression( | 3627 ConstantExpression constant = new ConcatenateConstantExpression( |
| 3621 <ConstantExpression>[first.constant, second.constant]); | 3628 <ConstantExpression>[first.constant, second.constant]); |
| 3622 registry.setConstant(node, constant); | 3629 registry.setConstant(node, constant); |
| 3623 return new ConstantResult(node, constant); | 3630 return new ConstantResult(node, constant); |
| 3624 } | 3631 } |
| 3625 return const NoneResult(); | 3632 return const NoneResult(); |
| 3626 } | 3633 } |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3740 } | 3747 } |
| 3741 | 3748 |
| 3742 // Register a post process to check for cycles in the redirection chain and | 3749 // Register a post process to check for cycles in the redirection chain and |
| 3743 // set the actual generative constructor at the end of the chain. | 3750 // set the actual generative constructor at the end of the chain. |
| 3744 addDeferredAction(constructor, () { | 3751 addDeferredAction(constructor, () { |
| 3745 compiler.resolver.resolveRedirectionChain(constructor, node); | 3752 compiler.resolver.resolveRedirectionChain(constructor, node); |
| 3746 }); | 3753 }); |
| 3747 | 3754 |
| 3748 registry.registerStaticUse( | 3755 registry.registerStaticUse( |
| 3749 new StaticUse.constructorRedirect(redirectionTarget)); | 3756 new StaticUse.constructorRedirect(redirectionTarget)); |
| 3750 // TODO(johnniwinther): Register the effective target type instead. | 3757 // TODO(johnniwinther): Register the effective target type as part of the |
| 3751 registry.registerInstantiatedType( | 3758 // static use instead. |
| 3759 registry.registerTypeUse(new TypeUse.instantiation( | |
| 3752 redirectionTarget.enclosingClass.thisType | 3760 redirectionTarget.enclosingClass.thisType |
| 3753 .subst(type.typeArguments, targetClass.typeVariables)); | 3761 .subst(type.typeArguments, targetClass.typeVariables))); |
| 3754 if (isSymbolConstructor) { | 3762 if (isSymbolConstructor) { |
| 3755 registry.registerSymbolConstructor(); | 3763 registry.registerSymbolConstructor(); |
| 3756 } | 3764 } |
| 3757 if (isValidAsConstant) { | 3765 if (isValidAsConstant) { |
| 3758 List<String> names = <String>[]; | 3766 List<String> names = <String>[]; |
| 3759 List<ConstantExpression> arguments = <ConstantExpression>[]; | 3767 List<ConstantExpression> arguments = <ConstantExpression>[]; |
| 3760 int index = 0; | 3768 int index = 0; |
| 3761 constructorSignature.forEachParameter((ParameterElement parameter) { | 3769 constructorSignature.forEachParameter((ParameterElement parameter) { |
| 3762 if (parameter.isNamed) { | 3770 if (parameter.isNamed) { |
| 3763 String name = parameter.name; | 3771 String name = parameter.name; |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3904 | 3912 |
| 3905 InterfaceType type = registry.getType(node); | 3913 InterfaceType type = registry.getType(node); |
| 3906 if (node.isConst && type.containsTypeVariables) { | 3914 if (node.isConst && type.containsTypeVariables) { |
| 3907 reporter.reportErrorMessage( | 3915 reporter.reportErrorMessage( |
| 3908 node.send.selector, | 3916 node.send.selector, |
| 3909 MessageKind.TYPE_VARIABLE_IN_CONSTANT); | 3917 MessageKind.TYPE_VARIABLE_IN_CONSTANT); |
| 3910 isValidAsConstant = false; | 3918 isValidAsConstant = false; |
| 3911 } | 3919 } |
| 3912 // TODO(johniwinther): Avoid registration of `type` in face of redirecting | 3920 // TODO(johniwinther): Avoid registration of `type` in face of redirecting |
| 3913 // factory constructors. | 3921 // factory constructors. |
| 3914 registry.registerInstantiatedType(type); | 3922 registry.registerTypeUse(new TypeUse.instantiation(type)); |
| 3915 if (constructor.isGenerativeConstructor && cls.isAbstract) { | 3923 if (constructor.isGenerativeConstructor && cls.isAbstract) { |
| 3916 isValidAsConstant = false; | 3924 isValidAsConstant = false; |
| 3917 } | 3925 } |
| 3918 | 3926 |
| 3919 if (isSymbolConstructor) { | 3927 if (isSymbolConstructor) { |
| 3920 if (node.isConst) { | 3928 if (node.isConst) { |
| 3921 Node argumentNode = node.send.arguments.head; | 3929 Node argumentNode = node.send.arguments.head; |
| 3922 ConstantExpression constant = | 3930 ConstantExpression constant = |
| 3923 compiler.resolver.constantCompiler.compileNode( | 3931 compiler.resolver.constantCompiler.compileNode( |
| 3924 argumentNode, registry.mapping); | 3932 argumentNode, registry.mapping); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4057 compiler, this, inConstContext: inConstContext)); | 4065 compiler, this, inConstContext: inConstContext)); |
| 4058 } | 4066 } |
| 4059 | 4067 |
| 4060 DartType resolveTypeAnnotation(TypeAnnotation node, | 4068 DartType resolveTypeAnnotation(TypeAnnotation node, |
| 4061 {bool malformedIsError: false, | 4069 {bool malformedIsError: false, |
| 4062 bool deferredIsMalformed: true}) { | 4070 bool deferredIsMalformed: true}) { |
| 4063 DartType type = typeResolver.resolveTypeAnnotation( | 4071 DartType type = typeResolver.resolveTypeAnnotation( |
| 4064 this, node, malformedIsError: malformedIsError, | 4072 this, node, malformedIsError: malformedIsError, |
| 4065 deferredIsMalformed: deferredIsMalformed); | 4073 deferredIsMalformed: deferredIsMalformed); |
| 4066 if (inCheckContext) { | 4074 if (inCheckContext) { |
| 4067 registry.registerCheckedModeCheck(type); | 4075 registry.registerTypeUse(new TypeUse.checkedModeCheck(type)); |
| 4068 } | 4076 } |
| 4069 return type; | 4077 return type; |
| 4070 } | 4078 } |
| 4071 | 4079 |
| 4072 ResolutionResult visitLiteralList(LiteralList node) { | 4080 ResolutionResult visitLiteralList(LiteralList node) { |
| 4073 bool isValidAsConstant = true; | 4081 bool isValidAsConstant = true; |
| 4074 sendIsMemberAccess = false; | 4082 sendIsMemberAccess = false; |
| 4075 | 4083 |
| 4076 NodeList arguments = node.typeArguments; | 4084 NodeList arguments = node.typeArguments; |
| 4077 DartType typeArgument; | 4085 DartType typeArgument; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4149 conditionResult.constant, | 4157 conditionResult.constant, |
| 4150 thenResult.constant, | 4158 thenResult.constant, |
| 4151 elseResult.constant); | 4159 elseResult.constant); |
| 4152 registry.setConstant(node, constant); | 4160 registry.setConstant(node, constant); |
| 4153 return new ConstantResult(node, constant); | 4161 return new ConstantResult(node, constant); |
| 4154 } | 4162 } |
| 4155 return const NoneResult(); | 4163 return const NoneResult(); |
| 4156 } | 4164 } |
| 4157 | 4165 |
| 4158 ResolutionResult visitStringInterpolation(StringInterpolation node) { | 4166 ResolutionResult visitStringInterpolation(StringInterpolation node) { |
| 4159 registry.registerInstantiatedType(coreTypes.stringType); | 4167 // TODO(johnniwinther): The should be a consequence of the registration belo w. |
|
sigurdm
2015/11/04 10:37:31
Sentence is broken. Long line.
Johnni Winther
2015/11/04 13:41:09
Done.
| |
| 4168 registry.registerTypeUse(new TypeUse.instantiation(coreTypes.stringType)); | |
| 4160 registry.registerStringInterpolation(); | 4169 registry.registerStringInterpolation(); |
| 4161 registerImplicitInvocation(Selectors.toString_); | 4170 registerImplicitInvocation(Selectors.toString_); |
| 4162 | 4171 |
| 4163 bool isValidAsConstant = true; | 4172 bool isValidAsConstant = true; |
| 4164 List<ConstantExpression> parts = <ConstantExpression>[]; | 4173 List<ConstantExpression> parts = <ConstantExpression>[]; |
| 4165 | 4174 |
| 4166 void resolvePart(Node subnode) { | 4175 void resolvePart(Node subnode) { |
| 4167 ResolutionResult result = visit(subnode); | 4176 ResolutionResult result = visit(subnode); |
| 4168 if (isValidAsConstant && result.isConstant) { | 4177 if (isValidAsConstant && result.isConstant) { |
| 4169 parts.add(result.constant); | 4178 parts.add(result.constant); |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4735 inCatchBlock = oldInCatchBlock; | 4744 inCatchBlock = oldInCatchBlock; |
| 4736 | 4745 |
| 4737 if (exceptionTypeResult != null) { | 4746 if (exceptionTypeResult != null) { |
| 4738 DartType exceptionType = exceptionTypeResult.type; | 4747 DartType exceptionType = exceptionTypeResult.type; |
| 4739 if (exceptionDefinition != null) { | 4748 if (exceptionDefinition != null) { |
| 4740 Node exceptionVariable = exceptionDefinition.definitions.nodes.head; | 4749 Node exceptionVariable = exceptionDefinition.definitions.nodes.head; |
| 4741 VariableElementX exceptionElement = | 4750 VariableElementX exceptionElement = |
| 4742 registry.getDefinition(exceptionVariable); | 4751 registry.getDefinition(exceptionVariable); |
| 4743 exceptionElement.variables.type = exceptionType; | 4752 exceptionElement.variables.type = exceptionType; |
| 4744 } | 4753 } |
| 4745 registry.registerOnCatchType(exceptionType); | 4754 registry.registerTypeUse(new TypeUse.catchType(exceptionType)); |
| 4746 } | 4755 } |
| 4747 if (stackTraceDefinition != null) { | 4756 if (stackTraceDefinition != null) { |
| 4748 Node stackTraceVariable = stackTraceDefinition.definitions.nodes.head; | 4757 Node stackTraceVariable = stackTraceDefinition.definitions.nodes.head; |
| 4749 VariableElementX stackTraceElement = | 4758 VariableElementX stackTraceElement = |
| 4750 registry.getDefinition(stackTraceVariable); | 4759 registry.getDefinition(stackTraceVariable); |
| 4751 InterfaceType stackTraceType = coreTypes.stackTraceType; | 4760 InterfaceType stackTraceType = coreTypes.stackTraceType; |
| 4752 stackTraceElement.variables.type = stackTraceType; | 4761 stackTraceElement.variables.type = stackTraceType; |
| 4753 } | 4762 } |
| 4754 return const NoneResult(); | 4763 return const NoneResult(); |
| 4755 } | 4764 } |
| 4756 } | 4765 } |
| 4757 | 4766 |
| 4758 /// Looks up [name] in [scope] and unwraps the result. | 4767 /// Looks up [name] in [scope] and unwraps the result. |
| 4759 Element lookupInScope(DiagnosticReporter reporter, Node node, | 4768 Element lookupInScope(DiagnosticReporter reporter, Node node, |
| 4760 Scope scope, String name) { | 4769 Scope scope, String name) { |
| 4761 return Elements.unwrap(scope.lookup(name), reporter, node); | 4770 return Elements.unwrap(scope.lookup(name), reporter, node); |
| 4762 } | 4771 } |
| OLD | NEW |