| 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 import 'dart:collection'; | 5 import 'dart:collection'; |
| 6 | 6 |
| 7 import 'package:js_runtime/shared/embedded_names.dart'; | 7 import 'package:js_runtime/shared/embedded_names.dart'; |
| 8 | 8 |
| 9 import '../closure.dart'; | 9 import '../closure.dart'; |
| 10 import '../common.dart'; | 10 import '../common.dart'; |
| (...skipping 5601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5612 .hasAnonymousAnnotation(element.contextClass)) { | 5612 .hasAnonymousAnnotation(element.contextClass)) { |
| 5613 // Factory constructor that is syntactic sugar for creating a JavaScript | 5613 // Factory constructor that is syntactic sugar for creating a JavaScript |
| 5614 // object literal. | 5614 // object literal. |
| 5615 ConstructorElement constructor = element; | 5615 ConstructorElement constructor = element; |
| 5616 FunctionSignature params = constructor.functionSignature; | 5616 FunctionSignature params = constructor.functionSignature; |
| 5617 int i = 0; | 5617 int i = 0; |
| 5618 int positions = 0; | 5618 int positions = 0; |
| 5619 var filteredArguments = <HInstruction>[]; | 5619 var filteredArguments = <HInstruction>[]; |
| 5620 var parameterNameMap = new Map<String, js.Expression>(); | 5620 var parameterNameMap = new Map<String, js.Expression>(); |
| 5621 params.orderedForEachParameter((ParameterElement parameter) { | 5621 params.orderedForEachParameter((ParameterElement parameter) { |
| 5622 // TODO(jacobr): throw if parameter names do not match names of property | 5622 // TODO(jacobr): consider throwing if parameter names do not match |
| 5623 // names in the class. | 5623 // names of properties in the class. |
| 5624 assert(parameter.isNamed); | 5624 assert(parameter.isNamed); |
| 5625 HInstruction argument = arguments[i]; | 5625 HInstruction argument = arguments[i]; |
| 5626 if (argument != null) { | 5626 if (argument != null) { |
| 5627 filteredArguments.add(argument); | 5627 filteredArguments.add(argument); |
| 5628 parameterNameMap[parameter.name] = | 5628 var jsName = |
| 5629 new js.InterpolatedExpression(positions++); | 5629 backend.nativeData.getUnescapedJSInteropName(parameter.name); |
| 5630 parameterNameMap[jsName] = new js.InterpolatedExpression(positions++); |
| 5630 } | 5631 } |
| 5631 i++; | 5632 i++; |
| 5632 }); | 5633 }); |
| 5633 var codeTemplate = | 5634 var codeTemplate = |
| 5634 new js.Template(null, js.objectLiteral(parameterNameMap)); | 5635 new js.Template(null, js.objectLiteral(parameterNameMap)); |
| 5635 | 5636 |
| 5636 var nativeBehavior = new native.NativeBehavior() | 5637 var nativeBehavior = new native.NativeBehavior() |
| 5637 ..codeTemplate = codeTemplate; | 5638 ..codeTemplate = codeTemplate; |
| 5638 if (compiler.options.trustJSInteropTypeAnnotations) { | 5639 if (compiler.options.trustJSInteropTypeAnnotations) { |
| 5639 nativeBehavior.typesReturned.add(constructor.enclosingClass.thisType); | 5640 nativeBehavior.typesReturned.add(constructor.enclosingClass.thisType); |
| (...skipping 2990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8630 const _LoopTypeVisitor(); | 8631 const _LoopTypeVisitor(); |
| 8631 int visitNode(ast.Node node) => HLoopBlockInformation.NOT_A_LOOP; | 8632 int visitNode(ast.Node node) => HLoopBlockInformation.NOT_A_LOOP; |
| 8632 int visitWhile(ast.While node) => HLoopBlockInformation.WHILE_LOOP; | 8633 int visitWhile(ast.While node) => HLoopBlockInformation.WHILE_LOOP; |
| 8633 int visitFor(ast.For node) => HLoopBlockInformation.FOR_LOOP; | 8634 int visitFor(ast.For node) => HLoopBlockInformation.FOR_LOOP; |
| 8634 int visitDoWhile(ast.DoWhile node) => HLoopBlockInformation.DO_WHILE_LOOP; | 8635 int visitDoWhile(ast.DoWhile node) => HLoopBlockInformation.DO_WHILE_LOOP; |
| 8635 int visitAsyncForIn(ast.AsyncForIn node) => HLoopBlockInformation.FOR_IN_LOOP; | 8636 int visitAsyncForIn(ast.AsyncForIn node) => HLoopBlockInformation.FOR_IN_LOOP; |
| 8636 int visitSyncForIn(ast.SyncForIn node) => HLoopBlockInformation.FOR_IN_LOOP; | 8637 int visitSyncForIn(ast.SyncForIn node) => HLoopBlockInformation.FOR_IN_LOOP; |
| 8637 int visitSwitchStatement(ast.SwitchStatement node) => | 8638 int visitSwitchStatement(ast.SwitchStatement node) => |
| 8638 HLoopBlockInformation.SWITCH_CONTINUE_LOOP; | 8639 HLoopBlockInformation.SWITCH_CONTINUE_LOOP; |
| 8639 } | 8640 } |
| OLD | NEW |