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

Side by Side Diff: lib/kernel_visitor.dart

Issue 2061393004: Implement more super calls. (Closed) Base URL: git@github.com:dart-lang/rasta.git@exports
Patch Set: Renamed file to avoid getting picked up by analyzer. Created 4 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 | test/kernel/regression/super_operator.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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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.md file. 3 // BSD-style license that can be found in the LICENSE.md file.
4 4
5 library rasta.kernel_visitor; 5 library rasta.kernel_visitor;
6 6
7 import 'package:kernel/ast.dart' as ir; 7 import 'package:kernel/ast.dart' as ir;
8 8
9 import 'package:kernel/accessors.dart' show 9 import 'package:kernel/accessors.dart' show
10 Accessor, 10 Accessor,
(...skipping 2326 matching lines...) Expand 10 before | Expand all | Expand 10 after
2337 2337
2338 @override 2338 @override
2339 ir.Expression visitStringFromEnvironmentConstructorInvoke( 2339 ir.Expression visitStringFromEnvironmentConstructorInvoke(
2340 NewExpression node, 2340 NewExpression node,
2341 StringFromEnvironmentConstantExpression constant, 2341 StringFromEnvironmentConstantExpression constant,
2342 _) { 2342 _) {
2343 return buildConstConstructorInvoke(node); 2343 return buildConstConstructorInvoke(node);
2344 } 2344 }
2345 2345
2346 @override 2346 @override
2347 ir.Throw visitSuperBinary( 2347 ir.SuperMethodInvocation visitSuperBinary(
2348 Send node, 2348 Send node,
2349 FunctionElement function, 2349 FunctionElement function,
2350 BinaryOperator operator, 2350 BinaryOperator operator,
2351 Node argument, 2351 Node argument,
2352 _) { 2352 _) {
2353 return buildUnsupported(node, "SuperBinary"); 2353 return new ir.SuperMethodInvocation(
2354 kernel.functionToIr(function),
2355 new ir.Arguments(<ir.Expression>[argument.accept(this)]));
2354 } 2356 }
2355 2357
2356 @override 2358 @override
2357 ir.Throw visitSuperCompoundIndexSet( 2359 ir.Expression visitSuperCompoundIndexSet(
2358 SendSet node, 2360 SendSet node,
2359 MethodElement getter, 2361 MethodElement getter,
2360 MethodElement setter, 2362 MethodElement setter,
2361 Node index, 2363 Node index,
2362 AssignmentOperator operator, 2364 AssignmentOperator operator,
2363 Node rhs, 2365 Node rhs,
2364 _) { 2366 _) {
2365 return buildUnsupported(node, "SuperCompoundIndexSet"); 2367 return
2368 buildSuperIndexAccessor(index, getter, setter).buildCompoundAssignment(
2369 kernel.irName(operator.selectorName, currentElement),
2370 rhs.accept(this));
2366 } 2371 }
2367 2372
2368 @override 2373 @override
2369 ir.Initializer visitSuperConstructorInvoke( 2374 ir.Initializer visitSuperConstructorInvoke(
2370 Send node, 2375 Send node,
2371 ConstructorElement superConstructor, 2376 ConstructorElement superConstructor,
2372 InterfaceType type, 2377 InterfaceType type,
2373 NodeList arguments, 2378 NodeList arguments,
2374 CallStructure callStructure, 2379 CallStructure callStructure,
2375 _) { 2380 _) {
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
2503 !getter.isConst) { 2508 !getter.isConst) {
2504 setter = getter; 2509 setter = getter;
2505 } 2510 }
2506 return new SuperPropertyAccessor( 2511 return new SuperPropertyAccessor(
2507 (getter == null) ? null : kernel.elementToIr(getter), 2512 (getter == null) ? null : kernel.elementToIr(getter),
2508 (setter == null) ? null : kernel.elementToIr(setter)); 2513 (setter == null) ? null : kernel.elementToIr(setter));
2509 } 2514 }
2510 2515
2511 Accessor buildSuperIndexAccessor( 2516 Accessor buildSuperIndexAccessor(
2512 Expression index, 2517 Expression index,
2513 Element read, 2518 Element getter,
2514 [Element write]) { 2519 [Element setter]) {
2520 if (setter == null && getter.isField && !getter.isFinal &&
2521 !getter.isConst) {
2522 setter = getter;
2523 }
2515 return new SuperIndexAccessor( 2524 return new SuperIndexAccessor(
2516 index.accept(this), 2525 index.accept(this),
2517 kernel.elementToIr(read), 2526 (getter == null) ? null : kernel.elementToIr(getter),
2518 (write == null) ? null : kernel.elementToIr(write)); 2527 (setter == null) ? null : kernel.elementToIr(setter));
2519 } 2528 }
2520 2529
2521 @override 2530 @override
2522 ir.SuperPropertyGet visitSuperGetterGet( 2531 ir.SuperPropertyGet visitSuperGetterGet(
2523 Send node, 2532 Send node,
2524 FunctionElement getter, 2533 FunctionElement getter,
2525 _) { 2534 _) {
2526 return buildSuperPropertyAccessor(getter).buildSimpleRead(); 2535 return buildSuperPropertyAccessor(getter).buildSimpleRead();
2527 } 2536 }
2528 2537
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
3051 : this(null, true, node, initializers); 3060 : this(null, true, node, initializers);
3052 3061
3053 accept(ir.Visitor v) => throw "unsupported"; 3062 accept(ir.Visitor v) => throw "unsupported";
3054 3063
3055 visitChildren(ir.Visitor v) => throw "unsupported"; 3064 visitChildren(ir.Visitor v) => throw "unsupported";
3056 3065
3057 String toString() { 3066 String toString() {
3058 return "IrFunction($kind, $isConstructor, $node, $initializers)"; 3067 return "IrFunction($kind, $isConstructor, $node, $initializers)";
3059 } 3068 }
3060 } 3069 }
OLDNEW
« no previous file with comments | « no previous file | test/kernel/regression/super_operator.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698