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

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

Issue 2554523002: Mark test pass on Chrome 55 (Closed)
Patch Set: Created 4 years 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 | pkg/dev_compiler/test/browser/language_tests.js » ('j') | 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 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after
1308 // Therefore, dart:core Object gets the one real `constructor` and 1308 // Therefore, dart:core Object gets the one real `constructor` and
1309 // immediately bounces to the `new() { ... }` initializer, letting us 1309 // immediately bounces to the `new() { ... }` initializer, letting us
1310 // bypass the ES6 restrictions. 1310 // bypass the ES6 restrictions.
1311 // 1311 //
1312 // TODO(jmesserly): we'll need to rethink this. 1312 // TODO(jmesserly): we'll need to rethink this.
1313 // See <https://github.com/dart-lang/dev_compiler/issues/51>. 1313 // See <https://github.com/dart-lang/dev_compiler/issues/51>.
1314 // This level of indirection will hurt performance. 1314 // This level of indirection will hurt performance.
1315 jsMethods.add(new JS.Method( 1315 jsMethods.add(new JS.Method(
1316 _propertyName('constructor'), 1316 _propertyName('constructor'),
1317 js.call('function(...args) { return this.new.apply(this, args); }') 1317 js.call('function(...args) { return this.new.apply(this, args); }')
1318 as JS.Fun)); 1318 as JS.Fun));
1319 } else if (ctors.isEmpty) { 1319 } else if (ctors.isEmpty) {
1320 jsMethods.add(_emitImplicitConstructor(node, fields, virtualFields)); 1320 jsMethods.add(_emitImplicitConstructor(node, fields, virtualFields));
1321 } 1321 }
1322 1322
1323 bool hasJsPeer = findAnnotation(element, isJsPeerInterface) != null; 1323 bool hasJsPeer = findAnnotation(element, isJsPeerInterface) != null;
1324 1324
1325 bool hasIterator = false; 1325 bool hasIterator = false;
1326 for (var m in node.members) { 1326 for (var m in node.members) {
1327 if (m is ConstructorDeclaration) { 1327 if (m is ConstructorDeclaration) {
1328 jsMethods 1328 jsMethods
(...skipping 2636 matching lines...) Expand 10 before | Expand all | Expand 10 after
3965 Element target, List<VariableDeclaration> fields) { 3965 Element target, List<VariableDeclaration> fields) {
3966 var methods = []; 3966 var methods = [];
3967 for (var node in fields) { 3967 for (var node in fields) {
3968 var name = node.name.name; 3968 var name = node.name.name;
3969 var element = node.element; 3969 var element = node.element;
3970 var access = _emitMemberName(name, isStatic: true); 3970 var access = _emitMemberName(name, isStatic: true);
3971 methods.add(annotate( 3971 methods.add(annotate(
3972 new JS.Method( 3972 new JS.Method(
3973 access, 3973 access,
3974 js.call('function() { return #; }', _visitInitializer(node)) 3974 js.call('function() { return #; }', _visitInitializer(node))
3975 as JS.Fun, 3975 as JS.Fun,
3976 isGetter: true), 3976 isGetter: true),
3977 node, 3977 node,
3978 _findAccessor(element, getter: true))); 3978 _findAccessor(element, getter: true)));
3979 3979
3980 // TODO(jmesserly): currently uses a dummy setter to indicate writable. 3980 // TODO(jmesserly): currently uses a dummy setter to indicate writable.
3981 if (!node.isFinal && !node.isConst) { 3981 if (!node.isFinal && !node.isConst) {
3982 methods.add(annotate( 3982 methods.add(annotate(
3983 new JS.Method(access, js.call('function(_) {}') as JS.Fun, 3983 new JS.Method(access, js.call('function(_) {}') as JS.Fun,
3984 isSetter: true), 3984 isSetter: true),
3985 node, 3985 node,
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
4525 _bindValue(scope, 'o', _getTarget(prop), context: context), 4525 _bindValue(scope, 'o', _getTarget(prop), context: context),
4526 prop.operator, 4526 prop.operator,
4527 prop.propertyName); 4527 prop.propertyName);
4528 } else if (expr is PrefixedIdentifier) { 4528 } else if (expr is PrefixedIdentifier) {
4529 PrefixedIdentifier ident = expr; 4529 PrefixedIdentifier ident = expr;
4530 if (isLibraryPrefix(ident.prefix)) { 4530 if (isLibraryPrefix(ident.prefix)) {
4531 return expr; 4531 return expr;
4532 } 4532 }
4533 result = astFactory.prefixedIdentifier( 4533 result = astFactory.prefixedIdentifier(
4534 _bindValue(scope, 'o', ident.prefix, context: context) 4534 _bindValue(scope, 'o', ident.prefix, context: context)
4535 as SimpleIdentifier, 4535 as SimpleIdentifier,
4536 ident.period, 4536 ident.period,
4537 ident.identifier); 4537 ident.identifier);
4538 } else { 4538 } else {
4539 return expr as SimpleIdentifier; 4539 return expr as SimpleIdentifier;
4540 } 4540 }
4541 result.staticType = expr.staticType; 4541 result.staticType = expr.staticType;
4542 setIsDynamicInvoke(result, isDynamicInvoke(expr)); 4542 setIsDynamicInvoke(result, isDynamicInvoke(expr));
4543 return result; 4543 return result;
4544 } 4544 }
4545 4545
(...skipping 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after
5770 var targetIdentifier = target as SimpleIdentifier; 5770 var targetIdentifier = target as SimpleIdentifier;
5771 5771
5772 if (targetIdentifier.staticElement is! PrefixElement) return false; 5772 if (targetIdentifier.staticElement is! PrefixElement) return false;
5773 var prefix = targetIdentifier.staticElement as PrefixElement; 5773 var prefix = targetIdentifier.staticElement as PrefixElement;
5774 5774
5775 // The library the prefix is referring to must come from a deferred import. 5775 // The library the prefix is referring to must come from a deferred import.
5776 var containingLibrary = (target.root as CompilationUnit).element.library; 5776 var containingLibrary = (target.root as CompilationUnit).element.library;
5777 var imports = containingLibrary.getImportsWithPrefix(prefix); 5777 var imports = containingLibrary.getImportsWithPrefix(prefix);
5778 return imports.length == 1 && imports[0].isDeferred; 5778 return imports.length == 1 && imports[0].isDeferred;
5779 } 5779 }
OLDNEW
« no previous file with comments | « no previous file | pkg/dev_compiler/test/browser/language_tests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698