Chromium Code Reviews| Index: plugins/org.chromium.sdk.wipbackend.dev/src/org/chromium/sdk/internal/wip/WipContextBuilder.java |
| diff --git a/plugins/org.chromium.sdk.wipbackend.dev/src/org/chromium/sdk/internal/wip/WipContextBuilder.java b/plugins/org.chromium.sdk.wipbackend.dev/src/org/chromium/sdk/internal/wip/WipContextBuilder.java |
| index dbb91cdb6e59a33d48a1928fb3c166306185e6f6..11dfb691e88f2d3a1d3806b59818a6fe95cdb386 100644 |
| --- a/plugins/org.chromium.sdk.wipbackend.dev/src/org/chromium/sdk/internal/wip/WipContextBuilder.java |
| +++ b/plugins/org.chromium.sdk.wipbackend.dev/src/org/chromium/sdk/internal/wip/WipContextBuilder.java |
| @@ -329,9 +329,11 @@ class WipContextBuilder { |
| public List<JsScope> construct() { |
| final List<JsScope> scopes = new ArrayList<JsScope>(scopeDataList.size()); |
| + ScopeHolderParams holderParams = new ScopeHolderParams(id, null); |
| + |
| for (int i = 0; i < scopeDataList.size(); i++) { |
| ScopeValue scopeData = scopeDataList.get(i); |
| - scopes.add(createScope(scopeData, valueLoader)); |
| + scopes.add(createScope(scopeData, valueLoader, holderParams, i)); |
| } |
| return scopes; |
| } |
| @@ -410,7 +412,7 @@ class WipContextBuilder { |
| } |
| private JsVariable createSimpleNameVariable(String name, RemoteObjectValue thisObjectData) { |
| - return valueLoader.getValueBuilder().createVariable(thisObjectData, name); |
| + return valueLoader.getValueBuilder().createVariable(thisObjectData, name, null); |
| } |
| private final WipEvaluateContextBase<?> evaluateContext = |
| @@ -563,7 +565,8 @@ class WipContextBuilder { |
| }; |
| - static JsScope createScope(ScopeValue scopeData, WipValueLoader valueLoader) { |
| + static JsScope createScope(ScopeValue scopeData, WipValueLoader valueLoader, |
| + ScopeHolderParams holderParams, int number) { |
|
apavlov
2013/02/18 11:34:08
"number"? Should it be "scopeIndex" instead?
Peter Rybin
2013/02/18 23:32:52
Done.
|
| JsScope.Type type = WIP_TO_SDK_SCOPE_TYPE.get(scopeData.type()); |
| if (type == null) { |
| type = JsScope.Type.UNKNOWN; |
| @@ -571,7 +574,8 @@ class WipContextBuilder { |
| if (type == JsScope.Type.WITH || type == JsScope.Type.GLOBAL) { |
| return new ObjectScopeImpl(scopeData, type, valueLoader); |
| } else { |
| - return new DeclarativeScopeImpl(scopeData, type, valueLoader); |
| + ScopeParams scopeParams = new ScopeParams(holderParams, number); |
| + return new DeclarativeScopeImpl(scopeData, scopeParams, type, valueLoader); |
| } |
| } |
| @@ -579,11 +583,14 @@ class WipContextBuilder { |
| private final AsyncFutureRef<Getter<ScopeVariables>> propertiesRef = |
| new AsyncFutureRef<Getter<ScopeVariables>>(); |
| private final String objectId; |
| + private final ScopeParams scopeParams; |
| private final Type type; |
| private final WipValueLoader valueLoader; |
| - public DeclarativeScopeImpl(ScopeValue scopeData, Type type, WipValueLoader valueLoader) { |
| + public DeclarativeScopeImpl(ScopeValue scopeData, ScopeParams scopeParams, Type type, |
| + WipValueLoader valueLoader) { |
| this.type = type; |
| + this.scopeParams = scopeParams; |
| this.objectId = scopeData.object().objectId(); |
| this.valueLoader = valueLoader; |
| } |
| @@ -641,12 +648,7 @@ class WipContextBuilder { |
| for (PropertyDescriptorValue property : propertyList) { |
| final String name = property.name(); |
| - JsVariable variable; |
| - if (objectId == null) { |
| - variable = valueBuilder.createVariable(property.value(), name); |
| - } else { |
| - variable = valueBuilder.createObjectProperty(property, objectId, name); |
| - } |
| + JsVariable variable = valueBuilder.createVariable(property.value(), name, scopeParams); |
| properties.add(variable); |
| } |
| final ScopeVariables scopeVariables = new ScopeVariables(properties, currentCacheState); |
| @@ -674,6 +676,35 @@ class WipContextBuilder { |
| } |
| } |
| + static class ScopeHolderParams { |
| + private final String callFrameId; |
| + private final String functionId; |
| + |
| + ScopeHolderParams(String callFrameId, String functionId) { |
| + this.callFrameId = callFrameId; |
| + this.functionId = functionId; |
| + } |
| + } |
| + |
| + static class ScopeParams { |
| + private final ScopeHolderParams scopeHolder; |
| + private final int scopeNumber; |
|
apavlov
2013/02/18 11:34:08
scopeIndex?
Peter Rybin
2013/02/18 23:32:52
Done.
|
| + |
| + private ScopeParams(ScopeHolderParams scopeHolder, int scopeNumber) { |
| + this.scopeHolder = scopeHolder; |
| + this.scopeNumber = scopeNumber; |
| + } |
| + String getCallFrameId() { |
| + return scopeHolder.callFrameId; |
| + } |
| + String getFunctionId() { |
| + return scopeHolder.functionId; |
| + } |
| + int getScopeNumber() { |
| + return scopeNumber; |
| + } |
| + } |
| + |
| private static class ObjectScopeImpl implements JsScope.ObjectBased { |
| private final JsValue jsValue; |
| private final JsScope.Type type; |