| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
| 2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
| 3 | 3 |
| 4 library engine.resolver; | 4 library engine.resolver; |
| 5 | 5 |
| 6 import 'dart:collection'; | 6 import 'dart:collection'; |
| 7 import 'java_core.dart'; | 7 import 'java_core.dart'; |
| 8 import 'java_engine.dart'; | 8 import 'java_engine.dart'; |
| 9 import 'instrumentation.dart'; | 9 import 'instrumentation.dart'; |
| 10 import 'source.dart'; | 10 import 'source.dart'; |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 /** | 354 /** |
| 355 * Analyzes [classDeclaration] and if it is a module, creates [AngularModuleEl
ement] | 355 * Analyzes [classDeclaration] and if it is a module, creates [AngularModuleEl
ement] |
| 356 * model for it. | 356 * model for it. |
| 357 */ | 357 */ |
| 358 void parseModuleClass() { | 358 void parseModuleClass() { |
| 359 if (!isModule4) { | 359 if (!isModule4) { |
| 360 return; | 360 return; |
| 361 } | 361 } |
| 362 List<AngularModuleElement> childModules = []; | 362 List<AngularModuleElement> childModules = []; |
| 363 List<ClassElement> keyTypes = []; | 363 List<ClassElement> keyTypes = []; |
| 364 _classDeclaration.accept(new RecursiveASTVisitor_10(this, childModules, keyT
ypes)); | 364 _classDeclaration.accept(new RecursiveASTVisitor_AngularCompilationUnitBuild
er_parseModuleClass(this, childModules, keyTypes)); |
| 365 AngularModuleElementImpl module = createModuleElement(childModules, keyTypes
); | 365 AngularModuleElementImpl module = createModuleElement(childModules, keyTypes
); |
| 366 _classToolkitObjects.add(module); | 366 _classToolkitObjects.add(module); |
| 367 } | 367 } |
| 368 | 368 |
| 369 /** | 369 /** |
| 370 * Checks if given [MethodInvocation] is an interesting <code>Module</code> me
thod | 370 * Checks if given [MethodInvocation] is an interesting <code>Module</code> me
thod |
| 371 * invocation and remembers corresponding elements into lists. | 371 * invocation and remembers corresponding elements into lists. |
| 372 */ | 372 */ |
| 373 void parseModuleInvocation(MethodInvocation node, List<AngularModuleElement> c
hildModules, List<ClassElement> keyTypes) { | 373 void parseModuleInvocation(MethodInvocation node, List<AngularModuleElement> c
hildModules, List<ClassElement> keyTypes) { |
| 374 String methodName = node.methodName.name; | 374 String methodName = node.methodName.name; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 396 } | 396 } |
| 397 return; | 397 return; |
| 398 } | 398 } |
| 399 } | 399 } |
| 400 | 400 |
| 401 /** | 401 /** |
| 402 * Checks every local variable in the given unit to see if it is a <code>Modul
e</code> and creates | 402 * Checks every local variable in the given unit to see if it is a <code>Modul
e</code> and creates |
| 403 * [AngularModuleElement] for it. | 403 * [AngularModuleElement] for it. |
| 404 */ | 404 */ |
| 405 void parseModuleVariables(CompilationUnit unit) { | 405 void parseModuleVariables(CompilationUnit unit) { |
| 406 unit.accept(new RecursiveASTVisitor_11(this)); | 406 unit.accept(new RecursiveASTVisitor_AngularCompilationUnitBuilder_parseModul
eVariables(this)); |
| 407 } | 407 } |
| 408 | 408 |
| 409 void parseNgComponent() { | 409 void parseNgComponent() { |
| 410 bool isValid = true; | 410 bool isValid = true; |
| 411 if (!hasStringArgument(_PUBLISH_AS)) { | 411 if (!hasStringArgument(_PUBLISH_AS)) { |
| 412 reportErrorForAnnotation(AngularCode.MISSING_PUBLISH_AS, []); | 412 reportErrorForAnnotation(AngularCode.MISSING_PUBLISH_AS, []); |
| 413 isValid = false; | 413 isValid = false; |
| 414 } | 414 } |
| 415 AngularSelectorElement selector = null; | 415 AngularSelectorElement selector = null; |
| 416 if (!hasStringArgument(_SELECTOR)) { | 416 if (!hasStringArgument(_SELECTOR)) { |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 void reportErrorForAnnotation(ErrorCode errorCode, List<Object> arguments) { | 639 void reportErrorForAnnotation(ErrorCode errorCode, List<Object> arguments) { |
| 640 reportError(_annotation, errorCode, arguments); | 640 reportError(_annotation, errorCode, arguments); |
| 641 } | 641 } |
| 642 | 642 |
| 643 void reportErrorForArgument(String argumentName, ErrorCode errorCode, List<Obj
ect> arguments) { | 643 void reportErrorForArgument(String argumentName, ErrorCode errorCode, List<Obj
ect> arguments) { |
| 644 Expression argument = getArgument(argumentName); | 644 Expression argument = getArgument(argumentName); |
| 645 reportError(argument, errorCode, arguments); | 645 reportError(argument, errorCode, arguments); |
| 646 } | 646 } |
| 647 } | 647 } |
| 648 | 648 |
| 649 class RecursiveASTVisitor_10 extends RecursiveASTVisitor<Object> { | 649 class RecursiveASTVisitor_AngularCompilationUnitBuilder_parseModuleClass extends
RecursiveASTVisitor<Object> { |
| 650 final AngularCompilationUnitBuilder AngularCompilationUnitBuilder_this; | 650 final AngularCompilationUnitBuilder AngularCompilationUnitBuilder_this; |
| 651 | 651 |
| 652 List<AngularModuleElement> childModules; | 652 List<AngularModuleElement> childModules; |
| 653 | 653 |
| 654 List<ClassElement> keyTypes; | 654 List<ClassElement> keyTypes; |
| 655 | 655 |
| 656 RecursiveASTVisitor_10(this.AngularCompilationUnitBuilder_this, this.childModu
les, this.keyTypes) : super(); | 656 RecursiveASTVisitor_AngularCompilationUnitBuilder_parseModuleClass(this.Angula
rCompilationUnitBuilder_this, this.childModules, this.keyTypes) : super(); |
| 657 | 657 |
| 658 Object visitMethodInvocation(MethodInvocation node) { | 658 Object visitMethodInvocation(MethodInvocation node) { |
| 659 if (node.target == null) { | 659 if (node.target == null) { |
| 660 AngularCompilationUnitBuilder_this.parseModuleInvocation(node, childModule
s, keyTypes); | 660 AngularCompilationUnitBuilder_this.parseModuleInvocation(node, childModule
s, keyTypes); |
| 661 } | 661 } |
| 662 return null; | 662 return null; |
| 663 } | 663 } |
| 664 } | 664 } |
| 665 | 665 |
| 666 class RecursiveASTVisitor_11 extends RecursiveASTVisitor<Object> { | 666 class RecursiveASTVisitor_AngularCompilationUnitBuilder_parseModuleVariables ext
ends RecursiveASTVisitor<Object> { |
| 667 final AngularCompilationUnitBuilder AngularCompilationUnitBuilder_this; | 667 final AngularCompilationUnitBuilder AngularCompilationUnitBuilder_this; |
| 668 | 668 |
| 669 RecursiveASTVisitor_11(this.AngularCompilationUnitBuilder_this) : super(); | 669 RecursiveASTVisitor_AngularCompilationUnitBuilder_parseModuleVariables(this.An
gularCompilationUnitBuilder_this) : super(); |
| 670 | 670 |
| 671 LocalVariableElementImpl _variable = null; | 671 LocalVariableElementImpl _variable = null; |
| 672 | 672 |
| 673 Expression _variableInit = null; | 673 Expression _variableInit = null; |
| 674 | 674 |
| 675 List<AngularModuleElement> _childModules = []; | 675 List<AngularModuleElement> _childModules = []; |
| 676 | 676 |
| 677 List<ClassElement> _keyTypes = []; | 677 List<ClassElement> _keyTypes = []; |
| 678 | 678 |
| 679 Object visitFunctionDeclaration(FunctionDeclaration node) { | 679 Object visitFunctionDeclaration(FunctionDeclaration node) { |
| (...skipping 3232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3912 if (prefixElement != null && prefix.name == prefixElement.displayName)
{ | 3912 if (prefixElement != null && prefix.name == prefixElement.displayName)
{ |
| 3913 return element; | 3913 return element; |
| 3914 } | 3914 } |
| 3915 } | 3915 } |
| 3916 } | 3916 } |
| 3917 } | 3917 } |
| 3918 return null; | 3918 return null; |
| 3919 } | 3919 } |
| 3920 | 3920 |
| 3921 void gatherElements(Element element) { | 3921 void gatherElements(Element element) { |
| 3922 element.accept(new GeneralizingElementVisitor_15(this)); | 3922 element.accept(new GeneralizingElementVisitor_DeclarationMatcher_gatherEleme
nts(this)); |
| 3923 } | 3923 } |
| 3924 | 3924 |
| 3925 /** | 3925 /** |
| 3926 * Search the most closely enclosing list of parameters for a parameter with t
he given name. | 3926 * Search the most closely enclosing list of parameters for a parameter with t
he given name. |
| 3927 * | 3927 * |
| 3928 * @param node the node defining the parameter with the given name | 3928 * @param node the node defining the parameter with the given name |
| 3929 * @param parameterName the name of the parameter being searched for | 3929 * @param parameterName the name of the parameter being searched for |
| 3930 * @return the element representing the parameter with that name | 3930 * @return the element representing the parameter with that name |
| 3931 */ | 3931 */ |
| 3932 ParameterElement getElementForParameter(FormalParameter node, SimpleIdentifier
parameterName) { | 3932 ParameterElement getElementForParameter(FormalParameter node, SimpleIdentifier
parameterName) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3974 } | 3974 } |
| 3975 | 3975 |
| 3976 /** | 3976 /** |
| 3977 * Instances of the class `DeclarationMismatchException` represent an exception
that is | 3977 * Instances of the class `DeclarationMismatchException` represent an exception
that is |
| 3978 * thrown when the element model defined by a given AST structure does not match
an existing | 3978 * thrown when the element model defined by a given AST structure does not match
an existing |
| 3979 * element model. | 3979 * element model. |
| 3980 */ | 3980 */ |
| 3981 class DeclarationMatcher_DeclarationMismatchException extends RuntimeException { | 3981 class DeclarationMatcher_DeclarationMismatchException extends RuntimeException { |
| 3982 } | 3982 } |
| 3983 | 3983 |
| 3984 class GeneralizingElementVisitor_15 extends GeneralizingElementVisitor<Object> { | 3984 class GeneralizingElementVisitor_DeclarationMatcher_gatherElements extends Gener
alizingElementVisitor<Object> { |
| 3985 final DeclarationMatcher DeclarationMatcher_this; | 3985 final DeclarationMatcher DeclarationMatcher_this; |
| 3986 | 3986 |
| 3987 GeneralizingElementVisitor_15(this.DeclarationMatcher_this) : super(); | 3987 GeneralizingElementVisitor_DeclarationMatcher_gatherElements(this.DeclarationM
atcher_this) : super(); |
| 3988 | 3988 |
| 3989 Object visitElement(Element element) { | 3989 Object visitElement(Element element) { |
| 3990 DeclarationMatcher_this._allElements.add(element); | 3990 DeclarationMatcher_this._allElements.add(element); |
| 3991 DeclarationMatcher_this._unmatchedElements.add(element); | 3991 DeclarationMatcher_this._unmatchedElements.add(element); |
| 3992 return super.visitElement(element); | 3992 return super.visitElement(element); |
| 3993 } | 3993 } |
| 3994 } | 3994 } |
| 3995 | 3995 |
| 3996 /** | 3996 /** |
| 3997 * Instances of the class `DeclarationResolver` are used to resolve declarations
in an AST | 3997 * Instances of the class `DeclarationResolver` are used to resolve declarations
in an AST |
| (...skipping 5652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9650 * Return `true` if the given variable is accessed within a closure in the giv
en | 9650 * Return `true` if the given variable is accessed within a closure in the giv
en |
| 9651 * [ASTNode] and also mutated somewhere in variable scope. This information is
only | 9651 * [ASTNode] and also mutated somewhere in variable scope. This information is
only |
| 9652 * available for local variables (including parameters). | 9652 * available for local variables (including parameters). |
| 9653 * | 9653 * |
| 9654 * @param variable the variable to check | 9654 * @param variable the variable to check |
| 9655 * @param target the [ASTNode] to check within | 9655 * @param target the [ASTNode] to check within |
| 9656 * @return `true` if this variable is potentially mutated somewhere in the giv
en ASTNode | 9656 * @return `true` if this variable is potentially mutated somewhere in the giv
en ASTNode |
| 9657 */ | 9657 */ |
| 9658 bool isVariableAccessedInClosure(Element variable, ASTNode target) { | 9658 bool isVariableAccessedInClosure(Element variable, ASTNode target) { |
| 9659 List<bool> result = [false]; | 9659 List<bool> result = [false]; |
| 9660 target.accept(new RecursiveASTVisitor_16(result, variable)); | 9660 target.accept(new RecursiveASTVisitor_ResolverVisitor_isVariableAccessedInCl
osure(result, variable)); |
| 9661 return result[0]; | 9661 return result[0]; |
| 9662 } | 9662 } |
| 9663 | 9663 |
| 9664 /** | 9664 /** |
| 9665 * Return `true` if the given variable is potentially mutated somewhere in the
given | 9665 * Return `true` if the given variable is potentially mutated somewhere in the
given |
| 9666 * [ASTNode]. This information is only available for local variables (includin
g parameters). | 9666 * [ASTNode]. This information is only available for local variables (includin
g parameters). |
| 9667 * | 9667 * |
| 9668 * @param variable the variable to check | 9668 * @param variable the variable to check |
| 9669 * @param target the [ASTNode] to check within | 9669 * @param target the [ASTNode] to check within |
| 9670 * @return `true` if this variable is potentially mutated somewhere in the giv
en ASTNode | 9670 * @return `true` if this variable is potentially mutated somewhere in the giv
en ASTNode |
| 9671 */ | 9671 */ |
| 9672 bool isVariablePotentiallyMutatedIn(Element variable, ASTNode target) { | 9672 bool isVariablePotentiallyMutatedIn(Element variable, ASTNode target) { |
| 9673 List<bool> result = [false]; | 9673 List<bool> result = [false]; |
| 9674 target.accept(new RecursiveASTVisitor_17(result, variable)); | 9674 target.accept(new RecursiveASTVisitor_ResolverVisitor_isVariablePotentiallyM
utatedIn(result, variable)); |
| 9675 return result[0]; | 9675 return result[0]; |
| 9676 } | 9676 } |
| 9677 | 9677 |
| 9678 /** | 9678 /** |
| 9679 * If it is appropriate to do so, promotes the current type of the static elem
ent associated with | 9679 * If it is appropriate to do so, promotes the current type of the static elem
ent associated with |
| 9680 * the given expression with the given type. Generally speaking, it is appropr
iate if the given | 9680 * the given expression with the given type. Generally speaking, it is appropr
iate if the given |
| 9681 * type is more specific than the current type. | 9681 * type is more specific than the current type. |
| 9682 * | 9682 * |
| 9683 * @param expression the expression used to access the static element whose ty
pes might be | 9683 * @param expression the expression used to access the static element whose ty
pes might be |
| 9684 * promoted | 9684 * promoted |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9821 | 9821 |
| 9822 get typeAnalyzer_J2DAccessor => _typeAnalyzer; | 9822 get typeAnalyzer_J2DAccessor => _typeAnalyzer; |
| 9823 | 9823 |
| 9824 set typeAnalyzer_J2DAccessor(__v) => _typeAnalyzer = __v; | 9824 set typeAnalyzer_J2DAccessor(__v) => _typeAnalyzer = __v; |
| 9825 | 9825 |
| 9826 get enclosingClass_J2DAccessor => _enclosingClass; | 9826 get enclosingClass_J2DAccessor => _enclosingClass; |
| 9827 | 9827 |
| 9828 set enclosingClass_J2DAccessor(__v) => _enclosingClass = __v; | 9828 set enclosingClass_J2DAccessor(__v) => _enclosingClass = __v; |
| 9829 } | 9829 } |
| 9830 | 9830 |
| 9831 class RecursiveASTVisitor_16 extends RecursiveASTVisitor<Object> { | 9831 class RecursiveASTVisitor_ResolverVisitor_isVariableAccessedInClosure extends Re
cursiveASTVisitor<Object> { |
| 9832 List<bool> result; | 9832 List<bool> result; |
| 9833 | 9833 |
| 9834 Element variable; | 9834 Element variable; |
| 9835 | 9835 |
| 9836 RecursiveASTVisitor_16(this.result, this.variable) : super(); | 9836 RecursiveASTVisitor_ResolverVisitor_isVariableAccessedInClosure(this.result, t
his.variable) : super(); |
| 9837 | 9837 |
| 9838 bool _inClosure = false; | 9838 bool _inClosure = false; |
| 9839 | 9839 |
| 9840 Object visitFunctionExpression(FunctionExpression node) { | 9840 Object visitFunctionExpression(FunctionExpression node) { |
| 9841 bool inClosure = this._inClosure; | 9841 bool inClosure = this._inClosure; |
| 9842 try { | 9842 try { |
| 9843 this._inClosure = true; | 9843 this._inClosure = true; |
| 9844 return super.visitFunctionExpression(node); | 9844 return super.visitFunctionExpression(node); |
| 9845 } finally { | 9845 } finally { |
| 9846 this._inClosure = inClosure; | 9846 this._inClosure = inClosure; |
| 9847 } | 9847 } |
| 9848 } | 9848 } |
| 9849 | 9849 |
| 9850 Object visitSimpleIdentifier(SimpleIdentifier node) { | 9850 Object visitSimpleIdentifier(SimpleIdentifier node) { |
| 9851 if (result[0]) { | 9851 if (result[0]) { |
| 9852 return null; | 9852 return null; |
| 9853 } | 9853 } |
| 9854 if (_inClosure && identical(node.staticElement, variable)) { | 9854 if (_inClosure && identical(node.staticElement, variable)) { |
| 9855 result[0] = javaBooleanOr(result[0], true); | 9855 result[0] = javaBooleanOr(result[0], true); |
| 9856 } | 9856 } |
| 9857 return null; | 9857 return null; |
| 9858 } | 9858 } |
| 9859 } | 9859 } |
| 9860 | 9860 |
| 9861 class RecursiveASTVisitor_17 extends RecursiveASTVisitor<Object> { | 9861 class RecursiveASTVisitor_ResolverVisitor_isVariablePotentiallyMutatedIn extends
RecursiveASTVisitor<Object> { |
| 9862 List<bool> result; | 9862 List<bool> result; |
| 9863 | 9863 |
| 9864 Element variable; | 9864 Element variable; |
| 9865 | 9865 |
| 9866 RecursiveASTVisitor_17(this.result, this.variable) : super(); | 9866 RecursiveASTVisitor_ResolverVisitor_isVariablePotentiallyMutatedIn(this.result
, this.variable) : super(); |
| 9867 | 9867 |
| 9868 Object visitSimpleIdentifier(SimpleIdentifier node) { | 9868 Object visitSimpleIdentifier(SimpleIdentifier node) { |
| 9869 if (result[0]) { | 9869 if (result[0]) { |
| 9870 return null; | 9870 return null; |
| 9871 } | 9871 } |
| 9872 if (identical(node.staticElement, variable)) { | 9872 if (identical(node.staticElement, variable)) { |
| 9873 if (node.inSetterContext()) { | 9873 if (node.inSetterContext()) { |
| 9874 result[0] = javaBooleanOr(result[0], true); | 9874 result[0] = javaBooleanOr(result[0], true); |
| 9875 } | 9875 } |
| 9876 } | 9876 } |
| (...skipping 1754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11631 * @param body the boy of the function whose propagated return type is to be c
omputed | 11631 * @param body the boy of the function whose propagated return type is to be c
omputed |
| 11632 * @return the propagated return type that was computed | 11632 * @return the propagated return type that was computed |
| 11633 */ | 11633 */ |
| 11634 Type2 computePropagatedReturnType2(FunctionBody body) { | 11634 Type2 computePropagatedReturnType2(FunctionBody body) { |
| 11635 if (body is ExpressionFunctionBody) { | 11635 if (body is ExpressionFunctionBody) { |
| 11636 ExpressionFunctionBody expressionBody = body; | 11636 ExpressionFunctionBody expressionBody = body; |
| 11637 return expressionBody.expression.bestType; | 11637 return expressionBody.expression.bestType; |
| 11638 } | 11638 } |
| 11639 if (body is BlockFunctionBody) { | 11639 if (body is BlockFunctionBody) { |
| 11640 List<Type2> result = [null]; | 11640 List<Type2> result = [null]; |
| 11641 body.accept(new GeneralizingASTVisitor_18(result)); | 11641 body.accept(new GeneralizingASTVisitor_StaticTypeAnalyzer_computePropagate
dReturnType2(result)); |
| 11642 return result[0]; | 11642 return result[0]; |
| 11643 } | 11643 } |
| 11644 return null; | 11644 return null; |
| 11645 } | 11645 } |
| 11646 | 11646 |
| 11647 /** | 11647 /** |
| 11648 * Compute the static return type of the method or function represented by the
given element. | 11648 * Compute the static return type of the method or function represented by the
given element. |
| 11649 * | 11649 * |
| 11650 * @param element the element representing the method or function invoked by t
he given node | 11650 * @param element the element representing the method or function invoked by t
he given node |
| 11651 * @return the static return type that was computed | 11651 * @return the static return type that was computed |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11994 } | 11994 } |
| 11995 } | 11995 } |
| 11996 return staticType; | 11996 return staticType; |
| 11997 } | 11997 } |
| 11998 | 11998 |
| 11999 get thisType_J2DAccessor => _thisType; | 11999 get thisType_J2DAccessor => _thisType; |
| 12000 | 12000 |
| 12001 set thisType_J2DAccessor(__v) => _thisType = __v; | 12001 set thisType_J2DAccessor(__v) => _thisType = __v; |
| 12002 } | 12002 } |
| 12003 | 12003 |
| 12004 class GeneralizingASTVisitor_18 extends GeneralizingASTVisitor<Object> { | 12004 class GeneralizingASTVisitor_StaticTypeAnalyzer_computePropagatedReturnType2 ext
ends GeneralizingASTVisitor<Object> { |
| 12005 List<Type2> result; | 12005 List<Type2> result; |
| 12006 | 12006 |
| 12007 GeneralizingASTVisitor_18(this.result) : super(); | 12007 GeneralizingASTVisitor_StaticTypeAnalyzer_computePropagatedReturnType2(this.re
sult) : super(); |
| 12008 | 12008 |
| 12009 Object visitExpression(Expression node) => null; | 12009 Object visitExpression(Expression node) => null; |
| 12010 | 12010 |
| 12011 Object visitReturnStatement(ReturnStatement node) { | 12011 Object visitReturnStatement(ReturnStatement node) { |
| 12012 Type2 type; | 12012 Type2 type; |
| 12013 Expression expression = node.expression; | 12013 Expression expression = node.expression; |
| 12014 if (expression != null) { | 12014 if (expression != null) { |
| 12015 type = expression.bestType; | 12015 type = expression.bestType; |
| 12016 } else { | 12016 } else { |
| 12017 type = BottomTypeImpl.instance; | 12017 type = BottomTypeImpl.instance; |
| (...skipping 3120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15138 } | 15138 } |
| 15139 | 15139 |
| 15140 /** | 15140 /** |
| 15141 * Validates that the given expression is a compile time constant. | 15141 * Validates that the given expression is a compile time constant. |
| 15142 * | 15142 * |
| 15143 * @param parameterElements the elements of parameters of constant constructor
, they are | 15143 * @param parameterElements the elements of parameters of constant constructor
, they are |
| 15144 * considered as a valid potentially constant expressions | 15144 * considered as a valid potentially constant expressions |
| 15145 * @param expression the expression to validate | 15145 * @param expression the expression to validate |
| 15146 */ | 15146 */ |
| 15147 void validateInitializerExpression(List<ParameterElement> parameterElements, E
xpression expression) { | 15147 void validateInitializerExpression(List<ParameterElement> parameterElements, E
xpression expression) { |
| 15148 EvaluationResultImpl result = expression.accept(new ConstantVisitor_21(_type
Provider, this, parameterElements)); | 15148 EvaluationResultImpl result = expression.accept(new ConstantVisitor_Constant
Verifier_validateInitializerExpression(_typeProvider, this, parameterElements)); |
| 15149 reportErrors(result, CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER)
; | 15149 reportErrors(result, CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER)
; |
| 15150 } | 15150 } |
| 15151 | 15151 |
| 15152 /** | 15152 /** |
| 15153 * Validates that all of the arguments of a constructor initializer are compil
e time constants. | 15153 * Validates that all of the arguments of a constructor initializer are compil
e time constants. |
| 15154 * | 15154 * |
| 15155 * @param parameterElements the elements of parameters of constant constructor
, they are | 15155 * @param parameterElements the elements of parameters of constant constructor
, they are |
| 15156 * considered as a valid potentially constant expressions | 15156 * considered as a valid potentially constant expressions |
| 15157 * @param argumentList the argument list to validate | 15157 * @param argumentList the argument list to validate |
| 15158 */ | 15158 */ |
| (...skipping 25 matching lines...) Expand all Loading... |
| 15184 validateInitializerInvocationArguments(parameterElements, invocation.arg
umentList); | 15184 validateInitializerInvocationArguments(parameterElements, invocation.arg
umentList); |
| 15185 } | 15185 } |
| 15186 if (initializer is SuperConstructorInvocation) { | 15186 if (initializer is SuperConstructorInvocation) { |
| 15187 SuperConstructorInvocation invocation = initializer; | 15187 SuperConstructorInvocation invocation = initializer; |
| 15188 validateInitializerInvocationArguments(parameterElements, invocation.arg
umentList); | 15188 validateInitializerInvocationArguments(parameterElements, invocation.arg
umentList); |
| 15189 } | 15189 } |
| 15190 } | 15190 } |
| 15191 } | 15191 } |
| 15192 } | 15192 } |
| 15193 | 15193 |
| 15194 class ConstantVisitor_21 extends ConstantVisitor { | 15194 class ConstantVisitor_ConstantVerifier_validateInitializerExpression extends Con
stantVisitor { |
| 15195 final ConstantVerifier ConstantVerifier_this; | 15195 final ConstantVerifier ConstantVerifier_this; |
| 15196 | 15196 |
| 15197 List<ParameterElement> parameterElements; | 15197 List<ParameterElement> parameterElements; |
| 15198 | 15198 |
| 15199 ConstantVisitor_21(TypeProvider arg0, this.ConstantVerifier_this, this.paramet
erElements) : super(arg0); | 15199 ConstantVisitor_ConstantVerifier_validateInitializerExpression(TypeProvider ar
g0, this.ConstantVerifier_this, this.parameterElements) : super(arg0); |
| 15200 | 15200 |
| 15201 EvaluationResultImpl visitSimpleIdentifier(SimpleIdentifier node) { | 15201 EvaluationResultImpl visitSimpleIdentifier(SimpleIdentifier node) { |
| 15202 Element element = node.staticElement; | 15202 Element element = node.staticElement; |
| 15203 for (ParameterElement parameterElement in parameterElements) { | 15203 for (ParameterElement parameterElement in parameterElements) { |
| 15204 if (identical(parameterElement, element) && parameterElement != null) { | 15204 if (identical(parameterElement, element) && parameterElement != null) { |
| 15205 Type2 type = parameterElement.type; | 15205 Type2 type = parameterElement.type; |
| 15206 if (type != null) { | 15206 if (type != null) { |
| 15207 if (type.isDynamic) { | 15207 if (type.isDynamic) { |
| 15208 return ConstantVerifier_this.valid(ConstantVerifier_this._typeProvid
er.objectType, DynamicState.DYNAMIC_STATE); | 15208 return ConstantVerifier_this.valid(ConstantVerifier_this._typeProvid
er.objectType, DynamicState.DYNAMIC_STATE); |
| 15209 } else if (type.isSubtypeOf(ConstantVerifier_this._boolType)) { | 15209 } else if (type.isSubtypeOf(ConstantVerifier_this._boolType)) { |
| (...skipping 4126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19336 firstIteration = false; | 19336 firstIteration = false; |
| 19337 break; | 19337 break; |
| 19338 } else { | 19338 } else { |
| 19339 return true; | 19339 return true; |
| 19340 } | 19340 } |
| 19341 } | 19341 } |
| 19342 if (current != null && !checked.contains(current)) { | 19342 if (current != null && !checked.contains(current)) { |
| 19343 break; | 19343 break; |
| 19344 } | 19344 } |
| 19345 } | 19345 } |
| 19346 current.accept(new GeneralizingElementVisitor_22(target, toCheck)); | 19346 current.accept(new GeneralizingElementVisitor_ErrorVerifier_hasTypedefSelf
Reference(target, toCheck)); |
| 19347 checked.add(current); | 19347 checked.add(current); |
| 19348 } | 19348 } |
| 19349 } | 19349 } |
| 19350 | 19350 |
| 19351 /** | 19351 /** |
| 19352 * @return `true` if given [Type] implements operator <i>==</i>, and it is not | 19352 * @return `true` if given [Type] implements operator <i>==</i>, and it is not |
| 19353 * <i>int</i> or <i>String</i>. | 19353 * <i>int</i> or <i>String</i>. |
| 19354 */ | 19354 */ |
| 19355 bool implementsEqualsWhenNotAllowed(Type2 type) { | 19355 bool implementsEqualsWhenNotAllowed(Type2 type) { |
| 19356 if (type == null || type == _typeProvider.intType || type == _typeProvider.s
tringType) { | 19356 if (type == null || type == _typeProvider.intType || type == _typeProvider.s
tringType) { |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19598 | 19598 |
| 19599 static final List<INIT_STATE> values = [ | 19599 static final List<INIT_STATE> values = [ |
| 19600 NOT_INIT, | 19600 NOT_INIT, |
| 19601 INIT_IN_DECLARATION, | 19601 INIT_IN_DECLARATION, |
| 19602 INIT_IN_FIELD_FORMAL, | 19602 INIT_IN_FIELD_FORMAL, |
| 19603 INIT_IN_INITIALIZERS]; | 19603 INIT_IN_INITIALIZERS]; |
| 19604 | 19604 |
| 19605 INIT_STATE(String name, int ordinal) : super(name, ordinal); | 19605 INIT_STATE(String name, int ordinal) : super(name, ordinal); |
| 19606 } | 19606 } |
| 19607 | 19607 |
| 19608 class GeneralizingElementVisitor_22 extends GeneralizingElementVisitor<Object> { | 19608 class GeneralizingElementVisitor_ErrorVerifier_hasTypedefSelfReference extends G
eneralizingElementVisitor<Object> { |
| 19609 Element target; | 19609 Element target; |
| 19610 | 19610 |
| 19611 List<Element> toCheck; | 19611 List<Element> toCheck; |
| 19612 | 19612 |
| 19613 GeneralizingElementVisitor_22(this.target, this.toCheck) : super(); | 19613 GeneralizingElementVisitor_ErrorVerifier_hasTypedefSelfReference(this.target,
this.toCheck) : super(); |
| 19614 | 19614 |
| 19615 bool _inClass = false; | 19615 bool _inClass = false; |
| 19616 | 19616 |
| 19617 Object visitClassElement(ClassElement element) { | 19617 Object visitClassElement(ClassElement element) { |
| 19618 addTypeToCheck(element.supertype); | 19618 addTypeToCheck(element.supertype); |
| 19619 for (InterfaceType mixin in element.mixins) { | 19619 for (InterfaceType mixin in element.mixins) { |
| 19620 addTypeToCheck(mixin); | 19620 addTypeToCheck(mixin); |
| 19621 } | 19621 } |
| 19622 _inClass = !element.isTypedef; | 19622 _inClass = !element.isTypedef; |
| 19623 try { | 19623 try { |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19725 * @param correction the template used to create the correction to be displaye
d for the error | 19725 * @param correction the template used to create the correction to be displaye
d for the error |
| 19726 */ | 19726 */ |
| 19727 ResolverErrorCode.con2(String name, int ordinal, this.type, this.message, Stri
ng correction) : super(name, ordinal) { | 19727 ResolverErrorCode.con2(String name, int ordinal, this.type, this.message, Stri
ng correction) : super(name, ordinal) { |
| 19728 this.correction10 = correction; | 19728 this.correction10 = correction; |
| 19729 } | 19729 } |
| 19730 | 19730 |
| 19731 String get correction => correction10; | 19731 String get correction => correction10; |
| 19732 | 19732 |
| 19733 ErrorSeverity get errorSeverity => type.severity; | 19733 ErrorSeverity get errorSeverity => type.severity; |
| 19734 } | 19734 } |
| OLD | NEW |