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

Side by Side Diff: lib/src/codegen/js_codegen.dart

Issue 1055923002: Don't call dinvoke on Object methods (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Fix for sealed types Created 5 years, 8 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
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 // 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 dev_compiler.src.codegen.js_codegen; 5 library dev_compiler.src.codegen.js_codegen;
6 6
7 import 'dart:collection' show HashSet, HashMap; 7 import 'dart:collection' show HashSet, HashMap;
8 import 'dart:io' show Directory, File; 8 import 'dart:io' show Directory, File;
9 9
10 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; 10 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator;
(...skipping 1848 matching lines...) Expand 10 before | Expand all | Expand 10 after
1859 return _emitGet(node.prefix, node.identifier); 1859 return _emitGet(node.prefix, node.identifier);
1860 } 1860 }
1861 } 1861 }
1862 1862
1863 @override 1863 @override
1864 visitPropertyAccess(PropertyAccess node) => 1864 visitPropertyAccess(PropertyAccess node) =>
1865 _emitGet(_getTarget(node), node.propertyName); 1865 _emitGet(_getTarget(node), node.propertyName);
1866 1866
1867 /// Shared code for [PrefixedIdentifier] and [PropertyAccess]. 1867 /// Shared code for [PrefixedIdentifier] and [PropertyAccess].
1868 _emitGet(Expression target, SimpleIdentifier name) { 1868 _emitGet(Expression target, SimpleIdentifier name) {
1869 if (rules.isDynamicTarget(target)) { 1869 if (rules.isDynamicGet(target, name)) {
Jennifer Messerly 2015/04/07 19:05:49 ideally we'd only need to check one of these. Or a
vsm 2015/04/07 19:48:46 This particular one doesn't bother me. A get is a
Jennifer Messerly 2015/04/07 21:49:23 yeah, that's a good point. I just would expect tha
vsm 2015/04/07 22:40:41 I went ahead and did this and did some correspondi
1870 return js.call( 1870 return js.call(
1871 'dart.dload(#, #)', [_visit(target), js.string(name.name, "'")]); 1871 'dart.dload(#, #)', [_visit(target), js.string(name.name, "'")]);
1872 } else { 1872 } else {
1873 var e = name.staticElement; 1873 var e = name.staticElement;
1874 var ret = js.call('#.#', [ 1874 var ret = js.call('#.#', [
1875 _visit(target), 1875 _visit(target),
1876 _emitMemberName(name.name, 1876 _emitMemberName(name.name,
1877 isStatic: e is ExecutableElement && e.isStatic, target: target) 1877 isStatic: e is ExecutableElement && e.isStatic, target: target)
1878 ]); 1878 ]);
1879 return ret; 1879 return ret;
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
2505 2505
2506 // TODO(jmesserly): in many cases marking the end will be unncessary. 2506 // TODO(jmesserly): in many cases marking the end will be unncessary.
2507 printer.mark(_location(node.end)); 2507 printer.mark(_location(node.end));
2508 } 2508 }
2509 2509
2510 String _getIdentifier(AstNode node) { 2510 String _getIdentifier(AstNode node) {
2511 if (node is SimpleIdentifier) return node.name; 2511 if (node is SimpleIdentifier) return node.name;
2512 return null; 2512 return null;
2513 } 2513 }
2514 } 2514 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698