OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 dart2js.ir_builder_task; | 5 library dart2js.ir_builder_task; |
6 | 6 |
7 import 'package:js_runtime/shared/embedded_names.dart' | 7 import 'package:js_runtime/shared/embedded_names.dart' |
8 show JsBuiltin, JsGetName; | 8 show JsBuiltin, JsGetName; |
9 | 9 |
10 import '../closure.dart' as closure; | 10 import '../closure.dart' as closure; |
(...skipping 3841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3852 handleSend(node); | 3852 handleSend(node); |
3853 node.visitChildren(this); | 3853 node.visitChildren(this); |
3854 } | 3854 } |
3855 | 3855 |
3856 visitSendSet(ast.SendSet node) { | 3856 visitSendSet(ast.SendSet node) { |
3857 handleSend(node); | 3857 handleSend(node); |
3858 Element element = elements[node]; | 3858 Element element = elements[node]; |
3859 if (Elements.isLocal(element)) { | 3859 if (Elements.isLocal(element)) { |
3860 LocalElement local = element; | 3860 LocalElement local = element; |
3861 if (insideInitializer && | 3861 if (insideInitializer && |
3862 (local.isParameter || local.isInitializingFormal) && | 3862 local.isParameter && |
3863 local.enclosingElement == currentFunction) { | 3863 local.enclosingElement == currentFunction) { |
3864 assert(local.enclosingElement.isConstructor); | 3864 assert(local.enclosingElement.isConstructor); |
3865 // Initializers in an initializer-list can communicate via parameters. | 3865 // Initializers in an initializer-list can communicate via parameters. |
3866 // If a parameter is stored in an initializer list we box it. | 3866 // If a parameter is stored in an initializer list we box it. |
3867 // TODO(sigurdm): Fix this. | 3867 // TODO(sigurdm): Fix this. |
3868 // Though these variables do not outlive the activation of the | 3868 // Though these variables do not outlive the activation of the |
3869 // function, they still need to be boxed. As a simplification, we | 3869 // function, they still need to be boxed. As a simplification, we |
3870 // treat them as if they are captured by a closure (i.e., they do | 3870 // treat them as if they are captured by a closure (i.e., they do |
3871 // outlive the activation of the function). | 3871 // outlive the activation of the function). |
3872 markAsCaptured(local); | 3872 markAsCaptured(local); |
3873 } else if (inTryStatement) { | 3873 } else if (inTryStatement) { |
3874 assert(local.isParameter || | 3874 assert(local.isParameter || local.isVariable); |
3875 local.isVariable || | |
3876 local.isInitializingFormal); | |
3877 // Search for the position of the try block containing the variable | 3875 // Search for the position of the try block containing the variable |
3878 // declaration, or -1 if it is declared outside the outermost try. | 3876 // declaration, or -1 if it is declared outside the outermost try. |
3879 int i = tryNestingStack.length - 1; | 3877 int i = tryNestingStack.length - 1; |
3880 while (i >= 0 && !tryNestingStack[i].declared.contains(local)) { | 3878 while (i >= 0 && !tryNestingStack[i].declared.contains(local)) { |
3881 --i; | 3879 --i; |
3882 } | 3880 } |
3883 // If there is a next inner try, then the variable should be boxed on | 3881 // If there is a next inner try, then the variable should be boxed on |
3884 // entry to it. | 3882 // entry to it. |
3885 if (i + 1 < tryNestingStack.length) { | 3883 if (i + 1 < tryNestingStack.length) { |
3886 tryNestingStack[i + 1].boxedOnEntry.add(local); | 3884 tryNestingStack[i + 1].boxedOnEntry.add(local); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4024 _backend.jsInteropAnalysis.hasAnonymousAnnotation(element.contextClass); | 4022 _backend.jsInteropAnalysis.hasAnonymousAnnotation(element.contextClass); |
4025 | 4023 |
4026 String getJsInteropTargetPath(FunctionElement element) { | 4024 String getJsInteropTargetPath(FunctionElement element) { |
4027 return '${_backend.namer.fixedBackendPath(element)}.' | 4025 return '${_backend.namer.fixedBackendPath(element)}.' |
4028 '${_backend.nativeData.getFixedBackendName(element)}'; | 4026 '${_backend.nativeData.getFixedBackendName(element)}'; |
4029 } | 4027 } |
4030 | 4028 |
4031 DartType get jsJavascriptObjectType => | 4029 DartType get jsJavascriptObjectType => |
4032 _backend.helpers.jsJavaScriptObjectClass.thisType; | 4030 _backend.helpers.jsJavaScriptObjectClass.thisType; |
4033 } | 4031 } |
OLD | NEW |