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 closureToClassMapper; | 5 library closureToClassMapper; |
| 6 | 6 |
| 7 import "elements/elements.dart"; | 7 import "elements/elements.dart"; |
| 8 import "dart2jslib.dart"; | 8 import "dart2jslib.dart"; |
| 9 import "dart_types.dart"; | 9 import "dart_types.dart"; |
| 10 import "js_backend/js_backend.dart" show JavaScriptBackend; | 10 import "js_backend/js_backend.dart" show JavaScriptBackend; |
| (...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 993 visitInvokable(element, node, () { | 993 visitInvokable(element, node, () { |
| 994 // TODO(ahe): This is problematic. The backend should not repeat | 994 // TODO(ahe): This is problematic. The backend should not repeat |
| 995 // the work of the resolver. It is the resolver's job to create | 995 // the work of the resolver. It is the resolver's job to create |
| 996 // parameters, etc. Other phases should only visit statements. | 996 // parameters, etc. Other phases should only visit statements. |
| 997 if (node.parameters != null) node.parameters.accept(this); | 997 if (node.parameters != null) node.parameters.accept(this); |
| 998 if (node.initializers != null) node.initializers.accept(this); | 998 if (node.initializers != null) node.initializers.accept(this); |
| 999 if (node.body != null) node.body.accept(this); | 999 if (node.body != null) node.body.accept(this); |
| 1000 }); | 1000 }); |
| 1001 } | 1001 } |
| 1002 | 1002 |
| 1003 visitFunctionDeclaration(FunctionDeclaration node) { | |
|
floitsch
2014/07/25 12:30:08
We need to declare the local in the current scope
Johnni Winther
2014/08/04 06:59:09
Reinserting though we don't need it. Fixing this i
| |
| 1004 node.visitChildren(this); | |
| 1005 LocalFunctionElement localFunction = elements[node]; | |
| 1006 declareLocal(localFunction); | |
| 1007 } | |
| 1008 | |
| 1009 visitTryStatement(TryStatement node) { | 1003 visitTryStatement(TryStatement node) { |
| 1010 // TODO(ngeoffray): implement finer grain state. | 1004 // TODO(ngeoffray): implement finer grain state. |
| 1011 bool oldInTryStatement = inTryStatement; | 1005 bool oldInTryStatement = inTryStatement; |
| 1012 inTryStatement = true; | 1006 inTryStatement = true; |
| 1013 node.visitChildren(this); | 1007 node.visitChildren(this); |
| 1014 inTryStatement = oldInTryStatement; | 1008 inTryStatement = oldInTryStatement; |
| 1015 } | 1009 } |
| 1016 } | 1010 } |
| 1017 | 1011 |
| 1018 /// A type variable as a local variable. | 1012 /// A type variable as a local variable. |
| 1019 class TypeVariableLocal implements Local { | 1013 class TypeVariableLocal implements Local { |
| 1020 final TypeVariableType typeVariable; | 1014 final TypeVariableType typeVariable; |
| 1021 final ExecutableElement executableContext; | 1015 final ExecutableElement executableContext; |
| 1022 | 1016 |
| 1023 TypeVariableLocal(this.typeVariable, this.executableContext); | 1017 TypeVariableLocal(this.typeVariable, this.executableContext); |
| 1024 | 1018 |
| 1025 String get name => typeVariable.name; | 1019 String get name => typeVariable.name; |
| 1026 | 1020 |
| 1027 int get hashCode => typeVariable.hashCode; | 1021 int get hashCode => typeVariable.hashCode; |
| 1028 | 1022 |
| 1029 bool operator ==(other) { | 1023 bool operator ==(other) { |
| 1030 if (other is! TypeVariableLocal) return false; | 1024 if (other is! TypeVariableLocal) return false; |
| 1031 return typeVariable == other.typeVariable; | 1025 return typeVariable == other.typeVariable; |
| 1032 } | 1026 } |
| 1033 } | 1027 } |
| OLD | NEW |