You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ca...@apache.org on 2019/10/01 09:00:31 UTC
[royale-docs] branch master updated: update language for highlight
from "actionscript" to "as3" in all pages left
This is an automated email from the ASF dual-hosted git repository.
carlosrovira pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/royale-docs.git
The following commit(s) were added to refs/heads/master by this push:
new 5e086cd update language for highlight from "actionscript" to "as3" in all pages left
5e086cd is described below
commit 5e086cd4b8df838d0b049262dcdddab84c0c4184
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Tue Oct 1 11:00:23 2019 +0200
update language for highlight from "actionscript" to "as3" in all pages left
---
.../optimizations/compiler-configuration-settings.md | 10 +++++-----
.../optimizations/doc-comment-directives.md | 12 ++++++------
features/actionscript/abstract-classes.md | 8 ++++----
features/actionscript/private-constructors.md | 6 +++---
4 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/create-an-application/optimizations/compiler-configuration-settings.md b/create-an-application/optimizations/compiler-configuration-settings.md
index 2a00941..5209201 100644
--- a/create-an-application/optimizations/compiler-configuration-settings.md
+++ b/create-an-application/optimizations/compiler-configuration-settings.md
@@ -55,7 +55,7 @@ Note that some reflection utility functions require this to be true in order for
This corresponds to AVM runtime implicit type coercions for non-primitive types (anything that is not a Number, int, uint, String, Boolean) and is not being cast to something that is untyped (__*__ type) or loosely typed, e.g. of **Object** type.
An (overly simplistic) example would be:
-```actionscript
+```as3
var cat:Cat = new Cat();
var myCats:Array = [cat];
//from this point on, array access of index 0 in myCats
@@ -89,7 +89,7 @@ It ensures greater compatibility between AVM and javascript, in particular for s
This is not just important for the binary operators like `===` or `!==`, but also for things like `Array.indexOf`, which uses strict equality for checking.
An (overly simplistic) example would be:
-```actionscript
+```as3
var clazz:Class = String;
var test:Array = ['test', new clazz(30.5)];
//in AVM, the above would result in: ['test', '30.5']
@@ -113,7 +113,7 @@ In javascript the **js‑debug** output, you can do a ***search in files***
This corresponds to AVM runtime checking during Vector index assignments (*note:* currently only for assignment, not access)
An (overly simplistic) example would be:
-```actionscript
+```as3
var myVec:Vector.<Number> = new Vector.<Number>();
myVec[1] = 2;
//the above will generate a runtime error in AVM,
@@ -123,7 +123,7 @@ myVec[1] = 2;
```
or:
-```actionscript
+```as3
myVec = new Vector.<Number>(20,true); //create a fixed length Vector, with indices 0 to 19.
myVec[20] = 2;
//the above will generate a runtime error in AVM,
@@ -138,7 +138,7 @@ In most cases it could be avoided to assist with performance. This is particular
Often the loop variable is used as the index for the value assignment, and in this case, it is usually already certain to be within the valid range for the targetted Vector instance.
For example:
-```actionscript
+```as3
var l:uint = myVec.length;
for (var i:uint = 0; i<l; i++) {
myVec[i] = i/SOME_CONST;
diff --git a/create-an-application/optimizations/doc-comment-directives.md b/create-an-application/optimizations/doc-comment-directives.md
index 7f7eaf8..53041df 100644
--- a/create-an-application/optimizations/doc-comment-directives.md
+++ b/create-an-application/optimizations/doc-comment-directives.md
@@ -59,7 +59,7 @@ This means that for:
class MyThing{
public var myImportantVar:String = 'myValue';
}
-```actionscript
+```as3
var myThing:MyThing = new MyThing();
var s:String = myThing.myImportantVar; //this always works
var fieldName:String = 'myImportantVar';
@@ -68,7 +68,7 @@ s = myThing[fieldName]; //this will work in a js-debug build, but may not work i
Because of issues like the above, the Royale compiler outputs a warning to alert the developer.
However in many cases, the dynamic access may not be needed, and using a public var will be fine.
To prevent the warning from the compiler, the doc comment directive can be used as follows:
-```actionscript
+```as3
/**
* @royalesuppresspublicvarwarning
*/
@@ -84,7 +84,7 @@ This is an option to avoid compiler output of coercions of a certain type.
It can help avoid unnecessary code and improve performance.
A simplistic, illustrative example is:
-```actionscript
+```as3
if (myVar is MyClass) { //this generates code to check if myVar is of type 'MyClass'
(myVar as MyClass).myClassMethod();
//the above normally generates similar code to check if myVar is of type 'MyClass'
@@ -115,7 +115,7 @@ Please read the [Strict equality comparisons](create-an-application/optimization
How to use:
A simplistic example is:
-```actionscript
+```as3
/**
* setting goes here
*/
@@ -153,7 +153,7 @@ Please read the [Vector Index Checking](create-an-application/optimizations/comp
How to use:
A simplistic example is:
-```actionscript
+```as3
/**
* setting goes here
*/
@@ -193,7 +193,7 @@ Please read the [Implict Coercions of non-primitive types](create-an-application
How to use:
A simplistic example is:
-```actionscript
+```as3
/**
* setting goes here
*/
diff --git a/features/actionscript/abstract-classes.md b/features/actionscript/abstract-classes.md
index 5aaaa41..7054232 100644
--- a/features/actionscript/abstract-classes.md
+++ b/features/actionscript/abstract-classes.md
@@ -38,7 +38,7 @@ mxmlc -allow-abstract-classes=false MyApp.mxml
Consider the following code that creates a class named `GraphicsObject`:
-```actionscript
+```as3
package
{
public abstract class GraphicsObject
@@ -57,7 +57,7 @@ package
This class uses the `abstract` modifier, so if we tried to instantiate the class directly, we'd get a compile-time error:
-```actionscript
+```as3
// Error: Abstract classes cannot be instantiated with the new operator.
var object:GraphicsObject = new GraphicsObject();
```
@@ -69,7 +69,7 @@ The `GraphicsObject` class defines a method named `draw()` that also uses the `a
The next code sample show how to extend the abstract class `GraphicsObject` and implement its `draw()` method:
-```actionscript
+```as3
package
{
public class Rectangle extends GraphicsObject
@@ -98,7 +98,7 @@ package
If we extended `GraphicsObject` and did not implement its abstract method, we'd get a compile-time error:
-```actionscript
+```as3
package
{
// Error: Method draw in abstract class GraphicsObject not implemented by class Foobar
diff --git a/features/actionscript/private-constructors.md b/features/actionscript/private-constructors.md
index 614f097..7a5df4c 100644
--- a/features/actionscript/private-constructors.md
+++ b/features/actionscript/private-constructors.md
@@ -38,7 +38,7 @@ mxmlc -allow-private-constructors=false MyApp.mxml
You might implement a global logger as a singleton by using a private constructor.
-```actionscript
+```as3
package
{
public class Logger
@@ -68,7 +68,7 @@ package
If you were to attempt to instantate this `Logger` class, the compiler would fail with an error:
-```actionscript
+```as3
package com.example
{
public class MyApplication
@@ -84,7 +84,7 @@ package com.example
However, you may call `Logger.getInstance()` to access an instance that is created inside the `Logger` class itself:
-```actionscript
+```as3
package com.example
{
public class MyApplication