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

Side by Side Diff: pkg/dev_compiler/lib/src/compiler/code_generator.dart

Issue 2435163002: fix #27631, get/set methods no longer shadow index operator (Closed)
Patch Set: add TODO Created 4 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 2
3 // for details. All rights reserved. Use of this source code is governed by a 3 // for details. All rights reserved. Use of this source code is governed by a
4 // BSD-style license that can be found in the LICENSE file. 4 // BSD-style license that can be found in the LICENSE file.
5 5
6 import 'dart:collection' show HashMap, HashSet; 6 import 'dart:collection' show HashMap, HashSet;
7 import 'dart:math' show min, max; 7 import 'dart:math' show min, max;
8 8
9 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; 9 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator;
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after
1481 List<JS.Method> _emitVirtualFieldAccessor(VariableDeclaration field, 1481 List<JS.Method> _emitVirtualFieldAccessor(VariableDeclaration field,
1482 Map<FieldElement, JS.TemporaryId> virtualFields) { 1482 Map<FieldElement, JS.TemporaryId> virtualFields) {
1483 var virtualField = virtualFields[field.element]; 1483 var virtualField = virtualFields[field.element];
1484 var result = <JS.Method>[]; 1484 var result = <JS.Method>[];
1485 var name = _emitMemberName(field.element.name, 1485 var name = _emitMemberName(field.element.name,
1486 type: (field.element.enclosingElement as ClassElement).type); 1486 type: (field.element.enclosingElement as ClassElement).type);
1487 var getter = js.call('function() { return this[#]; }', [virtualField]); 1487 var getter = js.call('function() { return this[#]; }', [virtualField]);
1488 result.add(new JS.Method(name, getter, isGetter: true)); 1488 result.add(new JS.Method(name, getter, isGetter: true));
1489 1489
1490 if (field.isFinal) { 1490 if (field.isFinal) {
1491 // TODO(jmesserly): vsm@ commented that this seems unnecessary if we
1492 // don't have a super setter. I'm not sure either why this code was
1493 // introduced.
1491 var setter = js.call('function(value) { super[#] = value; }', [name]); 1494 var setter = js.call('function(value) { super[#] = value; }', [name]);
1492 result.add(new JS.Method(name, setter, isSetter: true)); 1495 result.add(new JS.Method(name, setter, isSetter: true));
1493 } else { 1496 } else {
1494 var setter = 1497 var setter =
1495 js.call('function(value) { this[#] = value; }', [virtualField]); 1498 js.call('function(value) { this[#] = value; }', [virtualField]);
1496 result.add(new JS.Method(name, setter, isSetter: true)); 1499 result.add(new JS.Method(name, setter, isSetter: true));
1497 } 1500 }
1498 1501
1499 return result; 1502 return result;
1500 } 1503 }
(...skipping 4022 matching lines...) Expand 10 before | Expand all | Expand 10 after
5523 } 5526 }
5524 5527
5525 bool isLibraryPrefix(Expression node) => 5528 bool isLibraryPrefix(Expression node) =>
5526 node is SimpleIdentifier && node.staticElement is PrefixElement; 5529 node is SimpleIdentifier && node.staticElement is PrefixElement;
5527 5530
5528 LibraryElement _getLibrary(AnalysisContext c, String uri) => 5531 LibraryElement _getLibrary(AnalysisContext c, String uri) =>
5529 c.computeLibraryElement(c.sourceFactory.forUri(uri)); 5532 c.computeLibraryElement(c.sourceFactory.forUri(uri));
5530 5533
5531 bool _isDartRuntime(LibraryElement l) => 5534 bool _isDartRuntime(LibraryElement l) =>
5532 l.isInSdk && l.source.uri.toString() == 'dart:_runtime'; 5535 l.isInSdk && l.source.uri.toString() == 'dart:_runtime';
OLDNEW
« 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