Chromium Code Reviews| Index: pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart |
| diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart |
| index 4d4e98a76151fd66653b4ea698c045e0795fb3ef..06948ec4fa7b000952c0ffca329fb5e56caae60b 100644 |
| --- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart |
| +++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart |
| @@ -11,8 +11,8 @@ import '../dart2jslib.dart'; |
| import '../elements/elements.dart'; |
| import '../io/source_information.dart'; |
| import '../tree/tree.dart' as ast; |
| -import '../closure.dart' hide ClosureScope; |
| import 'cps_ir_nodes.dart' as ir; |
|
floitsch
2015/03/12 18:04:02
why this change?
Johnni Winther
2015/03/16 13:28:13
Rebasing did it. Reverted.
|
| +import '../closure.dart' hide ClosureScope; |
| import 'cps_ir_builder_task.dart' show DartCapturedVariables; |
| /// A mapping from variable elements to their compile-time values. |
| @@ -259,8 +259,6 @@ abstract class IrBuilder { |
| void declareLocalVariable(LocalVariableElement element, |
| {ir.Primitive initialValue}); |
| - ir.Primitive buildLocalGet(LocalElement element); |
| - ir.Primitive buildLocalSet(LocalElement element, ir.Primitive value); |
| /// Called when entering a nested function with free variables. |
| /// |
| @@ -697,10 +695,18 @@ abstract class IrBuilder { |
| Selector selector, |
| List<ir.Primitive> arguments); |
| - /// Create a setter invocation on the super class where the setter name and |
| - /// argument are defined by [selector] and [value], respectively. |
| - void buildSuperSet(Element target, Selector selector, ir.Primitive value) { |
| + /// Create a getter invocation of the [target] on the super class. |
| + ir.Primitive buildSuperGet(Element target) { |
| + Selector selector = new Selector.getter(target.name, target.library); |
| + return buildSuperInvocation(target, selector, const <ir.Primitive>[]); |
| + } |
| + |
| + /// Create a setter invocation of the [target] on the super class of with |
| + /// [value]. |
| + ir.Primitive buildSuperSet(Element target, ir.Primitive value) { |
| + Selector selector = new Selector.setter(target.name, target.library); |
| buildSuperInvocation(target, selector, [value]); |
| + return value; |
| } |
| /// Create an index set invocation on the super class with the provided |
| @@ -749,6 +755,20 @@ abstract class IrBuilder { |
| return value; |
| } |
| + /// Create a read access of [local]. |
| + ir.Primitive buildLocalGet(LocalElement element); |
| + |
| + /// Create a write access to [local] with the provided [value]. |
| + ir.Primitive buildLocalSet(LocalElement element, ir.Primitive value); |
| + |
| + /// Create an invocation of the local [element] where argument structure is |
| + /// defined by [selector] and the argument values are defined by [arguments]. |
| + ir.Primitive buildLocalInvocation(LocalElement element, |
| + Selector selector, |
| + List<ir.Primitive> arguments) { |
| + return buildCallInvocation(buildLocalGet(element), selector, arguments); |
| + } |
| + |
| /// Create a static invocation of [element] where argument structure is |
| /// defined by [selector] and the argument values are defined by [arguments]. |
| ir.Primitive buildStaticInvocation(Element element, |
| @@ -761,10 +781,9 @@ abstract class IrBuilder { |
| /// Create a static getter invocation of [element] where the getter name is |
| /// defined by [selector]. |
| ir.Primitive buildStaticGet(Element element, |
| - Selector selector, |
| {SourceInformation sourceInformation}) { |
| - assert(selector.isGetter); |
| // TODO(karlklose,sigurdm): build different nodes for getters. |
|
floitsch
2015/03/12 18:04:02
I guess this comment should be one down.
Johnni Winther
2015/03/16 13:28:13
Done.
|
| + Selector selector = new Selector.getter(element.name, element.library); |
| return _buildInvokeStatic( |
| element, selector, const <ir.Primitive>[], sourceInformation); |
| } |
| @@ -772,11 +791,10 @@ abstract class IrBuilder { |
| /// Create a static setter invocation of [element] where the setter name and |
| /// argument are defined by [selector] and [value], respectively. |
| ir.Primitive buildStaticSet(Element element, |
| - Selector selector, |
| ir.Primitive value, |
| {SourceInformation sourceInformation}) { |
| - assert(selector.isSetter); |
| // TODO(karlklose,sigurdm): build different nodes for setters. |
|
floitsch
2015/03/12 18:04:02
ditto.
Johnni Winther
2015/03/16 13:28:13
Done.
|
| + Selector selector = new Selector.setter(element.name, element.library); |
| _buildInvokeStatic( |
| element, selector, <ir.Primitive>[value], sourceInformation); |
| return value; |
| @@ -1150,8 +1168,7 @@ abstract class IrBuilder { |
| if (Elements.isLocal(variableElement)) { |
| bodyBuilder.buildLocalSet(variableElement, currentValue); |
| } else if (Elements.isStaticOrTopLevel(variableElement)) { |
| - bodyBuilder.buildStaticSet( |
| - variableElement, variableSelector, currentValue); |
| + bodyBuilder.buildStaticSet(variableElement, currentValue); |
| } else { |
| ir.Primitive receiver = bodyBuilder.buildThis(); |
| bodyBuilder.buildDynamicSet(receiver, variableSelector, currentValue); |