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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/ir/ir_builder.dart

Issue 233153002: Support assignment to parameters in the dart2dart backend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed argument order. Oops. Created 6 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 | Annotate | Revision Log
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/dart_backend/dart_tree.dart ('k') | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 dart2js.ir_builder; 5 library dart2js.ir_builder;
6 6
7 import 'ir_nodes.dart' as ir; 7 import 'ir_nodes.dart' as ir;
8 import '../elements/elements.dart'; 8 import '../elements/elements.dart';
9 import '../dart2jslib.dart'; 9 import '../dart2jslib.dart';
10 import '../dart_types.dart'; 10 import '../dart_types.dart';
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 ir.Definition visitClosureSend(ast.Send node) { 344 ir.Definition visitClosureSend(ast.Send node) {
345 return giveup(); 345 return giveup();
346 } 346 }
347 347
348 ir.Definition visitDynamicSend(ast.Send node) { 348 ir.Definition visitDynamicSend(ast.Send node) {
349 return giveup(); 349 return giveup();
350 } 350 }
351 351
352 ir.Definition visitGetterSend(ast.Send node) { 352 ir.Definition visitGetterSend(ast.Send node) {
353 Element element = elements[node]; 353 Element element = elements[node];
354 if ((element != null && element.isForeign(compiler)) 354 if (!Elements.isLocal(element)) return giveup();
355 || Elements.isStaticOrTopLevelField(element)
356 || Elements.isInstanceSend(node, elements)
357 || Elements.isStaticOrTopLevelFunction(element)
358 || Elements.isErroneousElement(element)) {
359 return giveup();
360 }
361 return assignedVars[variableIndex[element]]; 355 return assignedVars[variableIndex[element]];
362 } 356 }
363 357
364 ir.Definition visitOperatorSend(ast.Send node) { 358 ir.Definition visitOperatorSend(ast.Send node) {
365 return giveup(); 359 return giveup();
366 } 360 }
367 361
368 // Build(StaticSend(f, arguments), C) = C[C'[InvokeStatic(f, xs)]] 362 // Build(StaticSend(f, arguments), C) = C[C'[InvokeStatic(f, xs)]]
369 // where (C', xs) = arguments.fold(Build, C) 363 // where (C', xs) = arguments.fold(Build, C)
370 ir.Definition visitStaticSend(ast.Send node) { 364 ir.Definition visitStaticSend(ast.Send node) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 } 407 }
414 408
415 ir.Definition visitSuperSend(ast.Send node) { 409 ir.Definition visitSuperSend(ast.Send node) {
416 return giveup(); 410 return giveup();
417 } 411 }
418 412
419 ir.Definition visitTypeReferenceSend(ast.Send node) { 413 ir.Definition visitTypeReferenceSend(ast.Send node) {
420 return giveup(); 414 return giveup();
421 } 415 }
422 416
417 ir.Definition visitSendSet(ast.SendSet node) {
418 Element element = elements[node];
419 if (!Elements.isLocal(element)) return giveup();
420 if (node.assignmentOperator.source != '=') return giveup();
421 // Exactly one argument expected for a simple assignment.
422 assert(!node.arguments.isEmpty && node.arguments.tail.isEmpty);
423 ir.Definition result = node.arguments.head.accept(this);
424 assignedVars[variableIndex[element]] = result;
425 return result;
426 }
427
423 static final String ABORT_IRNODE_BUILDER = "IrNode builder aborted"; 428 static final String ABORT_IRNODE_BUILDER = "IrNode builder aborted";
424 429
425 ir.Definition giveup() => throw ABORT_IRNODE_BUILDER; 430 ir.Definition giveup() => throw ABORT_IRNODE_BUILDER;
426 431
427 ir.FunctionDefinition nullIfGiveup(ir.FunctionDefinition action()) { 432 ir.FunctionDefinition nullIfGiveup(ir.FunctionDefinition action()) {
428 try { 433 try {
429 return action(); 434 return action();
430 } catch(e) { 435 } catch(e) {
431 if (e == ABORT_IRNODE_BUILDER) return null; 436 if (e == ABORT_IRNODE_BUILDER) return null;
432 rethrow; 437 rethrow;
433 } 438 }
434 } 439 }
435 440
436 void internalError(String reason, {ast.Node node}) { 441 void internalError(String reason, {ast.Node node}) {
437 giveup(); 442 giveup();
438 } 443 }
439 } 444 }
440 445
441 // Verify that types are ones that can be reconstructed by the type emitter. 446 // Verify that types are ones that can be reconstructed by the type emitter.
442 class SupportedTypeVerifier extends DartTypeVisitor<bool, Null> { 447 class SupportedTypeVerifier extends DartTypeVisitor<bool, Null> {
443 bool visitType(DartType type, Null _) => false; 448 bool visitType(DartType type, Null _) => false;
444 449
445 bool visitVoidType(VoidType type, Null _) => true; 450 bool visitVoidType(VoidType type, Null _) => true;
446 451
447 // Currently, InterfaceType and TypedefType are supported so long as they 452 // Currently, InterfaceType and TypedefType are supported so long as they
448 // do not have type parameters. They are subclasses of GenericType. 453 // do not have type parameters. They are subclasses of GenericType.
449 bool visitGenericType(GenericType type, Null _) => !type.isGeneric; 454 bool visitGenericType(GenericType type, Null _) => !type.isGeneric;
450 } 455 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/dart_backend/dart_tree.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698