Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(541)

Unified Diff: lib/compiler/implementation/elements/elements.dart

Issue 10170025: Use the correct current element when computing the type of function elements. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/elements/elements.dart
diff --git a/lib/compiler/implementation/elements/elements.dart b/lib/compiler/implementation/elements/elements.dart
index 498bad83e06c16d1248ffdd84ac9eacf253d3d01..91106d17eaf7fb39e192d2b2164ecc37173376fd 100644
--- a/lib/compiler/implementation/elements/elements.dart
+++ b/lib/compiler/implementation/elements/elements.dart
@@ -619,21 +619,23 @@ class FunctionElement extends Element {
FunctionType computeType(Compiler compiler) {
if (type != null) return type;
- FunctionParameters parameters = computeParameters(compiler);
- Types types = compiler.types;
- FunctionExpression node =
- compiler.parser.measure(() => parseNode(compiler));
- Type returnType = getType(node.returnType, compiler, getLibrary());
- if (returnType === null) returnType = types.dynamicType;
-
- LinkBuilder<Type> parameterTypes = new LinkBuilder<Type>();
- for (Link<Element> link = parameters.requiredParameters;
- !link.isEmpty();
- link = link.tail) {
- parameterTypes.addLast(link.head.computeType(compiler));
- }
- type = new FunctionType(returnType, parameterTypes.toLink(), this);
- return type;
+ return compiler.withCurrentElement(this, () {
kasperl 2012/04/23 11:45:45 Would it be possible to add a regression test case
+ FunctionParameters parameters = computeParameters(compiler);
+ Types types = compiler.types;
+ FunctionExpression node =
+ compiler.parser.measure(() => parseNode(compiler));
+ Type returnType = getType(node.returnType, compiler, getLibrary());
+ if (returnType === null) returnType = types.dynamicType;
+
+ LinkBuilder<Type> parameterTypes = new LinkBuilder<Type>();
+ for (Link<Element> link = parameters.requiredParameters;
+ !link.isEmpty();
+ link = link.tail) {
+ parameterTypes.addLast(link.head.computeType(compiler));
+ }
+ type = new FunctionType(returnType, parameterTypes.toLink(), this);
+ return type;
+ });
}
Node parseNode(DiagnosticListener listener) => cachedNode;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698