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

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

Issue 2949123002: Fix mocked operator methods (Closed)
Patch Set: Created 3 years, 6 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 | tests/lib_strong/html/html_mock_test.dart » ('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 1512 matching lines...) Expand 10 before | Expand all | Expand 10 after
1523 addProperty('isSetter', js.boolean(true)); 1523 addProperty('isSetter', js.boolean(true));
1524 1524
1525 fnArgs.add(args); 1525 fnArgs.add(args);
1526 positionalArgs = new JS.ArrayInitializer([args]); 1526 positionalArgs = new JS.ArrayInitializer([args]);
1527 } 1527 }
1528 } 1528 }
1529 1529
1530 var fnBody = 1530 var fnBody =
1531 js.call('this.noSuchMethod(new #.InvocationImpl.new(#, #, #))', [ 1531 js.call('this.noSuchMethod(new #.InvocationImpl.new(#, #, #))', [
1532 _runtimeModule, 1532 _runtimeModule,
1533 _declareMemberName(method, useDisplayName: true), 1533 _declareMemberName(method, useDisplayName: false),
Jennifer Messerly 2017/06/22 20:26:31 fyi ... useDisplayName defaults to false and does
1534 positionalArgs, 1534 positionalArgs,
1535 new JS.ObjectInitializer(invocationProps) 1535 new JS.ObjectInitializer(invocationProps)
1536 ]); 1536 ]);
1537 1537
1538 if (!method.returnType.isDynamic) { 1538 if (!method.returnType.isDynamic) {
1539 fnBody = js.call('#._check(#)', [_emitType(method.returnType), fnBody]); 1539 fnBody = js.call('#._check(#)', [_emitType(method.returnType), fnBody]);
1540 } 1540 }
1541 1541
1542 var fn = _makeGenericFunction(new JS.Fun( 1542 var fn = _makeGenericFunction(new JS.Fun(
1543 fnArgs, js.statement('{ return #; }', [fnBody]), 1543 fnArgs, js.statement('{ return #; }', [fnBody]),
(...skipping 4292 matching lines...) Expand 10 before | Expand all | Expand 10 after
5836 if (targetIdentifier.staticElement is! PrefixElement) return false; 5836 if (targetIdentifier.staticElement is! PrefixElement) return false;
5837 var prefix = targetIdentifier.staticElement as PrefixElement; 5837 var prefix = targetIdentifier.staticElement as PrefixElement;
5838 5838
5839 // The library the prefix is referring to must come from a deferred import. 5839 // The library the prefix is referring to must come from a deferred import.
5840 var containingLibrary = resolutionMap 5840 var containingLibrary = resolutionMap
5841 .elementDeclaredByCompilationUnit(target.root as CompilationUnit) 5841 .elementDeclaredByCompilationUnit(target.root as CompilationUnit)
5842 .library; 5842 .library;
5843 var imports = containingLibrary.getImportsWithPrefix(prefix); 5843 var imports = containingLibrary.getImportsWithPrefix(prefix);
5844 return imports.length == 1 && imports[0].isDeferred; 5844 return imports.length == 1 && imports[0].isDeferred;
5845 } 5845 }
OLDNEW
« no previous file with comments | « no previous file | tests/lib_strong/html/html_mock_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698