From 867d6c03da75d66961876856439c5ec483a02f8e Mon Sep 17 00:00:00 2001 From: daarond Date: Tue, 12 May 2015 16:20:57 -0500 Subject: [PATCH] changes from Neil's comments --- generators/php.js | 14 ++++++-------- generators/php/colour.js | 2 +- generators/php/lists.js | 2 +- generators/php/logic.js | 2 +- generators/php/loops.js | 2 +- generators/php/math.js | 2 +- generators/php/procedures.js | 2 +- generators/php/text.js | 2 +- generators/php/variables.js | 2 +- 9 files changed, 14 insertions(+), 16 deletions(-) diff --git a/generators/php.js b/generators/php.js index aded12ebc..6263a5892 100644 --- a/generators/php.js +++ b/generators/php.js @@ -2,7 +2,7 @@ * @license * Visual Blocks Language * - * Copyright 2012 Google Inc. + * Copyright 2015 Google Inc. * https://developers.google.com/blockly/ * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -43,7 +43,6 @@ Blockly.PHP = new Blockly.Generator('PHP'); * @private */ Blockly.PHP.addReservedWords( - 'Blockly,' + // In case JS is evaled in the current window. // http://php.net/manual/en/reserved.keywords.php '__halt_compiler,abstract,and,array,as,break,callable,case,catch,class,clone,const,continue,declare,default,die,do,echo,else,elseif,empty,enddeclare,endfor,endforeach,endif,endswitch,endwhile,eval,exit,extends,final,for,foreach,function,global,goto,if,implements,include,include_once,instanceof,insteadof,interface,isset,list,namespace,new,or,print,private,protected,public,require,require_once,return,static,switch,throw,trait,try,unset,use,var,while,xor,' + // http://php.net/manual/en/reserved.constants.php @@ -51,7 +50,7 @@ Blockly.PHP.addReservedWords( /** * Order of operation ENUMs. - * https://developer.mozilla.org/en/PHP/Reference/Operators/Operator_Precedence + * http://php.net/manual/en/language.operators.precedence.php */ Blockly.PHP.ORDER_ATOMIC = 0; // 0 "" ... Blockly.PHP.ORDER_CLONE = 1; // clone @@ -64,9 +63,6 @@ Blockly.PHP.ORDER_LOGICAL_NOT = 4; // ! Blockly.PHP.ORDER_BITWISE_NOT = 4; // ~ Blockly.PHP.ORDER_UNARY_PLUS = 4; // + Blockly.PHP.ORDER_UNARY_NEGATION = 4; // - -Blockly.PHP.ORDER_TYPEOF = 4; // typeof -Blockly.PHP.ORDER_VOID = 4; // void -Blockly.PHP.ORDER_DELETE = 4; // delete Blockly.PHP.ORDER_MULTIPLICATION = 5; // * Blockly.PHP.ORDER_DIVISION = 5; // / Blockly.PHP.ORDER_MODULUS = 5; // % @@ -116,8 +112,10 @@ Blockly.PHP.getDistinctName = function(name, type) { } safeName += i; this.variableDB_.dbReverse_[safeName] = true; - if (type === Blockly.Procedures.NAME_TYPE) return safeName; - return '$' + safeName; + if (type == Blockly.Variables.NAME_TYPE) { + safeName = '$' + safeName; + } + return safeName; }; Blockly.PHP.getName = function(name, type) { diff --git a/generators/php/colour.js b/generators/php/colour.js index dcd587427..f04cd0cd3 100644 --- a/generators/php/colour.js +++ b/generators/php/colour.js @@ -2,7 +2,7 @@ * @license * Visual Blocks Language * - * Copyright 2012 Google Inc. + * Copyright 2015 Google Inc. * https://developers.google.com/blockly/ * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/generators/php/lists.js b/generators/php/lists.js index 4a74df0a7..f0d4d298a 100644 --- a/generators/php/lists.js +++ b/generators/php/lists.js @@ -2,7 +2,7 @@ * @license * Visual Blocks Language * - * Copyright 2012 Google Inc. + * Copyright 2015 Google Inc. * https://developers.google.com/blockly/ * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/generators/php/logic.js b/generators/php/logic.js index b9e3c8f27..59389239f 100644 --- a/generators/php/logic.js +++ b/generators/php/logic.js @@ -2,7 +2,7 @@ * @license * Visual Blocks Language * - * Copyright 2012 Google Inc. + * Copyright 2015 Google Inc. * https://developers.google.com/blockly/ * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/generators/php/loops.js b/generators/php/loops.js index 87c8d0a27..dfb29c6fe 100644 --- a/generators/php/loops.js +++ b/generators/php/loops.js @@ -2,7 +2,7 @@ * @license * Visual Blocks Language * - * Copyright 2012 Google Inc. + * Copyright 2015 Google Inc. * https://developers.google.com/blockly/ * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/generators/php/math.js b/generators/php/math.js index b2329e0ad..d0296d992 100644 --- a/generators/php/math.js +++ b/generators/php/math.js @@ -2,7 +2,7 @@ * @license * Visual Blocks Language * - * Copyright 2012 Google Inc. + * Copyright 2015 Google Inc. * https://developers.google.com/blockly/ * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/generators/php/procedures.js b/generators/php/procedures.js index a97765f56..9744735dd 100644 --- a/generators/php/procedures.js +++ b/generators/php/procedures.js @@ -2,7 +2,7 @@ * @license * Visual Blocks Language * - * Copyright 2012 Google Inc. + * Copyright 2015 Google Inc. * https://developers.google.com/blockly/ * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/generators/php/text.js b/generators/php/text.js index 2e51c30ff..a167a4d06 100644 --- a/generators/php/text.js +++ b/generators/php/text.js @@ -2,7 +2,7 @@ * @license * Visual Blocks Language * - * Copyright 2012 Google Inc. + * Copyright 2015 Google Inc. * https://developers.google.com/blockly/ * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/generators/php/variables.js b/generators/php/variables.js index 4c3b0502d..b8c8a63db 100644 --- a/generators/php/variables.js +++ b/generators/php/variables.js @@ -2,7 +2,7 @@ * @license * Visual Blocks Language * - * Copyright 2012 Google Inc. + * Copyright 2015 Google Inc. * https://developers.google.com/blockly/ * * Licensed under the Apache License, Version 2.0 (the "License");