| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 /** | 5 /** |
| 6 * This library is capable of producing linked summaries from unlinked | 6 * This library is capable of producing linked summaries from unlinked |
| 7 * ones (or prelinked ones). It functions by building a miniature | 7 * ones (or prelinked ones). It functions by building a miniature |
| 8 * element model to represent the contents of the summaries, and then | 8 * element model to represent the contents of the summaries, and then |
| 9 * scanning the element model to gather linked information and adding | 9 * scanning the element model to gather linked information and adding |
| 10 * it to the summary data structures. | 10 * it to the summary data structures. |
| (...skipping 1962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1973 | 1973 |
| 1974 ExprTypeComputer._(this.function, this.unit, this.library, this.linker, | 1974 ExprTypeComputer._(this.function, this.unit, this.library, this.linker, |
| 1975 this.typeProvider, this.unlinkedConst); | 1975 this.typeProvider, this.unlinkedConst); |
| 1976 | 1976 |
| 1977 DartType compute() { | 1977 DartType compute() { |
| 1978 if (unlinkedConst == null) { | 1978 if (unlinkedConst == null) { |
| 1979 // No function body was stored for this function, so we can't infer its | 1979 // No function body was stored for this function, so we can't infer its |
| 1980 // return type. Assume `dynamic`. | 1980 // return type. Assume `dynamic`. |
| 1981 return DynamicTypeImpl.instance; | 1981 return DynamicTypeImpl.instance; |
| 1982 } | 1982 } |
| 1983 // If no operations, we cannot compute the type. Assume `dynamic`. |
| 1984 if (unlinkedConst.operations.isEmpty) { |
| 1985 return DynamicTypeImpl.instance; |
| 1986 } |
| 1983 // Perform RPN evaluation of the constant, using a stack of inferred types. | 1987 // Perform RPN evaluation of the constant, using a stack of inferred types. |
| 1984 for (UnlinkedExprOperation operation in unlinkedConst.operations) { | 1988 for (UnlinkedExprOperation operation in unlinkedConst.operations) { |
| 1985 switch (operation) { | 1989 switch (operation) { |
| 1986 case UnlinkedExprOperation.pushInt: | 1990 case UnlinkedExprOperation.pushInt: |
| 1987 intPtr++; | 1991 intPtr++; |
| 1988 stack.add(typeProvider.intType); | 1992 stack.add(typeProvider.intType); |
| 1989 break; | 1993 break; |
| 1990 case UnlinkedExprOperation.pushLongInt: | 1994 case UnlinkedExprOperation.pushLongInt: |
| 1991 int numInts = _getNextInt(); | 1995 int numInts = _getNextInt(); |
| 1992 intPtr += numInts; | 1996 intPtr += numInts; |
| (...skipping 3005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4998 * there are no type parameters in scope. | 5002 * there are no type parameters in scope. |
| 4999 */ | 5003 */ |
| 5000 TypeParameterizedElementMixin get _typeParameterContext; | 5004 TypeParameterizedElementMixin get _typeParameterContext; |
| 5001 | 5005 |
| 5002 @override | 5006 @override |
| 5003 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 5007 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
| 5004 | 5008 |
| 5005 @override | 5009 @override |
| 5006 String toString() => '$enclosingElement.$name'; | 5010 String toString() => '$enclosingElement.$name'; |
| 5007 } | 5011 } |
| OLD | NEW |