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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_ir_builder_visitor.dart

Issue 909483003: cps2js: Bugfix in named parameters in call to superconstructor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Test case Created 5 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 part of dart2js.ir_builder; 5 part of dart2js.ir_builder;
6 6
7 /** 7 /**
8 * This task iterates through all resolved elements and builds [ir.Node]s. The 8 * This task iterates through all resolved elements and builds [ir.Node]s. The
9 * nodes are stored in the [nodes] map and accessible through [hasIr] and 9 * nodes are stored in the [nodes] map and accessible through [hasIr] and
10 * [getIr]. 10 * [getIr].
(...skipping 1390 matching lines...) Expand 10 before | Expand all | Expand 10 after
1401 signature.forEachRequiredParameter((ParameterElement param) { 1401 signature.forEachRequiredParameter((ParameterElement param) {
1402 irBuilder.declareLocalVariable(param, initialValue: arguments[index]); 1402 irBuilder.declareLocalVariable(param, initialValue: arguments[index]);
1403 index++; 1403 index++;
1404 }); 1404 });
1405 1405
1406 // Load optional parameters, evaluating default values for omitted ones. 1406 // Load optional parameters, evaluating default values for omitted ones.
1407 signature.forEachOptionalParameter((ParameterElement param) { 1407 signature.forEachOptionalParameter((ParameterElement param) {
1408 ir.Primitive value; 1408 ir.Primitive value;
1409 // Load argument if provided. 1409 // Load argument if provided.
1410 if (signature.optionalParametersAreNamed) { 1410 if (signature.optionalParametersAreNamed) {
1411 int translatedIndex = selector.namedArguments.indexOf(param.name); 1411 int nameIndex = selector.namedArguments.indexOf(param.name);
1412 if (translatedIndex != -1) { 1412 if (nameIndex != -1) {
1413 int translatedIndex = selector.positionalArgumentCount + nameIndex;
1413 value = arguments[translatedIndex]; 1414 value = arguments[translatedIndex];
1414 } 1415 }
1415 } else if (index < arguments.length) { 1416 } else if (index < arguments.length) {
1416 value = arguments[index]; 1417 value = arguments[index];
1417 } 1418 }
1418 // Load default if argument was not provided. 1419 // Load default if argument was not provided.
1419 if (value == null) { 1420 if (value == null) {
1420 if (param.initializer != null) { 1421 if (param.initializer != null) {
1421 value = visit(param.initializer); 1422 value = inlineExpression(target, param.initializer);
1422 } else { 1423 } else {
1423 value = irBuilder.buildNullLiteral(); 1424 value = irBuilder.buildNullLiteral();
1424 } 1425 }
1425 } 1426 }
1426 irBuilder.declareLocalVariable(param, initialValue: value); 1427 irBuilder.declareLocalVariable(param, initialValue: value);
1427 index++; 1428 index++;
1428 }); 1429 });
1429 } 1430 }
1430 1431
1431 /** 1432 /**
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1540 element, 1541 element,
1541 node, 1542 node,
1542 elements); 1543 elements);
1543 IrBuilder builder = 1544 IrBuilder builder =
1544 new JsIrBuilder(compiler.backend.constantSystem, element); 1545 new JsIrBuilder(compiler.backend.constantSystem, element);
1545 return withBuilder(builder, () => _makeFunctionBody(element, node)); 1546 return withBuilder(builder, () => _makeFunctionBody(element, node));
1546 } 1547 }
1547 1548
1548 } 1549 }
1549 1550
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698