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 /** | 7 /** |
8 * Core implementation of resolution. | 8 * Core implementation of resolution. |
9 * | 9 * |
10 * Do not subclass or instantiate this class outside this library | 10 * Do not subclass or instantiate this class outside this library |
(...skipping 1954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1965 } | 1965 } |
1966 registry.registerClassUsingVariableExpression(cls); | 1966 registry.registerClassUsingVariableExpression(cls); |
1967 registry.registerTypeVariableExpression(); | 1967 registry.registerTypeVariableExpression(); |
1968 registerTypeLiteralAccess(node, target); | 1968 registerTypeLiteralAccess(node, target); |
1969 } else if (target.impliesType && (!sendIsMemberAccess || node.isCall)) { | 1969 } else if (target.impliesType && (!sendIsMemberAccess || node.isCall)) { |
1970 registerTypeLiteralAccess(node, target); | 1970 registerTypeLiteralAccess(node, target); |
1971 } | 1971 } |
1972 registerPotentialAccessInClosure(node, target); | 1972 registerPotentialAccessInClosure(node, target); |
1973 } | 1973 } |
1974 | 1974 |
1975 bool resolvedArguments = false; | |
1976 resolveArguments(node.argumentsNode); | 1975 resolveArguments(node.argumentsNode); |
1977 | 1976 |
1978 // If the selector is null, it means that we will not be generating | 1977 // If the selector is null, it means that we will not be generating |
1979 // code for this as a send. | 1978 // code for this as a send. |
1980 Selector selector = registry.getSelector(node); | 1979 Selector selector = registry.getSelector(node); |
1981 if (selector == null) return const NoneResult(); | 1980 if (selector == null) return const NoneResult(); |
1982 | 1981 |
1983 if (node.isCall) { | 1982 if (node.isCall) { |
1984 if (Elements.isUnresolved(target) || | 1983 if (Elements.isUnresolved(target) || |
1985 target.isGetter || | 1984 target.isGetter || |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2460 ResolutionResult result = visit(node.expression); | 2459 ResolutionResult result = visit(node.expression); |
2461 allowedCategory = oldCategory; | 2460 allowedCategory = oldCategory; |
2462 sendIsMemberAccess = oldSendIsMemberAccess; | 2461 sendIsMemberAccess = oldSendIsMemberAccess; |
2463 if (result.kind == ResultKind.CONSTANT) { | 2462 if (result.kind == ResultKind.CONSTANT) { |
2464 return result; | 2463 return result; |
2465 } | 2464 } |
2466 return const NoneResult(); | 2465 return const NoneResult(); |
2467 } | 2466 } |
2468 | 2467 |
2469 ResolutionResult visitNewExpression(NewExpression node) { | 2468 ResolutionResult visitNewExpression(NewExpression node) { |
2470 Node selector = node.send.selector; | |
2471 FunctionElement constructor = resolveConstructor(node); | 2469 FunctionElement constructor = resolveConstructor(node); |
2472 final bool isSymbolConstructor = constructor == compiler.symbolConstructor; | 2470 final bool isSymbolConstructor = constructor == compiler.symbolConstructor; |
2473 final bool isMirrorsUsedConstant = | 2471 final bool isMirrorsUsedConstant = |
2474 node.isConst && (constructor == compiler.mirrorsUsedConstructor); | 2472 node.isConst && (constructor == compiler.mirrorsUsedConstructor); |
2475 Selector callSelector = resolveSelector(node.send, constructor); | 2473 Selector callSelector = resolveSelector(node.send, constructor); |
2476 resolveArguments(node.send.argumentsNode); | 2474 resolveArguments(node.send.argumentsNode); |
2477 registry.useElement(node.send, constructor); | 2475 registry.useElement(node.send, constructor); |
2478 if (Elements.isUnresolved(constructor)) { | 2476 if (Elements.isUnresolved(constructor)) { |
2479 return new ResolutionResult.forElement(constructor); | 2477 return new ResolutionResult.forElement(constructor); |
2480 } | 2478 } |
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3265 } | 3263 } |
3266 return const NoneResult(); | 3264 return const NoneResult(); |
3267 } | 3265 } |
3268 } | 3266 } |
3269 | 3267 |
3270 /// Looks up [name] in [scope] and unwraps the result. | 3268 /// Looks up [name] in [scope] and unwraps the result. |
3271 Element lookupInScope(Compiler compiler, Node node, | 3269 Element lookupInScope(Compiler compiler, Node node, |
3272 Scope scope, String name) { | 3270 Scope scope, String name) { |
3273 return Elements.unwrap(scope.lookup(name), compiler, node); | 3271 return Elements.unwrap(scope.lookup(name), compiler, node); |
3274 } | 3272 } |
OLD | NEW |