Skip to content

Commit fe33178

Browse files
committed
Fixed closure build error
Add removed functions from Closure Library. Fixed wrong build option (use_closure_library).
1 parent 4edeeaf commit fe33178

13 files changed

+1223
-895
lines changed

ardublockly/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
<link rel="stylesheet" href="ardublockly.css" media="screen,projection">
1414

1515
<!-- Ardublockly - These three files contain the compress version -->
16-
<!--script src="../blockly/blockly_compressed.js"></script>
16+
<script src="../blockly/blockly_compressed.js"></script>
1717
<script src="../blockly/blocks_compressed.js"></script>
18-
<script src="../blockly/arduino_compressed.js"></script-->
18+
<script src="../blockly/arduino_compressed.js"></script>
1919
<!-- To use the uncompressed version comment out the above and comment in the ones below -->
20-
<script src="../blockly/blockly_uncompressed.js"></script>
20+
<!--script src="../blockly/blockly_uncompressed.js"></script>
2121
<script src="../blockly/blocks/logic.js"></script>
2222
<script src="../blockly/blocks/loops.js"></script>
2323
<script src="../blockly/blocks/math.js"></script>
@@ -54,7 +54,7 @@
5454
<script src="../blockly/generators/arduino/text.js"></script>
5555
<script src="../blockly/generators/arduino/time.js"></script>
5656
<script src="../blockly/generators/arduino/tone.js"></script>
57-
<script src="../blockly/generators/arduino/variables.js"></script>
57+
<script src="../blockly/generators/arduino/variables.js"></script-->
5858

5959
<!-- Default language js files, user selection appended to head on load -->
6060
<script src="../blockly/msg/js/en.js"></script>

blockly/arduino_compressed.js

Lines changed: 21 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

blockly/blockly_compressed.js

Lines changed: 963 additions & 772 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

blockly/blockly_uncompressed.js

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

blockly/blocks_compressed.js

Lines changed: 59 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

blockly/build.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def gen_blocks(self):
214214
# Define the parameters for the POST request.
215215
params = [
216216
("compilation_level", "SIMPLE_OPTIMIZATIONS"),
217-
("use_closure_library", "true"),
217+
("use_closure_library", "false"),
218218
("output_format", "json"),
219219
("output_info", "compiled_code"),
220220
("output_info", "warnings"),
@@ -244,7 +244,7 @@ def gen_generator(self, language):
244244
# Define the parameters for the POST request.
245245
params = [
246246
("compilation_level", "SIMPLE_OPTIMIZATIONS"),
247-
("use_closure_library", "true"),
247+
("use_closure_library", "false"),
248248
("output_format", "json"),
249249
("output_info", "compiled_code"),
250250
("output_info", "warnings"),

blockly/core/base.js

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
2+
'use strict';
3+
4+
goog.provide('Blockly.Base');
5+
6+
/**
7+
* Functions removed from Closure Library.
8+
*/
9+
10+
/**
11+
* Returns true if the specified value is null.
12+
* @param {?} val Variable to test.
13+
* @return {boolean} Whether variable is null.
14+
*/
15+
goog.isNull = function(val) {
16+
return val === null;
17+
};
18+
19+
/**
20+
* Returns true if the specified value is defined and not null.
21+
* @param {?} val Variable to test.
22+
* @return {boolean} Whether variable is defined and not null.
23+
*/
24+
goog.isDefAndNotNull = function(val) {
25+
// Note that undefined == null.
26+
return val != null;
27+
};
28+
29+
/**
30+
* Returns true if the specified value is an array.
31+
* @param {?} val Variable to test.
32+
* @return {boolean} Whether variable is an array.
33+
*/
34+
goog.isArray = function(val) {
35+
return goog.typeOf(val) == 'array';
36+
};
37+
38+
/**
39+
* Returns true if the specified value is a string.
40+
* @param {?} val Variable to test.
41+
* @return {boolean} Whether variable is a string.
42+
*/
43+
goog.isString = function(val) {
44+
return typeof val == 'string';
45+
};
46+
47+
/**
48+
* Returns true if the specified value is a boolean.
49+
* @param {?} val Variable to test.
50+
* @return {boolean} Whether variable is boolean.
51+
*/
52+
goog.isBoolean = function(val) {
53+
return typeof val == 'boolean';
54+
};
55+
56+
/**
57+
* Returns true if the specified value is a number.
58+
* @param {?} val Variable to test.
59+
* @return {boolean} Whether variable is a number.
60+
*/
61+
goog.isNumber = function(val) {
62+
return typeof val == 'number';
63+
};
64+
65+
/**
66+
* Returns true if the specified value is a function.
67+
* @param {?} val Variable to test.
68+
* @return {boolean} Whether variable is a function.
69+
*/
70+
goog.isFunction = function(val) {
71+
return goog.typeOf(val) == 'function';
72+
};
73+
74+
/**
75+
* Returns true if the specified value is an object. This includes arrays and
76+
* functions.
77+
* @param {?} val Variable to test.
78+
* @return {boolean} Whether variable is an object.
79+
*/
80+
goog.isObject = function(val) {
81+
var type = typeof val;
82+
return type == 'object' && val != null || type == 'function';
83+
// return Object(val) === val also works, but is slower, especially if val is
84+
// not an object.
85+
};
86+
87+
88+
/**
89+
* Copies all the members of a source object to a target object. This method
90+
* does not work on all browsers for all objects that contain keys such as
91+
* toString or hasOwnProperty. Use goog.object.extend for this purpose.
92+
* @param {Object} target Target.
93+
* @param {Object} source Source.
94+
*/
95+
goog.mixin = function(target, source) {
96+
for (var x in source) {
97+
target[x] = source[x];
98+
}
99+
100+
// For IE7 or lower, the for-in-loop does not contain any properties that are
101+
// not enumerable on the prototype object (for example, isPrototypeOf from
102+
// Object.prototype) but also it will not include 'replace' on objects that
103+
// extend String and change 'replace' (not that it is common for anyone to
104+
// extend anything except Object).
105+
};

blockly/core/blockly.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
// Top level object for Blockly.
2828
goog.provide('Blockly');
2929

30+
goog.require('Blockly.Base');
3031
goog.require('Blockly.BlockSvg.render');
3132
goog.require('Blockly.Events');
3233
goog.require('Blockly.FieldAngle');
@@ -581,3 +582,5 @@ if (!goog.global['Blockly']) {
581582
}
582583
goog.global['Blockly']['getMainWorkspace'] = Blockly.getMainWorkspace;
583584
goog.global['Blockly']['addChangeListener'] = Blockly.addChangeListener;
585+
586+

0 commit comments

Comments
 (0)