gobstones-code-runner 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 844e384b48de376e216b3a46967286478da86e79f8bba21b4f2d9ce2db97cab6
4
- data.tar.gz: de9b26b6d68bac5f6c798278ed6ad6b31b9598dda967a321466fe16a2b758753
3
+ metadata.gz: e573e21d04542a3a3c641184dbde11da4cc41c68fa0bca64a4314936522c72b5
4
+ data.tar.gz: 0c76ec7c9017defb7b66268c5f483818576b9f0a8de829dd26adff4339558801
5
5
  SHA512:
6
- metadata.gz: 66445365da20a2f998ca77e191e00d033bda8111f194a93b8e5776b495870c4f4b51935173548e5abec978992bea54fcc7cd6c278fe1089482998c504017e9d5
7
- data.tar.gz: 227f1d8c17f9e766a31868371edfcc6f2b6b951fe3606e9154dd778532ca6cccb229e44b76762633f29667d49b5a8403cf0727216100496592daa4ae844073a2
6
+ metadata.gz: dd5c4dd52aed44d217c2a4187e34d8dfc822fd3e465078f5577f489f235a4e37a5e4a013567787a3fab62ced7ec93f2f41140da66db80dcd6a4d46d194b788e4
7
+ data.tar.gz: 35fca0ed6734d05c9d081932fe5c68a02722782f771622c279a4170e1f4e640624cad3b53d234eb81882e277cc4d465aa48ff378d3e344a793d5418e78686950
@@ -4214,25 +4214,34 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
4214
4214
  try {
4215
4215
  var result = this.parser.interpret(ast.program, initialState);
4216
4216
  return {
4217
- states: this._getStates(result, ast.teacher),
4217
+ states: this._getStates(result, ast),
4218
4218
  returnValue: result.returnValue,
4219
4219
  actualReturnValue: result.actualReturnValue
4220
4220
  };
4221
4221
  } catch (e) {
4222
4222
  e.location = this.parser.getErrorLineAndMode(e, code);
4223
4223
  return {
4224
- states: this._getStates(e, ast.teacher, { error: e })
4224
+ states: this._getStates(e, ast, { error: e })
4225
4225
  };
4226
4226
  }
4227
4227
  }
4228
4228
 
4229
- _getStates(result, teacherAst, lastState = []) {
4230
- const teacherTools = this.__flatten(Object.values(
4231
- this.parser.getActionsFromAst(teacherAst)
4229
+ _getActionsOf(ast) {
4230
+ return this.__flatten(Object.values(
4231
+ this.parser.getActionsFromAst(ast)
4232
4232
  )).map(it => it.name);
4233
+ }
4233
4234
 
4234
- const snapshots = result.snapshots;
4235
+ _getStates(result, ast, lastState = []) {
4236
+ const studentAtomic = this._getActionsOf(ast.main).filter((it) =>
4237
+ ast.main.getAttributes(it).atomic != null
4238
+ );
4239
+ const teacherAtomic = this._getActionsOf(ast.teacher).filter((it) =>
4240
+ ast.main.getAttributes(it).nonatomic == null
4241
+ );
4242
+ const atomicActions = studentAtomic.concat(teacherAtomic);
4235
4243
 
4244
+ const snapshots = result.snapshots;
4236
4245
  return snapshots
4237
4246
  .filter((snapshot, i) => {
4238
4247
  const toName = (it) => it.split("-")[0];
@@ -4241,10 +4250,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
4241
4250
  const lastName = snapshot.contextNames[snapshot.contextNames.length - 1];
4242
4251
 
4243
4252
  let topIgnoredName = prevNames.find((it) =>
4244
- teacherTools.includes(toName(it))
4253
+ atomicActions.includes(toName(it))
4245
4254
  ) || lastName;
4246
4255
 
4247
- const hasToIgnoreIt = teacherTools.includes(toName(topIgnoredName));
4256
+ const hasToIgnoreIt = atomicActions.includes(toName(topIgnoredName));
4248
4257
 
4249
4258
  const isTheLastOcurrence = snapshots.slice(i + 1).every(futureSnapshot =>
4250
4259
  !futureSnapshot.contextNames.includes(topIgnoredName)
@@ -20134,6 +20143,7 @@ function writeJboardToFile(filename, jboard) {
20134
20143
 
20135
20144
  this.runner.run({
20136
20145
  ast: {
20146
+ main: ast,
20137
20147
  program: ast.program,
20138
20148
  teacher: teacherAst
20139
20149
  },
@@ -1,5 +1,5 @@
1
1
  module Gobstones
2
2
  module CodeRunner
3
- VERSION = "0.8.0"
3
+ VERSION = "0.9.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gobstones-code-runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Alfonso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-21 00:00:00.000000000 Z
11
+ date: 2019-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler